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