Arch: Fixed IFC importer to work with latest IfcOpenShell version
This commit is contained in:
@@ -87,16 +87,17 @@ def addComponents(objectsList,host):
|
||||
if hasattr(host,"Axes"):
|
||||
x = host.Axes
|
||||
for o in objectsList:
|
||||
if DraftGeomUtils.isValidPath(o.Shape) and (hostType == "Structure"):
|
||||
if o.Support == host:
|
||||
o.Support = None
|
||||
host.Tool = o
|
||||
elif Draft.getType(o) == "Axis":
|
||||
if not o in x:
|
||||
x.append(o)
|
||||
elif not o in a:
|
||||
if hasattr(o,"Shape"):
|
||||
a.append(o)
|
||||
if o.isDerivedFrom("Part::Feature"):
|
||||
if DraftGeomUtils.isValidPath(o.Shape) and (hostType == "Structure"):
|
||||
if o.Support == host:
|
||||
o.Support = None
|
||||
host.Tool = o
|
||||
elif Draft.getType(o) == "Axis":
|
||||
if not o in x:
|
||||
x.append(o)
|
||||
elif not o in a:
|
||||
if hasattr(o,"Shape"):
|
||||
a.append(o)
|
||||
host.Additions = a
|
||||
if hasattr(host,"Axes"):
|
||||
host.Axes = x
|
||||
|
||||
@@ -331,6 +331,7 @@ class Component:
|
||||
def processSubShapes(self,obj,base,pl=None):
|
||||
"Adds additions and subtractions to a base shape"
|
||||
import Draft,Part
|
||||
#print "Processing subshapes of ",obj.Label, " : ",obj.Additions
|
||||
|
||||
if pl:
|
||||
if pl.isNull():
|
||||
@@ -342,43 +343,46 @@ class Component:
|
||||
# treat additions
|
||||
for o in obj.Additions:
|
||||
|
||||
if base:
|
||||
if not base:
|
||||
if o.isDerivedFrom("Part::Feature"):
|
||||
base = o.Shape
|
||||
else:
|
||||
if base.isNull():
|
||||
base = None
|
||||
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 pl:
|
||||
add.Placement = add.Placement.multiply(pl)
|
||||
base = base.fuse(add)
|
||||
|
||||
if base:
|
||||
# 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()
|
||||
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:
|
||||
s.Placement = s.Placement.multiply(pl)
|
||||
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
|
||||
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:
|
||||
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:
|
||||
|
||||
@@ -32,7 +32,7 @@ __url__ = "http://www.freecadweb.org"
|
||||
subtractiveTypes = ["IfcOpeningElement"] # elements that must be subtracted from their parents
|
||||
SCHEMA = "http://www.steptools.com/support/stdev_docs/express/ifc2x3/ifc2x3_tc1.exp"
|
||||
MAKETEMPFILES = False # if True, shapes are passed from ifcopenshell to freecad through temp files
|
||||
ADDPLACEMENT = True # if True, placements get computed (only for newer ifcopenshell)
|
||||
ADDPLACEMENT = False # if True, placements get computed (only for newer ifcopenshell)
|
||||
# end config
|
||||
|
||||
if open.__module__ == '__builtin__':
|
||||
|
||||
Reference in New Issue
Block a user