Minor IfcPatch doc fix where examples had a missing argument

This commit is contained in:
Dion Moult
2023-11-23 12:07:29 +11:00
parent f2e56f8128
commit e3742cefb0
26 changed files with 43 additions and 40 deletions
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
+1 -1
View File
@@ -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
@@ -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
@@ -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
+1 -1
View File
@@ -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
@@ -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
@@ -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
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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)
@@ -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