Arch: Fixes to ifc importer to make it compatible with ifcopenshell 0.4
This commit is contained in:
parent
716629006c
commit
eceebf4d71
|
@ -170,7 +170,10 @@ def read(filename):
|
||||||
objparentid = int(str(getAttr(r,"RelatingBuildingElement")).split("=")[0].strip("#"))
|
objparentid = int(str(getAttr(r,"RelatingBuildingElement")).split("=")[0].strip("#"))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
obj = IfcImport.Get()
|
if hasattr(IfcImport, 'GetBrepData'):
|
||||||
|
obj = IfcImport.GetBrepData()
|
||||||
|
else:
|
||||||
|
obj = IfcImport.Get()
|
||||||
objid = obj.id
|
objid = obj.id
|
||||||
idx = objid
|
idx = objid
|
||||||
objname = obj.name
|
objname = obj.name
|
||||||
|
@ -244,13 +247,18 @@ def read(filename):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# treat as meshes
|
# treat as meshes
|
||||||
if DEBUG: print "Warning: Object without shape: ",objid, " ", objtype
|
if DEBUG: print "Warning: Object without shape: ",objid, " ", objtype
|
||||||
me,pl = getMesh(obj)
|
if hasattr(obj,"mesh"):
|
||||||
nobj = FreeCAD.ActiveDocument.addObject("Mesh::Feature",n)
|
if not hasattr(obj.mesh, 'verts'):
|
||||||
nobj.Label = n
|
obj = IfcImport.Get() # Get triangulated rep of same product
|
||||||
nobj.Mesh = me
|
me,pl = getMesh(obj)
|
||||||
nobj.Placement = pl
|
nobj = FreeCAD.ActiveDocument.addObject("Mesh::Feature",n)
|
||||||
|
nobj.Label = n
|
||||||
|
nobj.Mesh = me
|
||||||
|
nobj.Placement = pl
|
||||||
|
else:
|
||||||
|
if DEBUG: print "Error: Skipping object without mesh: ",objid, " ", objtype
|
||||||
|
|
||||||
# registering object number and parent
|
# registering object number and parent
|
||||||
if objparentid > 0:
|
if objparentid > 0:
|
||||||
ifcParents[objid] = [objparentid,not (objtype in subtractiveTypes)]
|
ifcParents[objid] = [objparentid,not (objtype in subtractiveTypes)]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user