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