mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-28 03:05:33 +00:00
You can now load multiple Blends simultaneously when linking IFCs
This commit is contained in:
@@ -109,7 +109,7 @@ class SelectLibraryFile(bpy.types.Operator, IFCFileSelector):
|
|||||||
IfcStore.library_file = ifcopenshell.open(data["filepath"])
|
IfcStore.library_file = ifcopenshell.open(data["filepath"])
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
self.layout.prop(self, "append_all", text= "Append Entire Library")
|
self.layout.prop(self, "append_all", text="Append Entire Library")
|
||||||
|
|
||||||
|
|
||||||
class RefreshLibrary(bpy.types.Operator):
|
class RefreshLibrary(bpy.types.Operator):
|
||||||
@@ -303,9 +303,11 @@ class AppendEntiryLibrary(bpy.types.Operator):
|
|||||||
self.file = IfcStore.get_file()
|
self.file = IfcStore.get_file()
|
||||||
self.library = IfcStore.library_file
|
self.library = IfcStore.library_file
|
||||||
|
|
||||||
lib_elements = ifcopenshell.util.selector.Selector().parse(self.library, '.IfcTypeProduct | .IfcMaterial | .IfcCostSchedule| .IfcProfileDef')
|
lib_elements = ifcopenshell.util.selector.Selector().parse(
|
||||||
|
self.library, ".IfcTypeProduct | .IfcMaterial | .IfcCostSchedule| .IfcProfileDef"
|
||||||
|
)
|
||||||
for element in lib_elements:
|
for element in lib_elements:
|
||||||
bpy.ops.bim.append_library_element(definition= element.id())
|
bpy.ops.bim.append_library_element(definition=element.id())
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -660,16 +662,19 @@ class LinkIfc(bpy.types.Operator):
|
|||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
bl_description = "Link a Blender file"
|
bl_description = "Link a Blender file"
|
||||||
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
||||||
|
files: bpy.props.CollectionProperty(name="Files", type=bpy.types.OperatorFileListElement)
|
||||||
|
directory: bpy.props.StringProperty(subtype="DIR_PATH")
|
||||||
filter_glob: bpy.props.StringProperty(default="*.blend;*.blend1", options={"HIDDEN"})
|
filter_glob: bpy.props.StringProperty(default="*.blend;*.blend1", options={"HIDDEN"})
|
||||||
use_relative_path: bpy.props.BoolProperty(name="Use Relative Path", default=False)
|
use_relative_path: bpy.props.BoolProperty(name="Use Relative Path", default=False)
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
new = context.scene.BIMProjectProperties.links.add()
|
for file in self.files:
|
||||||
filepath = self.filepath
|
filepath = os.path.join(self.directory, file.name)
|
||||||
if self.use_relative_path:
|
new = context.scene.BIMProjectProperties.links.add()
|
||||||
filepath = os.path.relpath(filepath, bpy.path.abspath("//"))
|
if self.use_relative_path:
|
||||||
new.name = filepath
|
filepath = os.path.relpath(filepath, bpy.path.abspath("//"))
|
||||||
bpy.ops.bim.load_link(filepath=self.filepath)
|
new.name = filepath
|
||||||
|
bpy.ops.bim.load_link(filepath=self.filepath)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
|
|||||||
Reference in New Issue
Block a user