Arch: Fixed export to IFC of standalone axes
This commit is contained in:
@@ -1430,7 +1430,7 @@ def export(exportList,filename):
|
||||
for obj in objectslist:
|
||||
if obj.isDerivedFrom("Part::Part2DObject"):
|
||||
annotations.append(obj)
|
||||
elif obj.isDerivedFrom("App::Annotation"):
|
||||
elif obj.isDerivedFrom("App::Annotation") or (Draft.getType(obj) == "DraftText"):
|
||||
annotations.append(obj)
|
||||
elif obj.isDerivedFrom("Part::Feature"):
|
||||
if obj.Shape:
|
||||
@@ -1519,10 +1519,25 @@ def export(exportList,filename):
|
||||
# export grids
|
||||
|
||||
if ifctype in ["IfcAxis","IfcAxisSystem","IfcGrid"]:
|
||||
ifctype = "IfcGrid"
|
||||
ifcaxes = []
|
||||
ifcpols = []
|
||||
for axg in obj.Proxy.getAxisData(obj):
|
||||
if ifctype == "IfcAxis":
|
||||
# make sure this axis is not included in something else already
|
||||
standalone = True
|
||||
for p in obj.InList:
|
||||
if hasattr(p,"Axes") and (obj in p.Axes):
|
||||
if p in objectslist:
|
||||
axgroups = []
|
||||
standalone = False
|
||||
break
|
||||
if standalone:
|
||||
axgroups = [obj.Proxy.getAxisData(obj)]
|
||||
else:
|
||||
axgroups = obj.Proxy.getAxisData(obj)
|
||||
if not axgroups:
|
||||
continue
|
||||
ifctype = "IfcGrid"
|
||||
for axg in axgroups:
|
||||
ifcaxg = []
|
||||
for ax in axg:
|
||||
p1 = ifcbin.createIfcCartesianPoint(tuple(FreeCAD.Vector(ax[0]).multiply(0.001)))
|
||||
@@ -1543,20 +1558,21 @@ def export(exportList,filename):
|
||||
if len(ifcaxes) > 1:
|
||||
v = ifcaxes[1]
|
||||
if len(ifcaxes) > 2:
|
||||
v = ifcaxes[2]
|
||||
if DEBUG: print(str(count).ljust(3)," : ", ifctype, " (",str(len(ifcpols)),"axes ) : ",name)
|
||||
xvc = ifcbin.createIfcDirection((1.0,0.0,0.0))
|
||||
zvc = ifcbin.createIfcDirection((0.0,0.0,1.0))
|
||||
ovc = ifcbin.createIfcCartesianPoint((0.0,0.0,0.0))
|
||||
gpl = ifcbin.createIfcAxis2Placement3D(ovc,zvc,xvc)
|
||||
plac = ifcbin.createIfcLocalPlacement(gpl)
|
||||
cset = ifcfile.createIfcGeometricCurveSet(ifcpols)
|
||||
#subc = ifcfile.createIfcGeometricRepresentationSubContext('FootPrint','Model',context,None,"MODEL_VIEW",None,None,None,None,None)
|
||||
srep = ifcfile.createIfcShapeRepresentation(context,'FootPrint',"GeometricCurveSet",ifcpols)
|
||||
pdef = ifcfile.createIfcProductDefinitionShape(None,None,[srep])
|
||||
grid = ifcfile.createIfcGrid(uid,history,name,description,None,plac,pdef,u,v,w)
|
||||
products[obj.Name] = grid
|
||||
count += 1
|
||||
w = ifcaxes[2]
|
||||
if u and v:
|
||||
if DEBUG: print(str(count).ljust(3)," : ", ifctype, " (",str(len(ifcpols)),"axes ) : ",name)
|
||||
xvc = ifcbin.createIfcDirection((1.0,0.0,0.0))
|
||||
zvc = ifcbin.createIfcDirection((0.0,0.0,1.0))
|
||||
ovc = ifcbin.createIfcCartesianPoint((0.0,0.0,0.0))
|
||||
gpl = ifcbin.createIfcAxis2Placement3D(ovc,zvc,xvc)
|
||||
plac = ifcbin.createIfcLocalPlacement(gpl)
|
||||
cset = ifcfile.createIfcGeometricCurveSet(ifcpols)
|
||||
#subc = ifcfile.createIfcGeometricRepresentationSubContext('FootPrint','Model',context,None,"MODEL_VIEW",None,None,None,None,None)
|
||||
srep = ifcfile.createIfcShapeRepresentation(context,'FootPrint',"GeometricCurveSet",ifcpols)
|
||||
pdef = ifcfile.createIfcProductDefinitionShape(None,None,[srep])
|
||||
grid = ifcfile.createIfcGrid(uid,history,name,description,None,plac,pdef,u,v,w)
|
||||
products[obj.Name] = grid
|
||||
count += 1
|
||||
continue
|
||||
|
||||
from ArchComponent import IFCTYPES
|
||||
|
||||
Reference in New Issue
Block a user