Arch: added an option to section planes to allow non-solids to be cut too
This commit is contained in:
parent
07c64e206d
commit
13e006cf35
|
@ -100,6 +100,8 @@ class _SectionPlane:
|
|||
obj.addProperty("App::PropertyPlacement","Placement","Base",translate("Arch","The placement of this object"))
|
||||
obj.addProperty("Part::PropertyPartShape","Shape","Base","")
|
||||
obj.addProperty("App::PropertyLinkList","Objects","Arch",translate("Arch","The objects that must be considered by this section plane. Empty means all document"))
|
||||
obj.addProperty("App::PropertyBool","OnlySolids","Arch",translate("Arch","If false, non-solids will be cut too, with possible wrong results."))
|
||||
obj.OnlySolids = True
|
||||
self.Type = "SectionPlane"
|
||||
|
||||
def execute(self,obj):
|
||||
|
@ -327,7 +329,13 @@ class _ArchDrawingView:
|
|||
pass
|
||||
#FreeCAD.Console.PrintWarning(translate("Arch","Skipping empty object: ")+o.Name)
|
||||
elif o.Shape.isValid():
|
||||
shapes.extend(o.Shape.Solids)
|
||||
if hasattr(obj.Source,"OnlySolids"):
|
||||
if obj.Source.OnlySolids:
|
||||
shapes.extend(o.Shape.Solids)
|
||||
else:
|
||||
shapes.append(o.Shape)
|
||||
else:
|
||||
shapes.extend(o.Shape.Solids)
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(translate("Arch","Skipping invalid object: ")+o.Name)
|
||||
cutface,cutvolume,invcutvolume = ArchCommands.getCutVolume(obj.Source.Shape.copy(),shapes)
|
||||
|
|
|
@ -4289,21 +4289,34 @@ class _Shape2DView(_DraftObject):
|
|||
if obj.Base:
|
||||
if getType(obj.Base) == "SectionPlane":
|
||||
if obj.Base.Objects:
|
||||
onlysolids = True
|
||||
if hasattr(obj.Base,"OnlySolids"):
|
||||
onlysolids = obj.Base.OnlySolids
|
||||
import Arch, Part, Drawing
|
||||
objs = getGroupContents(obj.Base.Objects,walls=True)
|
||||
objs = removeHidden(objs)
|
||||
shapes = []
|
||||
for o in objs:
|
||||
if o.isDerivedFrom("Part::Feature"):
|
||||
shapes.extend(o.Shape.Solids)
|
||||
if onlysolids:
|
||||
shapes.extend(o.Shape.Solids)
|
||||
else:
|
||||
shapes.append(o.Shape.copy())
|
||||
cutp,cutv,iv =Arch.getCutVolume(obj.Base.Shape,shapes)
|
||||
cuts = []
|
||||
if obj.ProjectionMode == "Solid":
|
||||
for sh in shapes:
|
||||
if sh.Volume < 0:
|
||||
sh.reverse()
|
||||
#if cutv.BoundBox.isIntersection(sh.BoundBox):
|
||||
# c = sh.cut(cutv)
|
||||
#else:
|
||||
# c = sh.copy()
|
||||
c = sh.cut(cutv)
|
||||
cuts.extend(c.Solids)
|
||||
if onlysolids:
|
||||
cuts.extend(c.Solids)
|
||||
else:
|
||||
cuts.append(c)
|
||||
comp = Part.makeCompound(cuts)
|
||||
opl = FreeCAD.Placement(obj.Base.Placement)
|
||||
proj = opl.Rotation.multVec(FreeCAD.Vector(0,0,1))
|
||||
|
|
Loading…
Reference in New Issue
Block a user