From 87ae516e1ecc15d3b5db2d44caa8d0db43013d61 Mon Sep 17 00:00:00 2001 From: balrobs <73989799+balrobs@users.noreply.github.com> Date: Thu, 10 Jun 2021 19:26:30 +0200 Subject: [PATCH] Fixing connection error for structural surface members This changes improve connections between structural surface members with coincident edges See forum: https://forum.freecadweb.org/viewtopic.php?f=39&t=54286&p=509311#p509311 --- src/Mod/Arch/exportIFCStructuralTools.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Mod/Arch/exportIFCStructuralTools.py b/src/Mod/Arch/exportIFCStructuralTools.py index a154aa05d8..aa879cc198 100644 --- a/src/Mod/Arch/exportIFCStructuralTools.py +++ b/src/Mod/Arch/exportIFCStructuralTools.py @@ -139,7 +139,7 @@ def createStructuralMember(ifcfile, ifcbin, obj): """Creates a structural member if possible. Returns the member""" - global structural_nodes + global structural_nodes, structural_curves structuralMember = None import Draft import Part @@ -277,19 +277,29 @@ def createStructuralMember(ifcfile, ifcbin, obj): # check for existing connection curves for edge in edges: - if edge in structural_curves: - if structural_curves[edge]: + verts12 = tuple([edge.Vertexes[ 0].Point.x, edge.Vertexes[ 0].Point.y, edge.Vertexes[ 0].Point.z, + edge.Vertexes[-1].Point.x, edge.Vertexes[-1].Point.y, edge.Vertexes[-1].Point.z]) + verts21 = tuple([edge.Vertexes[-1].Point.x, edge.Vertexes[-1].Point.y, edge.Vertexes[-1].Point.z, + edge.Vertexes[ 0].Point.x, edge.Vertexes[ 0].Point.y, edge.Vertexes[ 0].Point.z]) + verts12_in_curves = verts12 in structural_curves + verts21_in_curves = verts21 in structural_curves + if verts21_in_curves: + verts = verts21 + else: + verts = verts12 + if (verts12_in_curves or verts21_in_curves): + if structural_curves[verts]: # there is already another member using this curve - strucCrvConn = structural_curves[edge] + strucCrvConn = structural_curves[verts] else: # there is another member with same edge, create a new curve connection strucCrvConn = createStructuralCurve(ifcfile, ifcbin, edge) - structural_curves[edge] = strucCrvConn + structural_curves[verts] = strucCrvConn ifcfile.createIfcRelConnectsStructuralMember( uid(), None, None, None, structuralMember, strucCrvConn, None, None, None, None) else: # just add the curve, no other member using it yet - structural_curves[edge] = None + structural_curves[verts] = None return structuralMember