mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-02 21:12:07 +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['subcontext'] == 'Axis' \
|
||||||
or representation['is_wireframe']:
|
or representation['is_wireframe']:
|
||||||
return self.create_wireframe_representation(representation)
|
return self.create_wireframe_representation(representation)
|
||||||
|
elif representation['subcontext'] == 'SurveyPoints':
|
||||||
|
return self.create_geometric_curve_set_representation(representation)
|
||||||
elif representation['is_curve']:
|
elif representation['is_curve']:
|
||||||
return self.create_curve_representation(representation)
|
return self.create_curve_representation(representation)
|
||||||
elif representation['is_swept_solid']:
|
elif representation['is_swept_solid']:
|
||||||
@@ -1303,6 +1305,27 @@ class IfcExporter():
|
|||||||
representation['subcontext'], 'Curve',
|
representation['subcontext'], 'Curve',
|
||||||
self.ifc_edges)
|
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://medium.com/@behreajj/scripting-curves-in-blender-with-python-c487097efd13
|
||||||
# https://blender.stackexchange.com/questions/30597/python-up-vector-math-for-curve
|
# 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):
|
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.output_file = None
|
||||||
self.has_representations = True
|
self.has_representations = True
|
||||||
self.has_quantities = 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']
|
self.generated_subcontexts = ['Box']
|
||||||
|
|||||||
Reference in New Issue
Block a user