diff --git a/src/bonsai/bonsai/bim/module/geometry/operator.py b/src/bonsai/bonsai/bim/module/geometry/operator.py index d739c57c49..34ef583eb1 100644 --- a/src/bonsai/bonsai/bim/module/geometry/operator.py +++ b/src/bonsai/bonsai/bim/module/geometry/operator.py @@ -2190,7 +2190,9 @@ class OverrideModeSetObject(bpy.types.Operator, tool.Ifc.Operator): item = tool.Geometry.get_active_representation(obj) assert item if tool.Geometry.is_meshlike_item(item): - if tool.Geometry.is_geometric_data(obj.data) and obj.data.polygons: + if tool.Geometry.is_geometric_data(obj.data) and ( + item.is_a("IfcVertex") or item.is_a("IfcEdge") or obj.data.polygons + ): tool.Geometry.edit_meshlike_item(obj) else: tool.Geometry.import_item(obj) diff --git a/src/bonsai/bonsai/tool/geometry.py b/src/bonsai/bonsai/tool/geometry.py index 92fed10700..31349d36ba 100644 --- a/src/bonsai/bonsai/tool/geometry.py +++ b/src/bonsai/bonsai/tool/geometry.py @@ -1014,7 +1014,13 @@ class Geometry(bonsai.core.tool.Geometry): @classmethod def is_meshlike_item(cls, item: ifcopenshell.entity_instance) -> bool: - return item.is_a("IfcTessellatedItem") or item.is_a("IfcManifoldSolidBrep") + return ( + item.is_a("IfcTessellatedItem") + or item.is_a("IfcManifoldSolidBrep") + or item.is_a("IfcVertex") + or item.is_a("IfcEdge") + or item.is_a("IfcFace") + ) @classmethod def is_curvelike_item(cls, item: ifcopenshell.entity_instance) -> bool: @@ -1824,6 +1830,9 @@ class Geometry(bonsai.core.tool.Geometry): position = Matrix(ifcopenshell.util.placement.get_axis2placement(position).tolist()) position.translation *= unit_scale obj.matrix_world = rep_obj.matrix_world @ position + elif item.is_a("IfcVertex"): + co = np.array(item.VertexGeometry.Coordinates) * ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get()) + obj.data.from_pydata([co], [], []) else: geometry = tool.Loader.create_generic_shape(item) verts = ifcopenshell.util.shape.get_vertices(geometry) @@ -1901,6 +1910,12 @@ class Geometry(bonsai.core.tool.Geometry): faces = [p.vertices[:] for p in obj.data.polygons] if item.is_a("IfcAdvancedBrep"): new_item = builder.faceted_brep(verts, faces) + elif item.is_a("IfcVertex"): + new_item = builder.vertex(verts[0]) + elif item.is_a("IfcEdge"): + new_item = builder.edge(start=verts[0], end=verts[1]) + elif item.is_a("IfcFace"): + new_item = builder.face([verts[i] for i in faces[0]]) else: new_item = builder.mesh(verts, faces) for inverse in tool.Ifc.get().get_inverse(item): diff --git a/src/bonsai/bonsai/tool/loader.py b/src/bonsai/bonsai/tool/loader.py index abac4ae622..7beb590fda 100644 --- a/src/bonsai/bonsai/tool/loader.py +++ b/src/bonsai/bonsai/tool/loader.py @@ -802,8 +802,7 @@ class Loader(bonsai.core.tool.Loader): print(f"WARNING. Unsupported point type for IfcStructuralPointConnection: {point}.") return - ifc_file = tool.Ifc.get() - co = np.array(point.Coordinates) * ifcopenshell.util.unit.calculate_unit_scale(ifc_file) + co = np.array(point.Coordinates) * ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get()) mesh_name = tool.Geometry.get_representation_name(representation) mesh = bpy.data.meshes.new(mesh_name) mesh.from_pydata([co], [], [])