mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 21:59:59 +00:00
Add documentation for IfcPatch
This commit is contained in:
@@ -22,7 +22,8 @@ You will need to choose which build to download.
|
|||||||
- If you are on Blender >=3.1, choose py310
|
- If you are on Blender >=3.1, choose py310
|
||||||
- If you are on Blender >=2.93 and <3.1, choose py39
|
- If you are on Blender >=2.93 and <3.1, choose py39
|
||||||
- If you are on Blender <2.93, choose py37
|
- If you are on Blender <2.93, choose py37
|
||||||
- Choose linux, macos, or win depending on your operating system
|
- Choose ``linux``, ``macos``, ``macosm1`` (for Apple M1 devices), or ``win``
|
||||||
|
depending on your operating system
|
||||||
|
|
||||||
Sometimes, a build may be delayed, or contain broken code. We try to avoid this,
|
Sometimes, a build may be delayed, or contain broken code. We try to avoid this,
|
||||||
but it happens.
|
but it happens.
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ Source installation
|
|||||||
|
|
||||||
1. :doc:`Install IfcOpenShell <ifcopenshell-python/installation>`
|
1. :doc:`Install IfcOpenShell <ifcopenshell-python/installation>`
|
||||||
2. `Clone the source code <https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.7.0/src/ifcdiff>`_.
|
2. `Clone the source code <https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.7.0/src/ifcdiff>`_.
|
||||||
3. ``pip install -r requirements.txt``
|
3. ``cd /path/to/src/ifcdiff``
|
||||||
|
4. ``pip install -r requirements.txt``
|
||||||
|
|
||||||
Here is a minimal example of how to use IfcDiff as a Python module or CLI
|
Here is a minimal example of how to use IfcDiff as a Python module or CLI
|
||||||
utility:
|
utility:
|
||||||
@@ -69,6 +70,11 @@ Here is a minimal example of how to use IfcDiff as a library:
|
|||||||
For more information on how to use IfcDiff as a library, check out the :doc:`API
|
For more information on how to use IfcDiff as a library, check out the :doc:`API
|
||||||
reference <autoapi/ifcdiff/index>`.
|
reference <autoapi/ifcdiff/index>`.
|
||||||
|
|
||||||
|
You can also alias it to a command:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
$ alias ifcdiff='python -m ifcdiff'
|
||||||
|
|
||||||
Using the BlenderBIM Add-on
|
Using the BlenderBIM Add-on
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
IfcPatch
|
||||||
|
========
|
||||||
|
|
||||||
|
IfcPatch is both a CLI utility and library that lets you run a predetermined
|
||||||
|
modification on an IFC file, known as a patch recipe. This is great for running
|
||||||
|
prepackaged scripts on IFC models on a server with a standardised interface.
|
||||||
|
It's also great for distributing little scripts that need to modify an IFC to
|
||||||
|
users who don't know how to code or aren't interested in knowing the details.
|
||||||
|
|
||||||
|
Source installation
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
1. :doc:`Install IfcOpenShell <ifcopenshell-python/installation>`
|
||||||
|
2. `Clone the source code <https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.7.0/src/ifcpatch>`_.
|
||||||
|
3. ``cd /path/to/src/ifcpatch``
|
||||||
|
|
||||||
|
Here is a minimal example of how to use IfcPatch as a Python module or CLI
|
||||||
|
utility:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
$ python -m ifcpatch -h
|
||||||
|
|
||||||
|
usage: __main__.py [-h] -i INPUT [-o OUTPUT] -r RECIPE [-l LOG]
|
||||||
|
[-a ARGUMENTS [ARGUMENTS ...]]
|
||||||
|
|
||||||
|
Patches IFC files to fix badly formatted data
|
||||||
|
|
||||||
|
optional arguments:
|
||||||
|
-h, --help show this help message and exit
|
||||||
|
-i INPUT, --input INPUT
|
||||||
|
The IFC file to patch
|
||||||
|
-o OUTPUT, --output OUTPUT
|
||||||
|
The output file to save the patched IFC
|
||||||
|
-r RECIPE, --recipe RECIPE
|
||||||
|
Name of the recipe to use when patching
|
||||||
|
-l LOG, --log LOG Specify a log file
|
||||||
|
-a ARGUMENTS [ARGUMENTS ...], --arguments ARGUMENTS [ARGUMENTS ...]
|
||||||
|
Specify custom arguments to the patch recipe
|
||||||
|
|
||||||
|
Exactly how it is run depends on the recipe. A recipe may require zero or more
|
||||||
|
arguments which are specific to the recipe. Here's an example which runs the
|
||||||
|
`ExtractElements` recipe, which, as the same suggests, extracts out elements.
|
||||||
|
This recipe expects one argument, which uses the [IFC Query
|
||||||
|
syntax](https://wiki.osarch.org/index.php?title=IfcOpenShell_code_examples#IFC_Query_Syntax).
|
||||||
|
In this example, we'll extract out all `IfcWall` elements.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
$ ifcpatch -i input.ifc -o output.ifc -r ExtractElements -a ".IfcWall"
|
||||||
|
$ cat output.ifc
|
||||||
|
|
||||||
|
Here is a minimal example of how to use IfcDiff as a library:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
import ifcpatch
|
||||||
|
|
||||||
|
ifcpatch.execute({
|
||||||
|
"input": "input.ifc",
|
||||||
|
"output": "output.ifc",
|
||||||
|
"recipe": "ExtractElements",
|
||||||
|
"log": "ifcpatch.log",
|
||||||
|
"arguments": [".IfcWall"],
|
||||||
|
})
|
||||||
|
|
||||||
|
You can also alias it to a command:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
$ alias ifcpatch='python -m ifcpatch'
|
||||||
|
|
||||||
|
Alternatively, you can package it as an executable.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
$ python make.py
|
||||||
|
$ ./dist/ifcpatch
|
||||||
@@ -17,6 +17,7 @@ IfcOpenShell is a suite of developer libraries and utilities to manipulate OpenB
|
|||||||
ifcconvert
|
ifcconvert
|
||||||
bimtester
|
bimtester
|
||||||
ifcdiff
|
ifcdiff
|
||||||
|
ifcpatch
|
||||||
ifcclash
|
ifcclash
|
||||||
ifccobie
|
ifccobie
|
||||||
ifcmax
|
ifcmax
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import ifcopenshell.api
|
import ifcopenshell.api
|
||||||
|
import ifcopenshell.util.element
|
||||||
|
import ifcopenshell.util.placement
|
||||||
|
|
||||||
|
|
||||||
class Usecase:
|
class Usecase:
|
||||||
|
|||||||
Reference in New Issue
Block a user