mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-14 19:34:34 +00:00
Add support for exporting survey points geometry
This commit is contained in:
@@ -1267,6 +1267,8 @@ class IfcExporter():
|
||||
or representation['subcontext'] == 'Axis' \
|
||||
or representation['is_wireframe']:
|
||||
return self.create_wireframe_representation(representation)
|
||||
elif representation['subcontext'] == 'SurveyPoints':
|
||||
return self.create_geometric_curve_set_representation(representation)
|
||||
elif representation['is_curve']:
|
||||
return self.create_curve_representation(representation)
|
||||
elif representation['is_swept_solid']:
|
||||
@@ -1303,6 +1305,27 @@ class IfcExporter():
|
||||
representation['subcontext'], 'Curve',
|
||||
self.ifc_edges)
|
||||
|
||||
def create_geometric_curve_set_representation(self, representation):
|
||||
mesh = representation['raw']
|
||||
self.create_vertices(mesh.vertices)
|
||||
edges = list(mesh.edges)
|
||||
loop_vertices = []
|
||||
loops = []
|
||||
# Not a fast algorithm, but easy
|
||||
while edges:
|
||||
for i, edge in enumerate(edges):
|
||||
if edge.vertices[0] in loop_vertices \
|
||||
and edge.vertices[1] in loop_vertices:
|
||||
del edges[i]
|
||||
loop_vertex_indices = self.get_loop_from_edges(edges)
|
||||
loop_vertices.extend(loop_vertex_indices)
|
||||
loops.append(self.file.createIfcPolyline([
|
||||
self.ifc_vertices[i] for i in loop_vertex_indices]))
|
||||
geometric_curve_set = self.file.createIfcGeometricCurveSet(loops)
|
||||
return self.file.createIfcShapeRepresentation(
|
||||
self.ifc_rep_context[representation['context']][representation['subcontext']]['ifc'],
|
||||
representation['subcontext'], 'GeometricCurveSet', [geometric_curve_set])
|
||||
|
||||
# https://medium.com/@behreajj/scripting-curves-in-blender-with-python-c487097efd13
|
||||
# https://blender.stackexchange.com/questions/30597/python-up-vector-math-for-curve
|
||||
def bezier_tangent(self, pt0=Vector(), pt1=Vector(), pt2=Vector(), pt3=Vector(), step=0.5):
|
||||
@@ -1610,5 +1633,5 @@ class IfcExportSettings:
|
||||
self.output_file = None
|
||||
self.has_representations = True
|
||||
self.has_quantities = True
|
||||
self.subcontexts = ['Axis', 'FootPrint', 'Reference', 'Body', 'Clearance', 'CoG']
|
||||
self.subcontexts = ['Axis', 'FootPrint', 'Reference', 'Body', 'Clearance', 'CoG', 'SurveyPoints']
|
||||
self.generated_subcontexts = ['Box']
|
||||
|
||||
Reference in New Issue
Block a user