Draft: Shape2DView can now fuse Arch Walls and Structures
This commit is contained in:
@@ -5155,6 +5155,7 @@ class _Shape2DView(_DraftObject):
|
||||
obj.addProperty("App::PropertyEnumeration","ProjectionMode","Draft",QT_TRANSLATE_NOOP("App::Property","The way the viewed object must be projected"))
|
||||
obj.addProperty("App::PropertyIntegerList","FaceNumbers","Draft",QT_TRANSLATE_NOOP("App::Property","The indices of the faces to be projected in Individual Faces mode"))
|
||||
obj.addProperty("App::PropertyBool","HiddenLines","Draft",QT_TRANSLATE_NOOP("App::Property","Show hidden lines"))
|
||||
obj.addProperty("App::PropertyBool","FuseArch","Draft",QT_TRANSLATE_NOOP("App::Property","Fuse wall and structure objects of same type and material"))
|
||||
obj.addProperty("App::PropertyBool","Tessellation","Draft",QT_TRANSLATE_NOOP("App::Property","Tessellate Ellipses and B-splines into line segments"))
|
||||
obj.addProperty("App::PropertyBool","InPlace","Draft",QT_TRANSLATE_NOOP("App::Property","For Cutlines and Cutfaces modes, this leaves the faces at the cut location"))
|
||||
obj.addProperty("App::PropertyFloat","SegmentLength","Draft",QT_TRANSLATE_NOOP("App::Property","Length of line segments if tessellating Ellipses or B-splines into line segments"))
|
||||
@@ -5206,12 +5207,36 @@ class _Shape2DView(_DraftObject):
|
||||
objs = getGroupContents(obj.Base.Objects,walls=True)
|
||||
objs = removeHidden(objs)
|
||||
shapes = []
|
||||
for o in objs:
|
||||
if o.isDerivedFrom("Part::Feature"):
|
||||
if onlysolids:
|
||||
shapes.extend(o.Shape.Solids)
|
||||
if hasattr(obj,"FuseArch") and obj.FuseArch:
|
||||
shtypes = {}
|
||||
for o in objs:
|
||||
if getType(o) in ["Wall","Structure"]:
|
||||
if onlysolids:
|
||||
shtypes.setdefault(o.Material.Name if (hasattr(o,"Material") and o.Material) else "None",[]).extend(o.Shape.Solids)
|
||||
else:
|
||||
shtypes.setdefault(o.Material.Name if (hasattr(o,"Material") and o.Material) else "None",[]).append(o.Shape.copy())
|
||||
elif o.isDerivedFrom("Part::Feature"):
|
||||
if onlysolids:
|
||||
shapes.extend(o.Shape.Solids)
|
||||
else:
|
||||
shapes.append(o.Shape.copy())
|
||||
for k,v in shtypes.items():
|
||||
v1 = v.pop()
|
||||
if v:
|
||||
v1 = v1.multiFuse(v)
|
||||
v1 = v1.removeSplitter()
|
||||
if v1.Solids:
|
||||
shapes.extend(v1.Solids)
|
||||
else:
|
||||
shapes.append(o.Shape.copy())
|
||||
print("Shape2DView: Fusing Arch objects produced non-solid results")
|
||||
shapes.append(v1)
|
||||
else:
|
||||
for o in objs:
|
||||
if o.isDerivedFrom("Part::Feature"):
|
||||
if onlysolids:
|
||||
shapes.extend(o.Shape.Solids)
|
||||
else:
|
||||
shapes.append(o.Shape.copy())
|
||||
cutp,cutv,iv =Arch.getCutVolume(obj.Base.Shape,shapes)
|
||||
cuts = []
|
||||
opl = FreeCAD.Placement(obj.Base.Placement)
|
||||
|
||||
Reference in New Issue
Block a user