Arch: Several bugfixes in arch objects
This commit is contained in:
parent
8941868e0d
commit
b701bfd1e1
|
@ -257,9 +257,9 @@ class Component:
|
|||
obj.addProperty("App::PropertyLink","Base","Base",
|
||||
"The base object this component is built upon")
|
||||
obj.addProperty("App::PropertyLinkList","Additions","Base",
|
||||
"Other shapes that are appended to this wall")
|
||||
"Other shapes that are appended to this object")
|
||||
obj.addProperty("App::PropertyLinkList","Subtractions","Base",
|
||||
"Other shapes that are subtracted from this wall")
|
||||
"Other shapes that are subtracted from this object")
|
||||
obj.Proxy = self
|
||||
self.Type = "Component"
|
||||
self.Subvolume = None
|
||||
|
|
|
@ -163,17 +163,13 @@ class _Structure(ArchComponent.Component):
|
|||
base = Part.Face(base)
|
||||
base = base.extrude(normal)
|
||||
for app in obj.Additions:
|
||||
base = base.oldFuse(app.Shape)
|
||||
if hasattr(app,"Shape"):
|
||||
if not app.Shape.isNull():
|
||||
base = base.fuse(app.Shape)
|
||||
app.ViewObject.hide() # to be removed
|
||||
for hole in obj.Subtractions:
|
||||
cut = False
|
||||
if hasattr(hole,"Proxy"):
|
||||
if hasattr(hole.Proxy,"Subvolume"):
|
||||
if hole.Proxy.Subvolume:
|
||||
base = base.cut(hole.Proxy.Subvolume)
|
||||
cut = True
|
||||
if not cut:
|
||||
if hasattr(obj,"Shape"):
|
||||
if hasattr(hole,"Shape"):
|
||||
if not hole.Shape.isNull():
|
||||
base = base.cut(hole.Shape)
|
||||
hole.ViewObject.hide() # to be removed
|
||||
if base:
|
||||
|
@ -186,6 +182,8 @@ class _Structure(ArchComponent.Component):
|
|||
fsh.append(sh)
|
||||
obj.Shape = Part.makeCompound(fsh)
|
||||
else:
|
||||
if not base.isNull():
|
||||
base = base.removeSplitter()
|
||||
obj.Shape = base
|
||||
if not DraftGeomUtils.isNull(pl): obj.Placement = pl
|
||||
|
||||
|
|
|
@ -272,10 +272,12 @@ class _Wall(ArchComponent.Component):
|
|||
"returns a subvolume from a base object"
|
||||
import Part
|
||||
max_length = 0
|
||||
f = None
|
||||
for w in base.Shape.Wires:
|
||||
if w.BoundBox.DiagonalLength > max_length:
|
||||
max_length = w.BoundBox.DiagonalLength
|
||||
f = w
|
||||
if f:
|
||||
f = Part.Face(f)
|
||||
n = f.normalAt(0,0)
|
||||
v1 = DraftVecUtils.scaleTo(n,width)
|
||||
|
@ -286,6 +288,7 @@ class _Wall(ArchComponent.Component):
|
|||
if delta:
|
||||
f.translate(delta)
|
||||
return f
|
||||
return None
|
||||
|
||||
def createGeometry(self,obj):
|
||||
"builds the wall shape"
|
||||
|
@ -368,20 +371,21 @@ class _Wall(ArchComponent.Component):
|
|||
else:
|
||||
temp = sh
|
||||
base = temp
|
||||
base = base.removeSplitter()
|
||||
|
||||
for app in obj.Additions:
|
||||
base = base.oldFuse(app.Shape)
|
||||
base = base.fuse(app.Shape)
|
||||
app.ViewObject.hide() #to be removed
|
||||
for hole in obj.Subtractions:
|
||||
if Draft.getType(hole) == "Window":
|
||||
# window
|
||||
if hole.Base and obj.Width:
|
||||
f = self.getSubVolume(hole.Base,width)
|
||||
if f:
|
||||
base = base.cut(f)
|
||||
elif Draft.isClone(hole,"Window"):
|
||||
if hole.Objects[0].Base and width:
|
||||
f = self.getSubVolume(hole.Objects[0].Base,width,hole.Placement.Base)
|
||||
if f:
|
||||
base = base.cut(f)
|
||||
elif hasattr(hole,"Shape"):
|
||||
if not hole.Shape.isNull():
|
||||
|
@ -389,6 +393,7 @@ class _Wall(ArchComponent.Component):
|
|||
hole.ViewObject.hide() # to be removed
|
||||
|
||||
if base:
|
||||
base.removeSplitter()
|
||||
obj.Shape = base
|
||||
if not DraftGeomUtils.isNull(pl):
|
||||
obj.Placement = pl
|
||||
|
|
|
@ -117,6 +117,7 @@ class _Window(ArchComponent.Component):
|
|||
obj.addProperty("App::PropertyStringList","WindowParts","Base",
|
||||
str(translate("Arch","the components of this window")))
|
||||
self.Type = "Window"
|
||||
obj.Proxy = self
|
||||
|
||||
def execute(self,obj):
|
||||
self.createGeometry(obj)
|
||||
|
@ -130,6 +131,7 @@ class _Window(ArchComponent.Component):
|
|||
pl = obj.Placement
|
||||
if obj.Base:
|
||||
if obj.Base.isDerivedFrom("Part::Feature"):
|
||||
if hasattr(obj,"WindowParts"):
|
||||
if obj.WindowParts and (len(obj.WindowParts)%5 == 0):
|
||||
shapes = []
|
||||
for i in range(len(obj.WindowParts)/5):
|
||||
|
@ -164,6 +166,7 @@ class _Window(ArchComponent.Component):
|
|||
shape.translate(zov)
|
||||
print shape
|
||||
shapes.append(shape)
|
||||
if shapes:
|
||||
obj.Shape = Part.makeCompound(shapes)
|
||||
if not DraftGeomUtils.isNull(pl):
|
||||
obj.Placement = pl
|
||||
|
|
Loading…
Reference in New Issue
Block a user