Arch: Several minor bugfixes
This commit is contained in:
parent
990ece8ce8
commit
9baf73c52f
|
@ -323,10 +323,17 @@ class Component:
|
||||||
if Draft.getType(o) != "Window":
|
if Draft.getType(o) != "Window":
|
||||||
o.ViewObject.hide()
|
o.ViewObject.hide()
|
||||||
|
|
||||||
def processSubShapes(self,obj,base):
|
def processSubShapes(self,obj,base,pl=None):
|
||||||
"Adds additions and subtractions to a base shape"
|
"Adds additions and subtractions to a base shape"
|
||||||
import Draft
|
import Draft
|
||||||
|
|
||||||
|
if pl:
|
||||||
|
if pl.isNull():
|
||||||
|
pl = None
|
||||||
|
else:
|
||||||
|
pl = FreeCAD.Placement(pl)
|
||||||
|
pl = pl.inverse()
|
||||||
|
|
||||||
# treat additions
|
# treat additions
|
||||||
for o in obj.Additions:
|
for o in obj.Additions:
|
||||||
|
|
||||||
|
@ -339,23 +346,30 @@ class Component:
|
||||||
js = ArchWall.mergeShapes(o,obj)
|
js = ArchWall.mergeShapes(o,obj)
|
||||||
if js:
|
if js:
|
||||||
add = js.cut(base)
|
add = js.cut(base)
|
||||||
|
if pl:
|
||||||
|
add.Placement = add.Placement.multiply(pl)
|
||||||
base = base.fuse(add)
|
base = base.fuse(add)
|
||||||
|
|
||||||
elif (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window")):
|
elif (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window")):
|
||||||
f = o.Proxy.getSubVolume(o)
|
f = o.Proxy.getSubVolume(o)
|
||||||
if f:
|
if f:
|
||||||
if base.Solids and f.Solids:
|
if base.Solids and f.Solids:
|
||||||
|
if pl:
|
||||||
|
f.Placement = f.Placement.multiply(pl)
|
||||||
base = base.cut(f)
|
base = base.cut(f)
|
||||||
|
|
||||||
elif o.isDerivedFrom("Part::Feature"):
|
elif o.isDerivedFrom("Part::Feature"):
|
||||||
if o.Shape:
|
if o.Shape:
|
||||||
if not o.Shape.isNull():
|
if not o.Shape.isNull():
|
||||||
if o.Shape.Solids:
|
if o.Shape.Solids:
|
||||||
|
s = o.Shape.copy()
|
||||||
|
if pl:
|
||||||
|
s.Placement = s.Placement.multiply(pl)
|
||||||
if base:
|
if base:
|
||||||
if base.Solids:
|
if base.Solids:
|
||||||
base = base.fuse(o.Shape)
|
base = base.fuse(s)
|
||||||
else:
|
else:
|
||||||
base = o.Shape
|
base = s
|
||||||
|
|
||||||
# treat subtractions
|
# treat subtractions
|
||||||
for o in obj.Subtractions:
|
for o in obj.Subtractions:
|
||||||
|
@ -370,13 +384,18 @@ class Component:
|
||||||
f = o.Proxy.getSubVolume(o)
|
f = o.Proxy.getSubVolume(o)
|
||||||
if f:
|
if f:
|
||||||
if base.Solids and f.Solids:
|
if base.Solids and f.Solids:
|
||||||
|
if pl:
|
||||||
|
f.Placement = f.Placement.multiply(pl)
|
||||||
base = base.cut(f)
|
base = base.cut(f)
|
||||||
|
|
||||||
elif o.isDerivedFrom("Part::Feature"):
|
elif o.isDerivedFrom("Part::Feature"):
|
||||||
if o.Shape:
|
if o.Shape:
|
||||||
if not o.Shape.isNull():
|
if not o.Shape.isNull():
|
||||||
if o.Shape.Solids and base.Solids:
|
if o.Shape.Solids and base.Solids:
|
||||||
base = base.cut(o.Shape)
|
s = o.Shape.copy()
|
||||||
|
if pl:
|
||||||
|
s.Placement = s.Placement.multiply(pl)
|
||||||
|
base = base.cut(s)
|
||||||
return base
|
return base
|
||||||
|
|
||||||
class ViewProviderComponent:
|
class ViewProviderComponent:
|
||||||
|
|
|
@ -628,7 +628,7 @@ class _Structure(ArchComponent.Component):
|
||||||
self.BaseProfile = base
|
self.BaseProfile = base
|
||||||
base = base.extrude(self.ExtrusionVector)
|
base = base.extrude(self.ExtrusionVector)
|
||||||
|
|
||||||
base = self.processSubShapes(obj,base)
|
base = self.processSubShapes(obj,base,pl)
|
||||||
|
|
||||||
if base:
|
if base:
|
||||||
# applying axes
|
# applying axes
|
||||||
|
@ -659,7 +659,7 @@ class _Structure(ArchComponent.Component):
|
||||||
return
|
return
|
||||||
base = base.removeSplitter()
|
base = base.removeSplitter()
|
||||||
obj.Shape = base
|
obj.Shape = base
|
||||||
if not DraftGeomUtils.isNull(pl):
|
if not pl.isNull():
|
||||||
obj.Placement = pl
|
obj.Placement = pl
|
||||||
|
|
||||||
def onChanged(self,obj,prop):
|
def onChanged(self,obj,prop):
|
||||||
|
|
|
@ -468,7 +468,7 @@ class _Wall(ArchComponent.Component):
|
||||||
FreeCAD.Console.PrintWarning(str(translate("Arch","This mesh is an invalid solid")))
|
FreeCAD.Console.PrintWarning(str(translate("Arch","This mesh is an invalid solid")))
|
||||||
obj.Base.ViewObject.show()
|
obj.Base.ViewObject.show()
|
||||||
|
|
||||||
base = self.processSubShapes(obj,base)
|
base = self.processSubShapes(obj,base,pl)
|
||||||
|
|
||||||
if base:
|
if base:
|
||||||
if not base.isNull():
|
if not base.isNull():
|
||||||
|
@ -483,7 +483,7 @@ class _Wall(ArchComponent.Component):
|
||||||
except:
|
except:
|
||||||
FreeCAD.Console.PrintError(str(translate("Arch","Error removing splitter from wall shape")))
|
FreeCAD.Console.PrintError(str(translate("Arch","Error removing splitter from wall shape")))
|
||||||
obj.Shape = base
|
obj.Shape = base
|
||||||
if not DraftGeomUtils.isNull(pl):
|
if not pl.isNull():
|
||||||
obj.Placement = pl
|
obj.Placement = pl
|
||||||
|
|
||||||
def onChanged(self,obj,prop):
|
def onChanged(self,obj,prop):
|
||||||
|
|
|
@ -594,10 +594,15 @@ class _Window(ArchComponent.Component):
|
||||||
elif prop in ["Width","Height"]:
|
elif prop in ["Width","Height"]:
|
||||||
if obj.Preset != 0:
|
if obj.Preset != 0:
|
||||||
if obj.Base:
|
if obj.Base:
|
||||||
|
try:
|
||||||
if prop == "Height":
|
if prop == "Height":
|
||||||
obj.Base.setDatum(16,obj.Height)
|
obj.Base.setDatum(16,obj.Height)
|
||||||
elif prop == "Width":
|
elif prop == "Width":
|
||||||
obj.Base.setDatum(17,obj.Width)
|
obj.Base.setDatum(17,obj.Width)
|
||||||
|
except:
|
||||||
|
# restoring constraints when loading a file fails
|
||||||
|
# because of load order, but it doesn't harm...
|
||||||
|
pass
|
||||||
FreeCAD.ActiveDocument.recompute()
|
FreeCAD.ActiveDocument.recompute()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -323,9 +323,13 @@ class Snapper:
|
||||||
snapArray = [self.snapToVertex(self.snapInfo)]
|
snapArray = [self.snapToVertex(self.snapInfo)]
|
||||||
|
|
||||||
elif Draft.getType(obj) == "Dimension":
|
elif Draft.getType(obj) == "Dimension":
|
||||||
# for dimensions we snap to their 3 points
|
# for dimensions we snap to their 2 points:
|
||||||
for pt in [obj.Start,obj.End,obj.Dimline]:
|
if obj.ViewObject:
|
||||||
snaps.append([pt,'endpoint',pt])
|
if hasattr(obj.ViewObject.Proxy,"p2") and hasattr(obj.ViewObject.Proxy,"p3"):
|
||||||
|
snaps.append([obj.ViewObject.Proxy.p2,'endpoint',obj.ViewObject.Proxy.p2])
|
||||||
|
snaps.append([obj.ViewObject.Proxy.p3,'endpoint',obj.ViewObject.Proxy.p3])
|
||||||
|
#for pt in [obj.Start,obj.End,obj.Dimline]:
|
||||||
|
# snaps.append([pt,'endpoint',pt])
|
||||||
|
|
||||||
elif Draft.getType(obj) == "Mesh":
|
elif Draft.getType(obj) == "Mesh":
|
||||||
# for meshes we only snap to vertices
|
# for meshes we only snap to vertices
|
||||||
|
|
Loading…
Reference in New Issue
Block a user