This repository was archived by the owner on Nov 24, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
src/ifcblenderexport/blenderbim/bim Expand file tree Collapse file tree Original file line number Diff line number Diff line change 231231 operator .SetBlenderClashSetB ,
232232 operator .ExecuteBlenderClash ,
233233 operator .CleanWireframes ,
234+ operator .LinkIfc ,
234235 prop .StrProperty ,
235236 prop .Attribute ,
236237 prop .MaterialLayer ,
Original file line number Diff line number Diff line change @@ -4862,3 +4862,30 @@ def execute(self, context):
48624862 if not obj .modifiers .get ("EdgeSplit" ):
48634863 obj .modifiers .new ("EdgeSplit" , "EDGE_SPLIT" )
48644864 return {"FINISHED" }
4865+
4866+
4867+ class LinkIfc (bpy .types .Operator ):
4868+ bl_idname = "bim.link_ifc"
4869+ bl_label = "Link IFC"
4870+ filepath : bpy .props .StringProperty (subtype = "FILE_PATH" )
4871+
4872+ def execute (self , context ):
4873+ #bpy.context.active_object.active_material.BIMMaterialProperties.location = self.filepath
4874+ #coll_name = "MyCollection"
4875+
4876+ with bpy .data .libraries .load (self .filepath , link = True ) as (data_from , data_to ):
4877+ data_to .scenes = data_from .scenes
4878+
4879+ for scene in bpy .data .scenes :
4880+ if not scene .library or scene .library .filepath != self .filepath :
4881+ continue
4882+ for child in scene .collection .children :
4883+ if "IfcProject" not in child .name :
4884+ continue
4885+ bpy .data .scenes [0 ].collection .children .link (child )
4886+
4887+ return {"FINISHED" }
4888+
4889+ def invoke (self , context , event ):
4890+ context .window_manager .fileselect_add (self )
4891+ return {"RUNNING_MODAL" }
Original file line number Diff line number Diff line change @@ -2305,6 +2305,8 @@ def draw(self, context):
23052305
23062306 row = layout .row (align = True )
23072307 row .operator ("bim.clean_wireframes" )
2308+ row = layout .row (align = True )
2309+ row .operator ("bim.link_ifc" )
23082310
23092311 row = layout .row (align = True )
23102312 op = row .operator ("bim.add_annotation" , text = "Dim" , icon = "ARROW_LEFTRIGHT" )
You can’t perform that action at this time.
0 commit comments