From 8ac722c1e89ef530564293efd30987db09017e12 Mon Sep 17 00:00:00 2001 From: balrobs <73989799+balrobs@users.noreply.github.com> Date: Tue, 18 May 2021 17:19:15 +0200 Subject: [PATCH] Improve IFC export (structural analysis) for slabs 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. --- src/Mod/Arch/exportIFCStructuralTools.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Mod/Arch/exportIFCStructuralTools.py b/src/Mod/Arch/exportIFCStructuralTools.py index 4c2b3d268a..06607daa28 100644 --- a/src/Mod/Arch/exportIFCStructuralTools.py +++ b/src/Mod/Arch/exportIFCStructuralTools.py @@ -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