def processSubShapes(self, obj, base): "Adds additions and subtractions to a base shape" import Draft # treat additions for o in obj.Additions: if base: if base.isNull(): base = None # special case, both walls with coinciding endpoints import ArchWall js = ArchWall.mergeShapes(o, obj) if js: add = js.cut(base) 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: base = base.cut(f) elif o.isDerivedFrom("Part::Feature"): if o.Shape: if not o.Shape.isNull(): if o.Shape.Solids: if base: if base.Solids: base = base.fuse(o.Shape) else: base = o.Shape # treat subtractions for o in obj.Subtractions: if base: if base.isNull(): base = None if base: if (Draft.getType(o) == "Window") or (Draft.isClone( o, "Window")): # windows can be additions or subtractions, treated the same way f = o.Proxy.getSubVolume(o) if f: if base.Solids and f.Solids: 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) return base
def processSubShapes(self,obj,base): "Adds additions and subtractions to a base shape" import Draft # treat additions for o in obj.Additions: if base: if base.isNull(): base = None # special case, both walls with coinciding endpoints import ArchWall js = ArchWall.mergeShapes(o,obj) if js: add = js.cut(base) 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: base = base.cut(f) elif o.isDerivedFrom("Part::Feature"): if o.Shape: if not o.Shape.isNull(): if o.Shape.Solids: if base: if base.Solids: base = base.fuse(o.Shape) else: base = o.Shape # treat subtractions for o in obj.Subtractions: if base: if base.isNull(): base = None if base: if (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window")): # windows can be additions or subtractions, treated the same way f = o.Proxy.getSubVolume(o) if f: if base.Solids and f.Solids: 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) return base
def processSubShapes(self, obj, base, placement=None): "Adds additions and subtractions to a base shape" import Draft, Part #print "Processing subshapes of ",obj.Label, " : ",obj.Additions if placement: if placement.isNull(): placement = None else: placement = FreeCAD.Placement(placement) placement = placement.inverse() # treat additions for o in obj.Additions: if not base: if o.isDerivedFrom("Part::Feature"): base = o.Shape else: if base.isNull(): if o.isDerivedFrom("Part::Feature"): base = o.Shape else: # special case, both walls with coinciding endpoints import ArchWall js = ArchWall.mergeShapes(o, obj) if js: add = js.cut(base) if placement: add.Placement = add.Placement.multiply(placement) base = base.fuse(add) elif (Draft.getType(o) == "Window") or (Draft.isClone( o, "Window", True)): if hasattr(o.Proxy, "getSubVolume"): f = o.Proxy.getSubVolume(o) if f: if base.Solids and f.Solids: if placement: f.Placement = f.Placement.multiply( placement) 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 placement: s.Placement = s.Placement.multiply( placement) if base: if base.Solids: try: base = base.fuse(s) except Part.OCCError: print "Arch: unable to fuse object ", obj.Name, " with ", o.Name else: base = s # treat subtractions for o in obj.Subtractions: if base: if base.isNull(): base = None if base: if (Draft.getType(o) == "Window") or (Draft.isClone( o, "Window", True)): # windows can be additions or subtractions, treated the same way f = o.Proxy.getSubVolume(o) if f: if base.Solids and f.Solids: if placement: f.Placement = f.Placement.multiply(placement) base = base.cut(f) elif (Draft.getType(o) == "Roof") or (Draft.isClone(o, "Roof")): # roofs define their own special subtraction volume f = o.Proxy.getSubVolume(o) if f: if base.Solids and f.Solids: base = base.cut(f) elif o.isDerivedFrom("Part::Feature"): if o.Shape: if not o.Shape.isNull(): if o.Shape.Solids and base.Solids: s = o.Shape.copy() if placement: s.Placement = s.Placement.multiply( placement) try: base = base.cut(s) except Part.OCCError: print "Arch: unable to cut object ", o.Name, " from ", obj.Name return base
def processSubShapes(self,obj,base,placement=None): "Adds additions and subtractions to a base shape" import Draft,Part #print "Processing subshapes of ",obj.Label, " : ",obj.Additions if placement: if placement.isNull(): placement = None else: placement = FreeCAD.Placement(placement) placement = placement.inverse() # treat additions for o in obj.Additions: if not base: if o.isDerivedFrom("Part::Feature"): base = o.Shape else: if base.isNull(): if o.isDerivedFrom("Part::Feature"): base = o.Shape else: # special case, both walls with coinciding endpoints import ArchWall js = ArchWall.mergeShapes(o,obj) if js: add = js.cut(base) if placement: add.Placement = add.Placement.multiply(placement) 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 placemen: f.Placement = f.Placement.multiply(placement) 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 placement: s.Placement = s.Placement.multiply(placement) if base: if base.Solids: try: base = base.fuse(s) except: print "Arch: unable to fuse object ",obj.Name, " with ", o.Name else: base = s # treat subtractions for o in obj.Subtractions: if base: if base.isNull(): base = None if base: if (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window")): # windows can be additions or subtractions, treated the same way f = o.Proxy.getSubVolume(o) if f: if base.Solids and f.Solids: if placement: f.Placement = f.Placement.multiply(placement) base = base.cut(f) elif (Draft.getType(o) == "Roof") or (Draft.isClone(o,"Roof")): # roofs define their own special subtraction volume f = o.Proxy.getSubVolume(o) if f: if base.Solids and f.Solids: base = base.cut(f) elif o.isDerivedFrom("Part::Feature"): if o.Shape: if not o.Shape.isNull(): if o.Shape.Solids and base.Solids: s = o.Shape.copy() if placement: s.Placement = s.Placement.multiply(placement) try: base = base.cut(s) except: print "Arch: unable to cut object ",o.Name, " from ", obj.Name return 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: if base: if base.isNull(): base = None # special case, both walls with coinciding endpoints import ArchWall 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(s) else: base = s # treat subtractions for o in obj.Subtractions: if base: if base.isNull(): base = None if base: if (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window")): # windows can be additions or subtractions, treated the same way 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: s = o.Shape.copy() if pl: s.Placement = s.Placement.multiply(pl) base = base.cut(s) return base
def processSubShapes(self,obj,base): "Adds additions and subtractions to a base shape" import Draft # treat additions for o in obj.Additions: if base: if base.isNull(): base = None # special case, both walls with coinciding endpoints import ArchWall js = ArchWall.mergeShapes(o,obj) if js: add = js.cut(base) base = base.fuse(add) elif (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window")): if base: # windows can be additions or subtractions, treated the same way if hasattr(self,"Width"): width = self.Width else: b = base.BoundBox width = max(b.XLength,b.YLength,b.ZLength) if Draft.isClone(o,"Window"): window = o.Objects[0] else: window = o if window.Base and width: f = self.getSubVolume(window.Base,width) if f: if base.Solids and f.Solids: base = base.cut(f) elif o.isDerivedFrom("Part::Feature"): if o.Shape: if not o.Shape.isNull(): if o.Shape.Solids: if base: if base.Solids: base = base.fuse(o.Shape) else: base = o.Shape # treat subtractions for o in obj.Subtractions: if base: if base.isNull(): base = None if base: if (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window")): # windows can be additions or subtractions, treated the same way if hasattr(self,"Width"): width = self.Width else: b = base.BoundBox width = max(b.XLength,b.YLength,b.ZLength) if Draft.isClone(o,"Window"): window = o.Objects[0] else: window = o if window.Base and width: f = self.getSubVolume(window.Base,width) if f: if base.Solids and f.Solids: 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) return base
def processSubShapes(self,obj,base,placement=None): "Adds additions and subtractions to a base shape" import Draft,Part #print("Processing subshapes of ",obj.Label, " : ",obj.Additions) if placement: if placement.isIdentity(): placement = None else: placement = FreeCAD.Placement(placement) placement = placement.inverse() # treat additions for o in obj.Additions: if not base: if o.isDerivedFrom("Part::Feature"): base = o.Shape else: if base.isNull(): if o.isDerivedFrom("Part::Feature"): base = o.Shape else: # special case, both walls with coinciding endpoints import ArchWall js = ArchWall.mergeShapes(o,obj) if js: add = js.cut(base) if placement: add.Placement = add.Placement.multiply(placement) base = base.fuse(add) elif o.isDerivedFrom("Part::Feature"): if o.Shape: if not o.Shape.isNull(): if o.Shape.Solids: s = o.Shape.copy() if placement: s.Placement = s.Placement.multiply(placement) if base: if base.Solids: try: base = base.fuse(s) except Part.OCCError: print("Arch: unable to fuse object ", obj.Name, " with ", o.Name) else: base = s # treat subtractions subs = obj.Subtractions for link in obj.InList: if hasattr(link,"Hosts"): for host in link.Hosts: if host == obj: subs.append(link) for o in subs: if base: if base.isNull(): base = None if base: if (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window",True)): # windows can be additions or subtractions, treated the same way f = o.Proxy.getSubVolume(o) if f: if base.Solids and f.Solids: if placement: f.Placement = f.Placement.multiply(placement) if len(base.Solids) > 1: base = Part.makeCompound([sol.cut(f) for sol in base.Solids]) else: base = base.cut(f) elif (Draft.getType(o) == "Roof") or (Draft.isClone(o,"Roof")): # roofs define their own special subtraction volume f = o.Proxy.getSubVolume(o) if f: if base.Solids and f.Solids: if len(base.Solids) > 1: base = Part.makeCompound([sol.cut(f) for sol in base.Solids]) else: base = base.cut(f) elif o.isDerivedFrom("Part::Feature"): if o.Shape: if not o.Shape.isNull(): if o.Shape.Solids and base.Solids: s = o.Shape.copy() if placement: s.Placement = s.Placement.multiply(placement) try: if len(base.Solids) > 1: base = Part.makeCompound([sol.cut(s) for sol in base.Solids]) else: base = base.cut(s) except Part.OCCError: print("Arch: unable to cut object ",o.Name, " from ", obj.Name) return 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: if base: if base.isNull(): base = None # special case, both walls with coinciding endpoints import ArchWall 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(s) else: base = s # treat subtractions for o in obj.Subtractions: if base: if base.isNull(): base = None if base: if (Draft.getType(o) == "Window") or (Draft.isClone( o, "Window")): # windows can be additions or subtractions, treated the same way 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: s = o.Shape.copy() if pl: s.Placement = s.Placement.multiply(pl) base = base.cut(s) return base