diff --git a/src/ifcpatch/ifcpatch/recipes/ConvertLengthUnit.py b/src/ifcpatch/ifcpatch/recipes/ConvertLengthUnit.py index 66c15d0eb1..b18f0f670e 100644 --- a/src/ifcpatch/ifcpatch/recipes/ConvertLengthUnit.py +++ b/src/ifcpatch/ifcpatch/recipes/ConvertLengthUnit.py @@ -38,10 +38,10 @@ class Patcher: .. code:: python # Convert to millimeters - ifcpatch.execute({"input": model, "recipe": "ConvertLengthUnit", "arguments": ["MILLIMETERS"]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ConvertLengthUnit", "arguments": ["MILLIMETERS"]}) # Convert to feet - ifcpatch.execute({"input": model, "recipe": "ConvertLengthUnit", "arguments": ["FEET"]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ConvertLengthUnit", "arguments": ["FEET"]}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/ConvertNestToAggregate.py b/src/ifcpatch/ifcpatch/recipes/ConvertNestToAggregate.py index e6c4cad185..aa93a3ccc0 100644 --- a/src/ifcpatch/ifcpatch/recipes/ConvertNestToAggregate.py +++ b/src/ifcpatch/ifcpatch/recipes/ConvertNestToAggregate.py @@ -34,7 +34,7 @@ class Patcher: .. code:: python - ifcpatch.execute({"input": model, "recipe": "ConvertNestToAggregate", "arguments": []}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ConvertNestToAggregate", "arguments": []}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/ConvertPropertiesToQuantities.py b/src/ifcpatch/ifcpatch/recipes/ConvertPropertiesToQuantities.py index df13bf3bd2..4483048e0c 100644 --- a/src/ifcpatch/ifcpatch/recipes/ConvertPropertiesToQuantities.py +++ b/src/ifcpatch/ifcpatch/recipes/ConvertPropertiesToQuantities.py @@ -55,7 +55,7 @@ class Patcher: # Any property named "Area" is converted to a quantity named # "NetSideArea", if that standardised quantity exists. - ifcpatch.execute({"input": model, "recipe": "ConvertPropertiesToQuantities", "arguments": ["Area", "NetSideArea"]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ConvertPropertiesToQuantities", "arguments": ["Area", "NetSideArea"]}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/DowngradeIndexedPolyCurve.py b/src/ifcpatch/ifcpatch/recipes/DowngradeIndexedPolyCurve.py index 4d8051b3fe..f9afbe6835 100644 --- a/src/ifcpatch/ifcpatch/recipes/DowngradeIndexedPolyCurve.py +++ b/src/ifcpatch/ifcpatch/recipes/DowngradeIndexedPolyCurve.py @@ -37,7 +37,7 @@ class Patcher: Example: - ifcpatch.execute({"input": model, "recipe": "DowngradeIndexedPolyCurve", "arguments": []}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "DowngradeIndexedPolyCurve", "arguments": []}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/ExtractElements.py b/src/ifcpatch/ifcpatch/recipes/ExtractElements.py index ec85a5798e..94c2ec9450 100644 --- a/src/ifcpatch/ifcpatch/recipes/ExtractElements.py +++ b/src/ifcpatch/ifcpatch/recipes/ExtractElements.py @@ -37,13 +37,13 @@ class Patcher: .. code:: python # Extract all walls - ifcpatch.execute({"input": model, "recipe": "ExtractElements", "arguments": ["IfcWall"]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ExtractElements", "arguments": ["IfcWall"]}) # Extract all slabs - ifcpatch.execute({"input": model, "recipe": "ExtractElements", "arguments": ["IfcSlab"]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ExtractElements", "arguments": ["IfcSlab"]}) # Extract all walls and slabs - ifcpatch.execute({"input": model, "recipe": "ExtractElements", "arguments": ["IfcWall, IfcSlab"]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ExtractElements", "arguments": ["IfcWall, IfcSlab"]}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/FixArchiCADToRevitDoorSwings.py b/src/ifcpatch/ifcpatch/recipes/FixArchiCADToRevitDoorSwings.py index ec455c7115..42543d0021 100644 --- a/src/ifcpatch/ifcpatch/recipes/FixArchiCADToRevitDoorSwings.py +++ b/src/ifcpatch/ifcpatch/recipes/FixArchiCADToRevitDoorSwings.py @@ -54,7 +54,7 @@ class Patcher: .. code:: python - ifcpatch.execute({"input": model, "recipe": "FixArchiCADToRevitDoorSwings", "arguments": []}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "FixArchiCADToRevitDoorSwings", "arguments": []}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/FixArchiCADToRevitSpaces.py b/src/ifcpatch/ifcpatch/recipes/FixArchiCADToRevitSpaces.py index 11e45b2b60..13d5a383ae 100644 --- a/src/ifcpatch/ifcpatch/recipes/FixArchiCADToRevitSpaces.py +++ b/src/ifcpatch/ifcpatch/recipes/FixArchiCADToRevitSpaces.py @@ -50,7 +50,7 @@ class Patcher: .. code:: python - ifcpatch.execute({"input": model, "recipe": "FixArchiCADToRevitSpaces", "arguments": []}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "FixArchiCADToRevitSpaces", "arguments": []}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/FixRevitClassificationCodeTypes.py b/src/ifcpatch/ifcpatch/recipes/FixRevitClassificationCodeTypes.py index d6bdde4b5a..21a613c5f0 100644 --- a/src/ifcpatch/ifcpatch/recipes/FixRevitClassificationCodeTypes.py +++ b/src/ifcpatch/ifcpatch/recipes/FixRevitClassificationCodeTypes.py @@ -33,7 +33,7 @@ class Patcher: .. code:: python - ifcpatch.execute({"input": model, "recipe": "FixRevitClassificationCodeTypes"}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "FixRevitClassificationCodeTypes"}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/FixRevitTINs.py b/src/ifcpatch/ifcpatch/recipes/FixRevitTINs.py index a57ae2ccd5..b8050dc71d 100644 --- a/src/ifcpatch/ifcpatch/recipes/FixRevitTINs.py +++ b/src/ifcpatch/ifcpatch/recipes/FixRevitTINs.py @@ -52,7 +52,7 @@ class Patcher: .. code:: python - ifcpatch.execute({"input": model, "recipe": "Fix12DToRevitTINs", "arguments": []}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "Fix12DToRevitTINs", "arguments": []}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py b/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py index 81c90892a4..1bf7b5b9ea 100644 --- a/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py +++ b/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py @@ -87,7 +87,7 @@ class Patcher: .. code:: python # Convert to SQLite - ifcpatch.execute({"input": model, "recipe": "Ifc2Sql", "arguments": ["sqlite"]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "Ifc2Sql", "arguments": ["sqlite"]}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/MergeDuplicateTypes.py b/src/ifcpatch/ifcpatch/recipes/MergeDuplicateTypes.py index 302fa4062d..a02f989ee1 100644 --- a/src/ifcpatch/ifcpatch/recipes/MergeDuplicateTypes.py +++ b/src/ifcpatch/ifcpatch/recipes/MergeDuplicateTypes.py @@ -53,10 +53,10 @@ class Patcher: .. code:: python # Default behaviour of merging by Tag attribute - ifcpatch.execute({"input": model, "recipe": "MergeDuplicateTypes", "arguments": []}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "MergeDuplicateTypes", "arguments": []}) # Explicitly say we want to merge based on the Name attribute - ifcpatch.execute({"input": model, "recipe": "MergeDuplicateTypes", "arguments": ["Name"]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "MergeDuplicateTypes", "arguments": ["Name"]}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/MergeProject.py b/src/ifcpatch/ifcpatch/recipes/MergeProject.py index f59d647291..586e8a4eb7 100644 --- a/src/ifcpatch/ifcpatch/recipes/MergeProject.py +++ b/src/ifcpatch/ifcpatch/recipes/MergeProject.py @@ -37,7 +37,7 @@ class Patcher: .. code:: python - ifcpatch.execute({"input": model, "recipe": "MergeProject", "arguments": ["/path/to/model2.ifc"]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "MergeProject", "arguments": ["/path/to/model2.ifc"]}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/Migrate.py b/src/ifcpatch/ifcpatch/recipes/Migrate.py index be664315f8..a82230a92f 100644 --- a/src/ifcpatch/ifcpatch/recipes/Migrate.py +++ b/src/ifcpatch/ifcpatch/recipes/Migrate.py @@ -35,7 +35,7 @@ class Patcher: .. code:: python # Upgrade an IFC2X3 model to IFC4 - ifcpatch.execute({"input": model, "recipe": "Migrate", "arguments": ["IFC4"]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "Migrate", "arguments": ["IFC4"]}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/OffsetObjectPlacements.py b/src/ifcpatch/ifcpatch/recipes/OffsetObjectPlacements.py index a546beb203..ab6b4c151d 100644 --- a/src/ifcpatch/ifcpatch/recipes/OffsetObjectPlacements.py +++ b/src/ifcpatch/ifcpatch/recipes/OffsetObjectPlacements.py @@ -68,13 +68,13 @@ class Patcher: .. code:: python # Offset a model by 100 units in both the X and Y axis. - ifcpatch.execute({"input": model, "recipe": "OffsetObjectPlacements", "arguments": [100,100,0]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "OffsetObjectPlacements", "arguments": [100,100,0]}) # Rotate by 90 degrees, but don't do any offset - ifcpatch.execute({"input": model, "recipe": "OffsetObjectPlacements", "arguments": [0,0,0,True,90]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "OffsetObjectPlacements", "arguments": [0,0,0,True,90]}) # Some crazy 3D rotation and offset - ifcpatch.execute({"input": model, "recipe": "OffsetObjectPlacements", "arguments": [12.5,5,2,False,90,90,45]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "OffsetObjectPlacements", "arguments": [12.5,5,2,False,90,90,45]}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/OffsetStoreyElevations.py b/src/ifcpatch/ifcpatch/recipes/OffsetStoreyElevations.py index c93cbaaaef..24cc9f6f00 100644 --- a/src/ifcpatch/ifcpatch/recipes/OffsetStoreyElevations.py +++ b/src/ifcpatch/ifcpatch/recipes/OffsetStoreyElevations.py @@ -31,7 +31,7 @@ class Patcher: .. code:: python # Shift all storeys up by 42 units - ifcpatch.execute({"input": model, "recipe": "OffsetStoreyElevations", "arguments": [42]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "OffsetStoreyElevations", "arguments": [42]}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/Optimise.py b/src/ifcpatch/ifcpatch/recipes/Optimise.py index 706754bf05..5e67f6b8a2 100644 --- a/src/ifcpatch/ifcpatch/recipes/Optimise.py +++ b/src/ifcpatch/ifcpatch/recipes/Optimise.py @@ -37,7 +37,7 @@ class Patcher: affects filesize and has minimal impact on load times. Large filesizes can usually be solved through other means. Consult the BlenderBIM Add-on documentation on dealing with large models for more details. - + Warning: this optimise recipe is very, very slow. Please consider using RecycleNonRootedElements instead. @@ -45,7 +45,7 @@ class Patcher: .. code:: python - ifcpatch.execute({"input": model, "recipe": "Optimise", "arguments": []}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "Optimise", "arguments": []}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/PurgeData.py b/src/ifcpatch/ifcpatch/recipes/PurgeData.py index 33ecbfda71..e2cdc4d140 100644 --- a/src/ifcpatch/ifcpatch/recipes/PurgeData.py +++ b/src/ifcpatch/ifcpatch/recipes/PurgeData.py @@ -47,7 +47,7 @@ class Patcher: .. code:: python # Watch the world burn - ifcpatch.execute({"input": model, "recipe": "PurgeData", "arguments": []}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "PurgeData", "arguments": []}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/RecycleNonRootedElements.py b/src/ifcpatch/ifcpatch/recipes/RecycleNonRootedElements.py index f73ccf0200..079a26494c 100644 --- a/src/ifcpatch/ifcpatch/recipes/RecycleNonRootedElements.py +++ b/src/ifcpatch/ifcpatch/recipes/RecycleNonRootedElements.py @@ -43,7 +43,7 @@ class Patcher: .. code:: python - ifcpatch.execute({"input": model, "recipe": "RecycleNonRootedElements", "arguments": []}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "RecycleNonRootedElements", "arguments": []}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/RegenerateGlobalIds.py b/src/ifcpatch/ifcpatch/recipes/RegenerateGlobalIds.py index b3989d7b75..58e35cb2c3 100644 --- a/src/ifcpatch/ifcpatch/recipes/RegenerateGlobalIds.py +++ b/src/ifcpatch/ifcpatch/recipes/RegenerateGlobalIds.py @@ -41,10 +41,10 @@ class Patcher: .. code:: python # Regenerate all GlobalIds - ifcpatch.execute({"input": model, "recipe": "RegenerateGlobalIds", "arguments": []}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "RegenerateGlobalIds", "arguments": []}) # Regenerate only duplicate GlobalIds - ifcpatch.execute({"input": model, "recipe": "RegenerateGlobalIds", "arguments": [True]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "RegenerateGlobalIds", "arguments": [True]}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/RemoveRevitUniformatClassification.py b/src/ifcpatch/ifcpatch/recipes/RemoveRevitUniformatClassification.py index 22cad79bba..0a73508139 100644 --- a/src/ifcpatch/ifcpatch/recipes/RemoveRevitUniformatClassification.py +++ b/src/ifcpatch/ifcpatch/recipes/RemoveRevitUniformatClassification.py @@ -29,7 +29,7 @@ class Patcher: .. code:: python - ifcpatch.execute({"input": model, "recipe": "RemoveRevitUniformatClassification"}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "RemoveRevitUniformatClassification"}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/RemoveSiteRepresentation.py b/src/ifcpatch/ifcpatch/recipes/RemoveSiteRepresentation.py index c9703967d6..39b326a4c9 100644 --- a/src/ifcpatch/ifcpatch/recipes/RemoveSiteRepresentation.py +++ b/src/ifcpatch/ifcpatch/recipes/RemoveSiteRepresentation.py @@ -27,7 +27,7 @@ class Patcher: .. code:: python - ifcpatch.execute({"input": model, "recipe": "RemoveSiteRepresentation", "arguments": []}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "RemoveSiteRepresentation", "arguments": []}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/ResetAbsoluteCoordinates.py b/src/ifcpatch/ifcpatch/recipes/ResetAbsoluteCoordinates.py index 37fd94e2c6..daeff23af8 100644 --- a/src/ifcpatch/ifcpatch/recipes/ResetAbsoluteCoordinates.py +++ b/src/ifcpatch/ifcpatch/recipes/ResetAbsoluteCoordinates.py @@ -80,16 +80,16 @@ class Patcher: .. code:: python # Reset all coordinates with an ordinate larger than 1000000 arbitrarily - ifcpatch.execute({"input": model, "recipe": "ResetAbsoluteCoordinates", "arguments": []}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ResetAbsoluteCoordinates", "arguments": []}) # Reset all coordinates with an ordinate larger than 1000 arbitrarily - ifcpatch.execute({"input": model, "recipe": "ResetAbsoluteCoordinates", "arguments": [1000]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ResetAbsoluteCoordinates", "arguments": [1000]}) # Reset all coordinates with an ordinate larger than 1000000 by -50000,-20000,0 - ifcpatch.execute({"input": model, "recipe": "ResetAbsoluteCoordinates", "arguments": [-50000,-20000,0]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ResetAbsoluteCoordinates", "arguments": [-50000,-20000,0]}) # Reset all coordinates with an ordinate larger than 1000 by -500,-200,0 - ifcpatch.execute({"input": model, "recipe": "ResetAbsoluteCoordinates", "arguments": [-500,-200,0,1000]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ResetAbsoluteCoordinates", "arguments": [-500,-200,0,1000]}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/ResetSpatialElementLocations.py b/src/ifcpatch/ifcpatch/recipes/ResetSpatialElementLocations.py index a1e19d1488..f77516eb4b 100644 --- a/src/ifcpatch/ifcpatch/recipes/ResetSpatialElementLocations.py +++ b/src/ifcpatch/ifcpatch/recipes/ResetSpatialElementLocations.py @@ -33,7 +33,7 @@ class Patcher: .. code:: python # All IfcSites will shift back to 0,0,0. - ifcpatch.execute({"input": model, "recipe": "ResetSpatialElementLocations", "arguments": ["IfcSite"]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ResetSpatialElementLocations", "arguments": ["IfcSite"]}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/SetRefElevation.py b/src/ifcpatch/ifcpatch/recipes/SetRefElevation.py index 188644f230..fc83f37ccf 100644 --- a/src/ifcpatch/ifcpatch/recipes/SetRefElevation.py +++ b/src/ifcpatch/ifcpatch/recipes/SetRefElevation.py @@ -37,7 +37,7 @@ class Patcher: .. code:: python # All IfcSites will have their reference elevation set to 42. - ifcpatch.execute({"input": model, "recipe": "SetRefElevation", "arguments": [42]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "SetRefElevation", "arguments": [42]}) """ self.src = src self.file = file diff --git a/src/ifcpatch/ifcpatch/recipes/SplitByBuildingStorey.py b/src/ifcpatch/ifcpatch/recipes/SplitByBuildingStorey.py index 0d881fde47..ac0db99d9e 100644 --- a/src/ifcpatch/ifcpatch/recipes/SplitByBuildingStorey.py +++ b/src/ifcpatch/ifcpatch/recipes/SplitByBuildingStorey.py @@ -27,26 +27,29 @@ class Patcher: :param output_dir: Specifies an output directory where the new IFC models will be saved. :type output_dir: str - + Example: .. code:: python - ifcpatch.execute({"input": model, "recipe": "SplitByBuildingStorey", "arguments": ["C:/.../output_files"]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "SplitByBuildingStorey", "arguments": ["C:/.../output_files"]}) """ self.src = src self.file = file self.logger = logger self.output_dir = output_dir - def patch(self): import ifcopenshell from shutil import copyfile storeys = self.file.by_type("IfcBuildingStorey") for i, storey in enumerate(storeys): - dest = "{}-{}.ifc".format(i, storey.Name) if self.output_dir == None else "{}/{}-{}.ifc".format(self.output_dir,i, storey.Name) + dest = ( + "{}-{}.ifc".format(i, storey.Name) + if self.output_dir == None + else "{}/{}-{}.ifc".format(self.output_dir, i, storey.Name) + ) copyfile(self.src, dest) old_ifc = ifcopenshell.open(dest) new_ifc = ifcopenshell.file(schema=self.file.schema) diff --git a/src/ifcpatch/ifcpatch/recipes/TessellateElements.py b/src/ifcpatch/ifcpatch/recipes/TessellateElements.py index d928306e08..acc65e3e76 100644 --- a/src/ifcpatch/ifcpatch/recipes/TessellateElements.py +++ b/src/ifcpatch/ifcpatch/recipes/TessellateElements.py @@ -39,7 +39,7 @@ class Patcher: .. code:: python - ifcpatch.execute({"input": model, "recipe": "TessellateElements", "arguments": ["IfcBeam"]}) + ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "TessellateElements", "arguments": ["IfcBeam"]}) """ self.src = src self.file = file