Skip to content

Commit

Permalink
Improve IFC export (structural analysis) for slabs
Browse files Browse the repository at this point in the history
I did my best (I'm a programming novice) to understand the code and to improve the IFC export for slabs.
ATM for every slab all contour edges are exported as IFCSTRUCTURALCURVEMEMBER except the last closing one (see forum thread https://forum.freecadweb.org/viewtopic.php?f=39&t=54286).
This changes aim to also add the last closing edge for slabs.
  • Loading branch information
balrobs authored and berndhahnebach committed May 18, 2021
1 parent 9b78003 commit 8ac722c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Mod/Arch/exportIFCStructuralTools.py
Expand Up @@ -105,17 +105,28 @@ def createStructuralMember(ifcfile,ifcbin,obj):
uid = ifcopenshell.guid.new
owh = ifcfile.by_type("IfcOwnerHistory")[0]
ctx = getStructuralContext(ifcfile)

# find edges to convert into structural members
edges = None
if Draft.getType(obj) not in ["Structure"]:
# for non structural elements
if ALLOW_LINEAR_OBJECTS and obj.isDerivedFrom("Part::Feature"):
# for objects created with Part workbench
if obj.Shape.Faces:
# for objects with faces
return None
elif not obj.Shape.Edges:
# for objects without edges
return None
else:
edges = obj.Shape.Edges
else:
wire = Part.makePolygon([obj.Placement.multVec(n) for n in obj.Nodes])
# for structural elements with nodes
nodes = [obj.Placement.multVec(n) for n in obj.Nodes]
if len(nodes) > 2:
# when there are more then 2 nodes (i.e. for slabs) append closing node to produce closing edge
nodes.append(nodes[0])
wire = Part.makePolygon(nodes)
edges = wire.Edges
if not edges:
return None
Expand Down

0 comments on commit 8ac722c

Please sign in to comment.