mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
Readd support for creating structural curves representations (vertex still WIP)
This commit is contained in:
@@ -351,6 +351,8 @@ class IfcImporter:
|
||||
self.profile_code("Create type products")
|
||||
self.create_annotation()
|
||||
self.profile_code("Create annotation")
|
||||
self.create_structural_elements()
|
||||
self.profile_code("Create structural elements")
|
||||
self.place_objects_in_spatial_tree()
|
||||
self.profile_code("Placing objects in spatial tree")
|
||||
if self.ifc_import_settings.should_merge_by_class:
|
||||
@@ -731,6 +733,9 @@ class IfcImporter:
|
||||
break
|
||||
print("Done creating geometry")
|
||||
|
||||
def create_structural_elements(self):
|
||||
for element in self.file.by_type("IfcStructuralCurveMember"):
|
||||
pass # TODO
|
||||
|
||||
def create_product(self, element, shape=None):
|
||||
if element is None:
|
||||
|
||||
@@ -405,3 +405,30 @@ class Usecase:
|
||||
"BoundingBox",
|
||||
[bounding_box],
|
||||
)
|
||||
|
||||
def create_structural_reference_representation(self):
|
||||
if self.settings["blender_object"].type == "EMPTY":
|
||||
return self.file.createIfcTopologyRepresentation(
|
||||
self.settings["context"],
|
||||
self.settings["context"].ContextIdentifier,
|
||||
"Vertex",
|
||||
[self.create_vertex_point(Vector((0, 0, 0)))],
|
||||
)
|
||||
return self.file.createIfcTopologyRepresentation(
|
||||
self.settings["context"],
|
||||
self.settings["context"].ContextIdentifier,
|
||||
"Edge",
|
||||
[self.create_edge()],
|
||||
)
|
||||
|
||||
def create_vertex_point(self, point):
|
||||
return self.file.createIfcVertexPoint(self.create_cartesian_point(point.x, point.y, point.z))
|
||||
|
||||
def create_edge(self):
|
||||
if hasattr(self.settings["geometry"], "splines"):
|
||||
points = self.get_spline_points(self.settings["geometry"].splines[0])
|
||||
else:
|
||||
points = self.settings["geometry"].vertices
|
||||
if not points:
|
||||
return
|
||||
return self.file.createIfcEdge(self.create_vertex_point(points[0].co), self.create_vertex_point(points[1].co))
|
||||
|
||||
@@ -85,12 +85,12 @@ class AddRepresentation(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
obj = bpy.data.objects.get(self.obj) if self.obj else bpy.context.active_object
|
||||
self.file = IfcStore.get_file()
|
||||
context_id = self.context_id or int(bpy.context.scene.BIMProperties.contexts)
|
||||
|
||||
bpy.ops.bim.edit_object_placement(obj=obj.name)
|
||||
|
||||
if obj.data:
|
||||
product = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
|
||||
context_id = self.context_id or int(bpy.context.scene.BIMProperties.contexts)
|
||||
context_of_items = self.file.by_id(context_id)
|
||||
|
||||
gprop = context.scene.BIMGeoreferenceProperties
|
||||
|
||||
@@ -114,8 +114,7 @@ class AssignClass(bpy.types.Operator):
|
||||
obj.name = "{}/{}".format(product.is_a(), obj.name)
|
||||
IfcStore.link_element(product, obj)
|
||||
|
||||
if obj.data:
|
||||
bpy.ops.bim.add_representation(obj=obj.name, context_id=self.context_id)
|
||||
bpy.ops.bim.add_representation(obj=obj.name, context_id=self.context_id)
|
||||
|
||||
if product.is_a("IfcElementType"):
|
||||
self.place_in_types_collection(obj)
|
||||
|
||||
@@ -63,6 +63,5 @@ class BIM_PT_class(Panel):
|
||||
if props.ifc_predefined_type == "USERDEFINED":
|
||||
row = self.layout.row()
|
||||
row.prop(props, "ifc_userdefined_type")
|
||||
if bpy.context.active_object.data:
|
||||
row = self.layout.row()
|
||||
row.prop(bpy.context.scene.BIMProperties, "contexts")
|
||||
row = self.layout.row()
|
||||
row.prop(bpy.context.scene.BIMProperties, "contexts")
|
||||
|
||||
Reference in New Issue
Block a user