mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-31 00:46:36 +00:00
feat: Allow merging multiple ifc projects at once with the MergeProject recipe
This commit is contained in:
committed by
Dion Moult
parent
ec29e3d60b
commit
653b9288c0
@@ -177,6 +177,10 @@ def _extract_docs(cls, method_name, boilerplate_args):
|
||||
param_name = line.split(":")[1].strip().replace("param ", "")
|
||||
if param_name in inputs:
|
||||
inputs[param_name]["description"] = line.split(":")[2].strip()
|
||||
elif line.startswith(":filter_glob"):
|
||||
param_name = line.split(":")[1].strip().replace("filter_glob ", "")
|
||||
if param_name in inputs:
|
||||
inputs[param_name]["filter_glob"] = line.split(":")[2].strip()
|
||||
elif i == 2:
|
||||
description += line
|
||||
elif i > 2:
|
||||
|
||||
@@ -40,6 +40,8 @@ class Patcher:
|
||||
:param filepath: The filepath of the second IFC model to merge into the
|
||||
first. The first model is already specified as the input to
|
||||
IfcPatch.
|
||||
:type filepath: Union[str, ifcopenshell.file]
|
||||
:filter_glob filepath: *.ifc;*.ifczip;*.ifcxml
|
||||
|
||||
Example:
|
||||
|
||||
@@ -53,11 +55,15 @@ class Patcher:
|
||||
self.filepath = filepath
|
||||
|
||||
def patch(self):
|
||||
if isinstance(self.filepath, ifcopenshell.file):
|
||||
other = self.filepath
|
||||
else:
|
||||
other = ifcopenshell.open(self.filepath)
|
||||
for filepath in self.filepath:
|
||||
if isinstance(filepath, ifcopenshell.file):
|
||||
other = filepath
|
||||
else:
|
||||
other = ifcopenshell.open(filepath)
|
||||
|
||||
self.merge(other)
|
||||
|
||||
def merge(self, other):
|
||||
if (main_unit := self.get_unit_name(self.file)) != self.get_unit_name(other):
|
||||
other = ifcopenshell.util.unit.convert_file_length_units(other, main_unit)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user