@@ -71,6 +71,7 @@ class SelectLibraryFile(bpy.types.Operator, IFCFileSelector):
7171 bl_description = "Select an IFC file that can be used as a library"
7272 filepath : bpy .props .StringProperty (subtype = "FILE_PATH" )
7373 filter_glob : bpy .props .StringProperty (default = "*.ifc;*.ifczip;*.ifcxml" , options = {"HIDDEN" })
74+ append_all : bpy .props .BoolProperty (default = False )
7475
7576 def execute (self , context ):
7677 IfcStore .begin_transaction (self )
@@ -87,6 +88,8 @@ def _execute(self, context):
8788 bpy .ops .bim .refresh_library ()
8889 if context .area :
8990 context .area .tag_redraw ()
91+ if self .append_all :
92+ bpy .ops .bim .append_entire_library ()
9093 return {"FINISHED" }
9194
9295 def invoke (self , context , event ):
@@ -104,6 +107,9 @@ def rollback(self, data):
104107 def commit (self , data ):
105108 IfcStore .library_path = data ["filepath" ]
106109 IfcStore .library_file = ifcopenshell .open (data ["filepath" ])
110+
111+ def draw (self , context ):
112+ self .layout .prop (self , "append_all" , text = "Append Entire Library" )
107113
108114
109115class RefreshLibrary (bpy .types .Operator ):
@@ -282,6 +288,27 @@ def execute(self, context):
282288 return {"FINISHED" }
283289
284290
291+ class AppendEntiryLibrary (bpy .types .Operator ):
292+ bl_idname = "bim.append_entire_library"
293+ bl_label = "Append Entiry Library"
294+
295+ @classmethod
296+ def poll (cls , context ):
297+ return IfcStore .get_file ()
298+
299+ def execute (self , context ):
300+ return IfcStore .execute_ifc_operator (self , context )
301+
302+ def _execute (self , context ):
303+ self .file = IfcStore .get_file ()
304+ self .library = IfcStore .library_file
305+
306+ lib_elements = ifcopenshell .util .selector .Selector ().parse (self .library , '.IfcTypeProduct | .IfcMaterial | .IfcCostSchedule| .IfcProfileDef' )
307+ for element in lib_elements :
308+ bpy .ops .bim .append_library_element (definition = element .id ())
309+ return {"FINISHED" }
310+
311+
285312class AppendLibraryElement (bpy .types .Operator ):
286313 bl_idname = "bim.append_library_element"
287314 bl_label = "Append Library Element"
0 commit comments