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
This commit is contained in:
balrobs
2021-06-10 19:26:30 +02:00
committed by Bernd Hahnebach
parent f76be90c59
commit 87ae516e1e

View File

@@ -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