@@ -467,8 +467,15 @@ def _invoke(self, context, event):
467467 props .representation_template = "EXTRUSION"
468468 props .representation_obj = None
469469 elif (obj := tool .Blender .get_active_object (is_selected = True )) and obj .type == "MESH" :
470- props .representation_template = "OBJ"
471- props .representation_obj = obj
470+ if (
471+ props .ifc_class .startswith ("IfcStructuralPoint" )
472+ or props .ifc_class .startswith ("IfcStructuralCurve" )
473+ or props .ifc_class .startswith ("IfcStructuralSurface" )
474+ ):
475+ pass # Implement auto association?
476+ else :
477+ props .representation_template = "OBJ"
478+ props .representation_obj = obj
472479 # For convenience, preselect IFC class
473480 if self .ifc_product :
474481 props .ifc_product = self .ifc_product
@@ -677,6 +684,49 @@ def _execute(self, context):
677684 elif representation_template == "ROOF" :
678685 with context .temp_override (active_object = obj , selected_objects = []):
679686 bpy .ops .bim .add_roof ()
687+ elif representation_template == "VERTEX" :
688+ builder = ifcopenshell .util .shape_builder .ShapeBuilder (tool .Ifc .get ())
689+ representation = builder .get_representation (ifc_context , [builder .vertex ()])
690+ ifcopenshell .api .geometry .assign_representation (tool .Ifc .get (), element , representation )
691+ bonsai .core .geometry .switch_representation (
692+ tool .Ifc ,
693+ tool .Geometry ,
694+ obj = obj ,
695+ representation = representation ,
696+ should_reload = True ,
697+ is_global = True ,
698+ should_sync_changes_first = False ,
699+ )
700+ elif representation_template == "EDGE" :
701+ builder = ifcopenshell .util .shape_builder .ShapeBuilder (tool .Ifc .get ())
702+ unit_scale = ifcopenshell .util .unit .calculate_unit_scale (tool .Ifc .get ())
703+ end = Vector ((1 , 0 , 0 )) / unit_scale
704+ representation = builder .get_representation (ifc_context , [builder .edge (end = end )])
705+ ifcopenshell .api .geometry .assign_representation (tool .Ifc .get (), element , representation )
706+ bonsai .core .geometry .switch_representation (
707+ tool .Ifc ,
708+ tool .Geometry ,
709+ obj = obj ,
710+ representation = representation ,
711+ should_reload = True ,
712+ is_global = True ,
713+ should_sync_changes_first = False ,
714+ )
715+ elif representation_template == "FACE" :
716+ builder = ifcopenshell .util .shape_builder .ShapeBuilder (tool .Ifc .get ())
717+ unit_scale = ifcopenshell .util .unit .calculate_unit_scale (tool .Ifc .get ())
718+ points = [Vector (p ) / unit_scale for p in ((0 , 0 , 0 ), (1 , 0 , 0 ), (1 , 1 , 0 ), (0 , 1 , 0 ))]
719+ representation = builder .get_representation (ifc_context , [builder .face (points )])
720+ ifcopenshell .api .geometry .assign_representation (tool .Ifc .get (), element , representation )
721+ bonsai .core .geometry .switch_representation (
722+ tool .Ifc ,
723+ tool .Geometry ,
724+ obj = obj ,
725+ representation = representation ,
726+ should_reload = True ,
727+ is_global = True ,
728+ should_sync_changes_first = False ,
729+ )
680730
681731 bpy .context .view_layer .update () # Ensures obj.matrix_world is correct
682732
0 commit comments