Skip to content

Commit

Permalink
ARCH, export IFC, serializer, workaround for placement problem
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach committed Apr 19, 2023
1 parent 1dcc58c commit e75bc1c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Mod/Arch/exportIFC.py
Expand Up @@ -2162,12 +2162,15 @@ def getRepresentation(
sh = obj.Shape.copy()
sh.Placement = obj.getGlobalPlacement()
sh.scale(preferences['SCALE_FACTOR']) # to meters
# clean shape and moves placement away from the outer element level
# https://forum.freecad.org/viewtopic.php?p=675760#p675760
brep_data = sh.removeSplitter().exportBrepToString()
try:
p = geom.serialise(sh.exportBrepToString())
p = geom.serialise(brep_data)
except TypeError:
# IfcOpenShell v0.6.0
# Serialization.cpp:IfcUtil::IfcBaseClass* IfcGeom::serialise(const std::string& schema_name, const TopoDS_Shape& shape, bool advanced)
p = geom.serialise(preferences['SCHEMA'],sh.exportBrepToString())
p = geom.serialise(preferences['SCHEMA'], brep_data)
if p:
productdef = ifcfile.add(p)
for rep in productdef.Representations:
Expand All @@ -2176,6 +2179,13 @@ def getRepresentation(
shapetype = "advancedbrep"
shapes = None
serialized = True
else:
if preferences['DEBUG']:
print(
"Warning! IfcOS serializer did not return a ifc-geometry for object {}. "
"The shape will be exported with triangulation."
.format(obj.Label)
)

if not serialized:

Expand Down

0 comments on commit e75bc1c

Please sign in to comment.