Update geom settings with newly added settings, and add example code. See #671.

This commit is contained in:
Dion Moult
2022-10-06 15:51:57 +11:00
parent 72147e51f5
commit 15b4ab543b
5 changed files with 710 additions and 268 deletions
@@ -12,4 +12,5 @@ system, as well as high level analysis and authoring functions.
ifcopenshell-python/installation
ifcopenshell-python/hello_world
ifcopenshell-python/code_examples
ifcopenshell-python/geometry_iterator
ifcopenshell-python/developer_guide
@@ -0,0 +1,53 @@
Geometry iterator
=================
IfcOpenShell provides a geometry iterator function to efficiently process
geometry in an IFC model. The iterator is always used in IfcConvert, and may
also be invoked in C++ or in Python.
The geometry iterator makes it easy to collect possible geometry in a model,
supports multicore processing, and implements caching and reuse to improve the
efficiency of geometry processing. It is also possible to process geometry one
by one using ``create_shape()``, but is significantly less efficient.
By default, the geometry iterator processes all 3D geometry in a model from all
elements, and returns a list of X Y Z vertex ordinates in a flattend list, as
well as a flattend list of triangulated faces denoted by vertex indices.
There are a variety of configuration settings to get different output. For
example, you may filter elements from processing, extract 2D data, or return
non-triangulated OpenCASCADE BReps. For more information on the various
settings, see :doc:`Geometry Settings<../ifcopenshell/geometry_settings>`.
Here is a simple example in Python:
.. code-block:: python
import multiprocessing
import ifcopenshell
import ifcopenshell.geom
ifc_file = ifcopenshell.open('model.ifc')
settings = ifcopenshell.geom.settings()
iterator = ifcopenshell.geom.iterator(settings, ifc_file, multiprocessing.cpu_count())
if iterator.initialize():
while True:
shape = iterator.get()
# Get the current IFC element we are iterating over
element = ifc_file.by_guid(shape.guid)
# Indices of vertices per triangle face e.g. [f1v1, f1v2, f1v3, f2v1, f2v2, f2v3, ...]
faces = shape.geometry.faces
# X Y Z of vertices in flattened list e.g. [v1x, v1y, v1z, v2x, v2y, v2z, ...]
verts = shape.geometry.verts
# Material names and colour style information that are relevant to this shape
materials = shape.geometry.materials
# Indices of material applied per triangle face e.g. [f1m, f2m, ...]
material_ids = shape.geometry.material_ids
# Since the lists are flattened, you may prefer to group them per
# face like so depending on your geometry kernel
grouped_verts = [[verts[i], verts[i + 1], verts[i + 2]] for i in range(0, len(verts), 3)]
grouped_faces = [[faces[i], faces[i + 1], faces[i + 2]] for i in range(0, len(faces), 3)]
if not iterator.next():
break
@@ -15,6 +15,7 @@ compile-time when using C++ and at run-time when using Python.
ifcopenshell/installation
ifcopenshell/geometry_iterator
ifcopenshell/geometry_settings
Indices and tables
------------------
@@ -1,273 +1,20 @@
Geometry Iterator
Geometry iterator
=================
IfcOpenShell provides a geometry iterator function to efficiently process all
IfcOpenShell provides a geometry iterator function to efficiently process
geometry in an IFC model. The iterator is always used in IfcConvert, and may
also be invoked in C++ or in Python.
The geometry iterator makes the process of collective all possible geometry in a
model easy, supports multicore processing, and implements caching and reuse to
improve the efficiency of geometry processing.
APPLY_DEFAULT_MATERIALS
-----------------------
Given the command invocation:
::
Duplex_A_20110907_optimized.ifc d.dae -yv --include attribute GlobalId 3bXiCStxP6Fgxdej$yc50U
You will find log messages along the lines of
[Warning] {3bXiCStxP6Fgxdej$yc50U} No material and surface styles for:
#333=IfcCovering('3bXiCStxP6Fgxdej$yc50U',#1,'Compound Ceiling:Gypsum Board:187483',$,'Compound Ceiling:Gypsum Board',#17840,#17052,'187483',.CEILING.)
This means that there is no IfcStyledItem associated to the representation items and that the element does not have an IfcMaterial association with IfcMaterialRepresentation from which we can derive a style (colour) for the element.
The interactive session below shows how with this setting enabled you will get a default generated material from the IFC element entity type and material indices of 0 pointing to that. With this setting disabled the material index would be -1 to indicate a missing style. Note that there is one material index for every triangle in the list of `shp.geometry.faces`.
>>> import ifcopenshell, ifcopenshell.geom
>>> f = ifcopenshell.open("Duplex_A_20110907_optimized.ifc")
>>> s = ifcopenshell.geom.settings()
>>> c = f["3bXiCStxP6Fgxdej$yc50U"]
>>>
>>> shp = ifcopenshell.geom.create_shape(s, c)
>>> shp.geometry.material_ids
(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)
>>> [(m.name, m.diffuse) for m in shp.geometry.materials]
[]
>>>
>>> s.set(s.APPLY_DEFAULT_MATERIALS, True)
>>> shp = ifcopenshell.geom.create_shape(s, c)
>>> shp.geometry.material_ids
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
>>> [(m.name, m.diffuse) for m in shp.geometry.materials]
[('IfcCovering', (0.7, 0.7, 0.7))]
This is enabled by default for the IfcConvert serializers as they will not gracefully handle -1 material indices and allows users to quickly assign colours based on entity types in their modelling applications.
APPLY_LAYERSETS
---------------
This setting is available in IfcConvert as ``--enable-layerset-slicing``.
For IfcWall and IfcSlab elements, takes the associated IfcMaterialLayerSet and builds a set of surfaces to segment the building element geometry.
.. warning::
Enabling this settings is computationally intensive as it involves 3D Boolean operations.
::
Duplex_A_20110907_optimized.ifc d1.dae -yv --include attribute GlobalId 2O2Fr$t4X7Zf8NOew3FNr2
.. image:: images/settings-1.png
::
Duplex_A_20110907_optimized.ifc d2.dae --enable-layerset-slicing -yv --include attribute GlobalId 2O2Fr$t4X7Zf8NOew3FNr2
.. image:: images/settings-2.png
BUILDING_LOCAL_PLACEMENT
------------------------
This setting is available in IfcConvert using ``--building-local-placement``.
In the typical IfcSite > IfcBuilding > IfcBuildingStorey > ... hierarchy of elements, don't incorporate the ObjectPlacement of the IfcBuilding and above in the placement of elements in the output. This is useful when there is a large offset in this placement that reduces precision in further processing.
CONVERT_BACK_UNITS
------------------
This setting is available in IfcConvert using ``--convert-back-units``.
Internally IfcOpenShell uses meters as the global length unit to do calculations. This setting restores the coordinate positions after conversion by multiplying the factor of the IfcUnit with UnitType=LENGTHUNIT into the output geometry coordinate values.
DISABLE_OPENING_SUBTRACTIONS
----------------------------
This setting is available in IfcConvert using ``--disable-opening-subtraction``.
As in most viewer applications, IfcOpeningElement geometry is subtracted from their host elements. This setting disables this behavior.
Duplex_A_20110907_optimized.ifc d1.dae -yv --include attribute GlobalId 2O2Fr$t4X7Zf8NOew3FNr2
.. image:: images/settings-1.png
::
Duplex_A_20110907_optimized.ifc d3.dae --disable-opening-subtraction -yv --include attribute GlobalId 2O2Fr$t4X7Zf8NOew3FNr2
.. image:: images/settings-3.png
.. note::
Disabling this settings will reduce processing time and improve robustness as it involves 3D Boolean operations.
DISABLE_TRIANGULATION
---------------------
To be used in conjunction with ``USE_BREP_DATA``. Do not apply the triangulation and - when ``USE_BREP_DATA`` is set - return a OpenCASCADE serialized TopoDS_Shape from ``create_shape()`` and ``iterator``.
>>> import ifcopenshell, ifcopenshell.geom
>>> s = ifcopenshell.geom.settings()
>>> s.set(s.DISABLE_TRIANGULATION, True)
>>> s.set(s.USE_BREP_DATA, True)
>>> f = ifcopenshell.open("Duplex_A_20110907_optimized.ifc")
>>> c = f["3bXiCStxP6Fgxdej$yc50U"]
>>> shp = ifcopenshell.geom.create_shape(s, c)
>>> print(shp.geometry.brep_data)
CASCADE Topology V1, (c) Matra-Datavision
Locations 0
Curve2ds 0
Curves 12
1 4.6750000000000034 -8.0749999999999904 2.657 -2.0455514041918775e-15 -1 0
1 4.6750000000000034 -8.0749999999999904 2.657 1 -3.435893306383461e-15 0
1 6.2260000000000044 -8.0749999999999957 2.657 -2.0455514041918724e-15 -1 0
1 6.226 -10.246000000000031 2.657 -1 6.8717866127669219e-15 0
...
EDGE_ARROWS
-----------
When ``INCLUDE_CURVES`` is true and geometric elements include curves (such as the wall axis), add arrow heads to the edges to indicate direction of the curve.
::
Duplex_A_20110907_optimized.ifc d4.dae --model --plan --edge-arrows -yv --include attribute GlobalId 2O2Fr$t4X7Zf8NOew3FNr2
.. image:: images/settings-4.png
EXCLUDE_SOLIDS_AND_SURFACES
---------------------------
Exclude faces, shells and solids from geometrical output. Implied when using ``--plan`` without ``--model`` in IfcConvert.
FASTER_BOOLEANS
---------------
.. warning::
Only applicable when using OCCT 6.9 and earlier.
This setting is available in IfcConvert using ``--merge-boolean-operands``.
Fuse the collection of all boolean operands into a single union before applying the boolean subtraction, as opposed to doing individual subtractions. This likely improves performance. From OCCT 7.0 onwards the boolean operations with multiple arguments is used.
GENERATE_UVS
------------
This setting is available in IfcConvert using ``--generate-uvs``.
Applies a box projection on the generated geometry for the element to obtain UV coordinates. This is purely generated, it does not involve texture coordinates stored in the IFC model.
::
Duplex_A_20110907_optimized.ifc d5.dae --generate-uvs -yv --include attribute GlobalId 2O2Fr$t4X7Zf8NOew3FNr2
.. image:: images/settings-5.png
INCLUDE_CURVES
--------------
This setting is available in IfcConvert using ``--plan``.
Include edge and wire geometries in the geometric output.
LAYERSET_FIRST
--------------
This setting is available in IfcConvert using ``--layerset-first``.
When not using APPLY_LAYERSETS, take the first material layer from the set to use as the material for the overall element.
NO_NORMALS
----------
This setting is available in IfcConvert using ``--no-normals``.
Do not emit normals on geometric output
SEARCH_FLOOR
------------
.. warning::
Only applicable to Collada .DAE output when used from IfcConvert.
This setting is available in IfcConvert using ``--use-element-hierarchy``.
Include the spatial hierarchy in the elements.
SEW_SHELLS
----------
This setting is available in IfcConvert using ``--orient-shells``.
Re-orient or sew connected face sets to have a consistent outwards orientation.
SITE_LOCAL_PLACEMENT
--------------------
This setting is available in IfcConvert using ``--site-local-placement``.
See ``BUILDING_LOCAL_PLACEMENT``, but exclude also the ObjectPlacement of the IfcSite.
USE_BREP_DATA
-------------
See ``DISABLE_TRIANGULATION``.
USE_PYTHON_OPENCASCADE
----------------------
.. warning::
Only available in Python when an import of ``OCC.Core.BRepTools`` or ``OCC.BRepTools`` succeeds.
This implies ``USE_WORLD_COORDS`` ``USE_BREP_DATA`` and ``DISABLE_TRIANGULATION``. The serialized TopoDS_Shape of ``USE_BREP_DATA`` is deserialized by Python OpenCASCADE.
USE_WORLD_COORDS
----------------
Apply the ObjectPlacement of the building elements to the geometric output. This is implied when using the Wavefront .OBJ output in IfcConvert. Note that this also eliminates the possibility for geometric elements to point to the same interpreted geometry result.
VALIDATE_QUANTITIES
-------------------
This setting is available in IfcConvert using ``--validate``.
Running IfcConvert with ``--validate`` will set a non-zero exit code when ever a log message with severity equal or greater than ERROR has been emitted.
Currently for internal use only. For every building element geometry converted, looks for an associated quantity set where the OwnerHistory's organization name is IfcOpenShell. And looks for the quantities "Total Surface Area", "Volume", "Shape Validation Properties.Surface Genus" and validates these according to the interpreted geometry definition. Emit Logger::Error when calculated values are outside of the tolerance range for the value stored in the model.
WELD_VERTICES
-------------
.. note::
In Python, this setting is on by default. Note: This setting only affects triangulated output.
This setting is available in IfcConvert using ``--weld-vertices``.
Discards normals and joins vertices solely based on position. This is useful when output is to be modified in a modeling application.
>>> import ifcopenshell, ifcopenshell.geom
>>> s = ifcopenshell.geom.settings()
>>> s.set(s.WELD_VERTICES, False)
>>> f = ifcopenshell.open("Duplex_A_20110907_optimized.ifc")
>>> c = f["3bXiCStxP6Fgxdej$yc50U"]
>>> shp = ifcopenshell.geom.create_shape(s, c)
>>> shp.geometry.verts
(4.675000000000003, -8.07499999999999, 2.657, 4.674999999999999, -10.24600000000002, 2.657, 6.226000000000004, -8.074999999999996, 2.657, 6.226, -10.24600000000003, 2.657, 4.675000000000003, -8.07499999999999, 2.6, 4.674999999999999, -10.24600000000002, 2.6, 6.226000000000004, -8.074999999999996, 2.6, 6.226, -10.24600000000003, 2.6, 4.674999999999999, -10.24600000000002, 2.657, 4.674999999999999, -10.24600000000002, 2.6, 4.675000000000003, -8.07499999999999, 2.657, 4.675000000000003, -8.07499999999999, 2.6, 6.226, -10.24600000000003, 2.657, 4.674999999999999, -10.24600000000002, 2.657, 6.226, -10.24600000000003, 2.6, 4.674999999999999, -10.24600000000002, 2.6, 6.226000000000004, -8.074999999999996, 2.657, 6.226, -10.24600000000003, 2.657, 6.226000000000004, -8.074999999999996, 2.6, 6.226, -10.24600000000003, 2.6, 4.675000000000003, -8.07499999999999, 2.657, 4.675000000000003, -8.07499999999999, 2.6, 6.226000000000004, -8.074999999999996, 2.657, 6.226000000000004, -8.074999999999996, 2.6)
>>> shp.geometry.normals
(3.059754518198021e-17, 0.0, -1.0, 3.059754518198021e-17, 0.0, -1.0, 3.059754518198021e-17, 0.0, -1.0, 3.059754518198021e-17, 0.0, -1.0, 2.110175529791737e-16, 0.0, -1.0, 2.110175529791737e-16, 0.0, -1.0, 2.110175529791737e-16, 0.0, -1.0, 2.110175529791737e-16, 0.0, -1.0, -1.0, 1.79434333701042e-15, 0.0, -1.0, 1.79434333701042e-15, 0.0, -1.0, 1.79434333701042e-15, 0.0, -1.0, 1.79434333701042e-15, 0.0, 6.8717866127669046e-15, 1.0, 0.0, 6.8717866127669046e-15, 1.0, 0.0, 6.8717866127669046e-15, 1.0, 0.0, 6.8717866127669046e-15, 1.0, 0.0, -1.0, 1.79434333701042e-15, 0.0, -1.0, 1.79434333701042e-15, 0.0, -1.0, 1.79434333701042e-15, 0.0, -1.0, 1.79434333701042e-15, 0.0, 3.4358933063834523e-15, 1.0, 0.0, 3.4358933063834523e-15, 1.0, 0.0, 3.4358933063834523e-15, 1.0, 0.0, 3.4358933063834523e-15, 1.0, 0.0)
>>>
>>> s.set(s.WELD_VERTICES, True)
>>> shp = ifcopenshell.geom.create_shape(s, c)
>>> shp.geometry.verts
(4.675000000000003, -8.07499999999999, 2.657, 4.674999999999999, -10.24600000000002, 2.657, 6.226000000000004, -8.074999999999996, 2.657, 6.226, -10.24600000000003, 2.657, 4.675000000000003, -8.07499999999999, 2.6, 4.674999999999999, -10.24600000000002, 2.6, 6.226000000000004, -8.074999999999996, 2.6, 6.226, -10.24600000000003, 2.6)
>>> shp.geometry.normals
()
The geometry iterator makes it easy to collect possible geometry in a model,
supports multicore processing, and implements caching and reuse to improve the
efficiency of geometry processing. It is also possible to process geometry one
by one using ``create_shape()``, but is significantly less efficient.
By default, the geometry iterator processes all 3D geometry in a model from all
elements, and returns a list of X Y Z vertex ordinates in a flattend list, as
well as a flattend list of triangulated faces denoted by vertex indices.
There are a variety of configuration settings to get different output. For
example, you may filter elements from processing, extract 2D data, or return
non-triangulated OpenCASCADE BReps. For more information on the various
settings, see :doc:`Geometry Settings<geometry_settings>`.
@@ -0,0 +1,640 @@
Geometry settings
=================
The geometry iterator has a variety of settings which can impact its output.
Some of these are set during the construction of the iterator, whereas some are
set in a specific iterator settings object.
All UPPERCASE settings are booleans which are always set in a separate settings
object. Lowercase settings are set either during iterator construction or via a
setting function.
All settings can be accessed with C++ and Python, but only some are exposed in
IfcConvert via command line arguments.
Here's an example of changing settings in C++:
.. code-block:: c++
SerializerSettings settings;
settings.set(IfcGeom::IteratorSettings::APPLY_DEFAULT_MATERIALS, true);
settings.set_deflection_tolerance(1e-3);
Here's an example of changing settings in Python:
.. code-block:: python
settings = ifcopenshell.geom.settings()
settings.set(settings.APPLY_DEFAULT_MATERIALS, True)
settings.set_deflection_tolerance(1e-3)
angular_tolerance
-----------------
+--------+-------------------------+---------+
| Type | IfcConvert Option | Default |
+========+=========================+=========+
| DOUBLE | ``--angular-tolerance`` | 0.5 |
+--------+-------------------------+---------+
Sets the angular tolerance of the mesher in radians.
Here is an example in C++:
.. code-block:: c++
SerializerSettings settings;
double tolerance;
// ...
settings.set_angular_tolerance(tolerance);
Here is an example in Python:
.. code-block:: python
settings = ifcopenshell.geom.settings()
settings.set_angular_tolerance(0.5)
APPLY_DEFAULT_MATERIALS
-----------------------
+------+-------------------+---------+
| Type | IfcConvert Option | Default |
+======+===================+=========+
| BOOL | Always enabled | False |
+------+-------------------+---------+
Given the command invocation:
::
IfcConvert model.ifc d.dae -yv --include attribute GlobalId 3bXiCStxP6Fgxdej$yc50U
You will find log messages along the lines of
[Warning] {3bXiCStxP6Fgxdej$yc50U} No material and surface styles for:
#333=IfcCovering('3bXiCStxP6Fgxdej$yc50U',#1,'Compound Ceiling:Gypsum Board:187483',$,'Compound Ceiling:Gypsum Board',#17840,#17052,'187483',.CEILING.)
This means that there is no IfcStyledItem associated to the representation items and that the element does not have an IfcMaterial association with IfcMaterialRepresentation from which we can derive a style (colour) for the element.
The interactive session below shows how with this setting enabled you will get a default generated material from the IFC element entity type and material indices of 0 pointing to that. With this setting disabled the material index would be -1 to indicate a missing style. Note that there is one material index for every triangle in the list of `shp.geometry.faces`.
>>> import ifcopenshell, ifcopenshell.geom
>>> f = ifcopenshell.open("model.ifc")
>>> s = ifcopenshell.geom.settings()
>>> c = f["3bXiCStxP6Fgxdej$yc50U"]
>>>
>>> shp = ifcopenshell.geom.create_shape(s, c)
>>> shp.geometry.material_ids
(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)
>>> [(m.name, m.diffuse) for m in shp.geometry.materials]
[]
>>>
>>> s.set(s.APPLY_DEFAULT_MATERIALS, True)
>>> shp = ifcopenshell.geom.create_shape(s, c)
>>> shp.geometry.material_ids
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
>>> [(m.name, m.diffuse) for m in shp.geometry.materials]
[('IfcCovering', (0.7, 0.7, 0.7))]
This is enabled by default for the IfcConvert serializers as they will not gracefully handle -1 material indices and allows users to quickly assign colours based on entity types in their modelling applications.
APPLY_LAYERSETS
---------------
+------+-------------------------------+---------+
| Type | IfcConvert Option | Default |
+======+===============================+=========+
| BOOL | ``--enable-layerset-slicing`` | False |
+------+-------------------------------+---------+
For IfcWall and IfcSlab elements, takes the associated IfcMaterialLayerSet and builds a set of surfaces to segment the building element geometry.
.. warning::
Enabling this settings is computationally intensive as it involves 3D Boolean operations.
::
IfcConvert model.ifc d1.dae -yv --include attribute GlobalId 2O2Fr$t4X7Zf8NOew3FNr2
.. image:: images/settings-1.png
::
IfcConvert model.ifc d2.dae --enable-layerset-slicing -yv --include attribute GlobalId 2O2Fr$t4X7Zf8NOew3FNr2
.. image:: images/settings-2.png
BOOLEAN_ATTEMPT_2D
------------------
+------+---------------------+---------+
| Type | IfcConvert Option | Default |
+======+=====================+=========+
| BOOL | ``--no-2d-boolean`` | True |
+------+---------------------+---------+
Try to perform boolean subtractions in 2d. This can result in 2-3x faster geometry processing.
BUILDING_LOCAL_PLACEMENT
------------------------
+------+--------------------------------+---------+
| Type | IfcConvert Option | Default |
+======+================================+=========+
| BOOL | ``--building-local-placement`` | False |
+------+--------------------------------+---------+
In the typical IfcSite > IfcBuilding > IfcBuildingStorey > ... hierarchy of elements, don't incorporate the ObjectPlacement of the IfcBuilding and above in the placement of elements in the output. This is useful when there is a large offset in this placement that reduces precision in further processing.
context_ids
-----------
+-------------+-------------------+---------+
| Type | IfcConvert Option | Default |
+=============+===================+=========+
| LIST OF INT | N/A | NULL |
+-------------+-------------------+---------+
By default, geometry is processed from all geometric representation contexts.
In C++ and Python, it is possible to specify exactly which contexts should be
processed, by passing in a list of integers, where the integers are the IDs of
the contexts. Typically used to target only Body representations or non-Body
representations.
Here is an example in C++:
.. code-block:: c++
SerializerSettings settings;
std::vector<int> context_ids;
// ...
settings.set_context_ids(context_ids);
Here is an example in Python:
.. code-block:: python
settings = ifcopenshell.geom.settings()
contexts = [c.id() for c in ifc_file.by_type("IfcGeometricRepresentationContext") if c.ContextIdentifier == "Body"]
settings.set_context_ids(contexts)
CONVERT_BACK_UNITS
------------------
+------+--------------------------+---------+
| Type | IfcConvert Option | Default |
+======+==========================+=========+
| BOOL | ``--convert-back-units`` | False |
+------+--------------------------+---------+
Internally IfcOpenShell uses meters as the global length unit to do calculations. This setting restores the coordinate positions after conversion by multiplying the factor of the IfcUnit with UnitType=LENGTHUNIT into the output geometry coordinate values.
DEBUG_BOOLEAN
-------------
+------+-----------------------+---------+
| Type | IfcConvert Option | Default |
+======+=======================+=========+
| BOOL | ``--debug`` or ``-d`` | False |
+------+-----------------------+---------+
Write boolean operands to file in current directory for debugging purposes.
deflection_tolerance
--------------------
+--------+----------------------------+---------+
| Type | IfcConvert Option | Default |
+========+============================+=========+
| DOUBLE | ``--deflection-tolerance`` | 1e-3 |
+--------+----------------------------+---------+
Sets the deflection tolerance of the mesher.
Here is an example in C++:
.. code-block:: c++
SerializerSettings settings;
double tolerance;
// ...
settings.set_deflection_tolerance(tolerance);
Here is an example in Python:
.. code-block:: python
settings = ifcopenshell.geom.settings()
settings.set_deflection_tolerance(1e-3)
DISABLE_BOOLEAN_RESULT
----------------------
+------+-------------------------------+---------+
| Type | IfcConvert Option | Default |
+======+===============================+=========+
| BOOL | ``--disable-boolean-results`` | False |
+------+-------------------------------+---------+
Disables the evaluation of IfcBooleanResult and simply returns FirstOperand.
DISABLE_OPENING_SUBTRACTIONS
----------------------------
+------+------------------------------------+---------+
| Type | IfcConvert Option | Default |
+======+====================================+=========+
| BOOL | ``--disable-opening-subtractions`` | False |
+------+------------------------------------+---------+
As in most viewer applications, IfcOpeningElement geometry is subtracted from their host elements. This setting disables this behavior.
::
IfcConvert model.ifc d1.dae -yv --include attribute GlobalId 2O2Fr$t4X7Zf8NOew3FNr2
.. image:: images/settings-1.png
::
IfcConvert model.ifc d3.dae --disable-opening-subtraction -yv --include attribute GlobalId 2O2Fr$t4X7Zf8NOew3FNr2
.. image:: images/settings-3.png
.. note::
Disabling this settings will reduce processing time and improve robustness as it involves 3D Boolean operations.
DISABLE_TRIANGULATION
---------------------
+------+------------------------------------+---------+
| Type | IfcConvert Option | Default |
+======+====================================+=========+
| BOOL | True for SVG, HDF, otherwise False | False |
+------+------------------------------------+---------+
By default, the iterator returns triangulated geometry. This setting allows to
disable triangulation, and instead to output BReps. Therefore, it is to be used
in conjunction with ``USE_BREP_DATA``. When ``DISABLE_TRIANGULATION`` is set to
False and ``USE_BREP_DATA`` is set to True, the iterator will return a
OpenCASCADE serialized TopoDS_Shape from ``create_shape()`` and ``iterator``.
>>> import ifcopenshell, ifcopenshell.geom
>>> s = ifcopenshell.geom.settings()
>>> s.set(s.DISABLE_TRIANGULATION, True)
>>> s.set(s.USE_BREP_DATA, True)
>>> f = ifcopenshell.open("model.ifc")
>>> c = f["3bXiCStxP6Fgxdej$yc50U"]
>>> shp = ifcopenshell.geom.create_shape(s, c)
>>> print(shp.geometry.brep_data)
CASCADE Topology V1, (c) Matra-Datavision
Locations 0
Curve2ds 0
Curves 12
1 4.6750000000000034 -8.0749999999999904 2.657 -2.0455514041918775e-15 -1 0
1 4.6750000000000034 -8.0749999999999904 2.657 1 -3.435893306383461e-15 0
1 6.2260000000000044 -8.0749999999999957 2.657 -2.0455514041918724e-15 -1 0
1 6.226 -10.246000000000031 2.657 -1 6.8717866127669219e-15 0
...
EDGE_ARROWS
-----------
+------+-------------------+---------+
| Type | IfcConvert Option | Default |
+======+===================+=========+
| BOOL | ``--edge-arrows`` | False |
+------+-------------------+---------+
When ``INCLUDE_CURVES`` is true and geometric elements include curves (such as the wall axis), add arrow heads to the edges to indicate direction of the curve.
::
IfcConvert model.ifc d4.dae --model --plan --edge-arrows -yv --include attribute GlobalId 2O2Fr$t4X7Zf8NOew3FNr2
.. image:: images/settings-4.png
ELEMENT_HIERARCHY
-----------------
+------+-----------------------------+---------+
| Type | IfcConvert Option | Default |
+======+=============================+=========+
| BOOL | ``--use-element-hierarchy`` | False |
+------+-----------------------------+---------+
.. warning::
Only applicable to Collada .DAE output when used from IfcConvert.
Emit the relative placements from IFC instead of a flat listing of absolute placements.
exclude
-------
+-------------+----------------------------------+---------+
| Type | IfcConvert Option | Default |
+=============+==================================+=========+
| LIST OF OBJ | ``--exclude`` and ``--exclude+`` | NULL |
+-------------+----------------------------------+---------+
By default, all possible geometry in the IFC model is processed. If an exclude
filter is specified, those geometries are excluded. Note that the include and
exclude options are mutually exclusive.
See include for more details.
EXCLUDE_SOLIDS_AND_SURFACES
---------------------------
+------+------------------------------------------------+---------+
| Type | IfcConvert Option | Default |
+======+================================================+=========+
| BOOL | ``--plan`` is used and ``--model`` is not used | False |
+------+------------------------------------------------+---------+
Exclude faces, shells and solids from geometrical output.
FASTER_BOOLEANS
---------------
+------+-------------------------------+---------+
| Type | IfcConvert Option | Default |
+======+===============================+=========+
| BOOL | ``--merge-boolean-operands`` | False |
+------+-------------------------------+---------+
.. warning::
Only applicable when using OCCT 6.9 and earlier.
Fuse the collection of all boolean operands into a single union before applying the boolean subtraction, as opposed to doing individual subtractions. This likely improves performance. From OCCT 7.0 onwards the boolean operations with multiple arguments is used.
GENERATE_UVS
------------
+------+--------------------+---------+
| Type | IfcConvert Option | Default |
+======+====================+=========+
| BOOL | ``--generate-uvs`` | False |
+------+--------------------+---------+
Applies a box projection on the generated geometry for the element to obtain UV coordinates. This is purely generated, it does not involve texture coordinates stored in the IFC model.
::
IfcConvert model.ifc d5.dae --generate-uvs -yv --include attribute GlobalId 2O2Fr$t4X7Zf8NOew3FNr2
.. image:: images/settings-5.png
include
-------
+-------------+----------------------------------+---------+
| Type | IfcConvert Option | Default |
+=============+==================================+=========+
| LIST OF OBJ | ``--include`` and ``--include+`` | NULL |
+-------------+----------------------------------+---------+
By default, all possible geometry in the IFC model is processed. If an include
filter is specified, only geometry from the included elements are processed.
In IfcConvert, this is specified using the following syntaxes:
::
IfcConvert model.ifc out.glb --include=entities IfcWall
IfcConvert model.ifc out.glb --include=layers A-WALL
IfcConvert model.ifc out.glb --include=attribute GlobalId 1VQ5n5$RrEbPk8le4ZCI81
IfcConvert model.ifc out.glb --include=attribute Name Foo
IfcConvert model.ifc out.glb --include=attribute Description Bar
IfcConvert model.ifc out.glb --include=attribute Tag 123456
IfcConvert also allows using ``--include+`` which includes all products
decomposed by that filter. For example, the following filter will process any
element with the attribute Name of Level 1, as well as all child elements. Child
elements include IsDecomposedBy, HasOpenings, FillsVoid, and
ContainedInStructure.
::
IfcConvert model.ifc out.glb --include+=attribute Name "Level 1"
In C++, this is set when the iterator is constructed:
.. code-block:: c++
IfcGeom::Iterator geom_iterator(settings, ifc_file, filter_funcs, num_threads);
In Python, this is set when the iterator is constructed, and requires a list of
IFC entity instances:
.. code-block:: python
iterator = ifcopenshell.geom.iterator(settings, ifc_file, include=ifc_file.by_type("IfcWall"), exclude=None)
INCLUDE_CURVES
--------------
+------+--------------------+---------+
| Type | IfcConvert Option | Default |
+======+====================+=========+
| BOOL | ``--plan`` | False |
+------+--------------------+---------+
Include edge and wire geometries in the geometric output.
LAYERSET_FIRST
--------------
+------+----------------------+---------+
| Type | IfcConvert Option | Default |
+======+======================+=========+
| BOOL | ``--layerset-first`` | False |
+------+----------------------+---------+
When not using APPLY_LAYERSETS, take the first material layer from the set to use as the material for the overall element.
NO_NORMALS
----------
+------+-------------------+---------+
| Type | IfcConvert Option | Default |
+======+===================+=========+
| BOOL | ``--no-normals`` | False |
+------+-------------------+---------+
Do not emit normals on geometric output
NO_WIRE_INTERSECTION_CHECK
--------------------------
+------+----------------------------------+---------+
| Type | IfcConvert Option | Default |
+======+==================================+=========+
| BOOL | ``--no-wire-intersection-check`` | False |
+------+----------------------------------+---------+
Disables wire intersection checks. These checks are done on faces to prevent
self-intersections of face bounds. Self-intersections reduce the reliability of
boolean operations and may lead to crashes.
NO_WIRE_INTERSECTION_TOLERANCE
------------------------------
+------+--------------------------------------+---------+
| Type | IfcConvert Option | Default |
+======+======================================+=========+
| BOOL | ``--no-wire-intersection-tolerance`` | False |
+------+--------------------------------------+---------+
Set wire intersection tolerance to 0. By default the above check is done using a
tolerance criterium. So that when a vertex is a certain epsilon distance away
from an edge this is flagged as an intersection.
num_threads
-----------
+------+-------------------------+---------+
| Type | IfcConvert Option | Default |
+======+=========================+=========+
| INT | ``--threads`` or ``-j`` | 1 |
+------+-------------------------+---------+
Number of parallel processing threads for geometry interpretation.
In C++, this is set when the iterator is constructed:
.. code-block:: c++
IfcGeom::Iterator geom_iterator(settings, ifc_file, filter_funcs, num_threads);
In Python, this is set when the iterator is constructed:
.. code-block:: python
import multiprocessing
iterator = ifcopenshell.geom.iterator(settings, ifc_file, num_threads=multiprocessing.cpu_count())
SEW_SHELLS
----------
+------+---------------------+---------+
| Type | IfcConvert Option | Default |
+======+=====================+=========+
| BOOL | ``--orient-shells`` | False |
+------+---------------------+---------+
Re-orient or sew connected face sets to have a consistent outwards orientation.
SITE_LOCAL_PLACEMENT
--------------------
+------+----------------------------+---------+
| Type | IfcConvert Option | Default |
+======+============================+=========+
| BOOL | ``--site-local-placement`` | False |
+------+----------------------------+---------+
See ``BUILDING_LOCAL_PLACEMENT``, but exclude also the ObjectPlacement of the IfcSite.
STRICT_TOLERANCE
----------------
+------+------------------------+---------+
| Type | IfcConvert Option | Default |
+======+========================+=========+
| BOOL | ``--strict-tolerance`` | False |
+------+------------------------+---------+
Strictly use the tolerance from the IFC model. Typically this value is increased
10-fold to have more reliable boolean subtraction results.
USE_BREP_DATA
-------------
+------+------------------------------------+---------+
| Type | IfcConvert Option | Default |
+======+====================================+=========+
| BOOL | True for SVG, HDF, otherwise False | False |
+------+------------------------------------+---------+
See ``DISABLE_TRIANGULATION``.
USE_PYTHON_OPENCASCADE
----------------------
+------+-------------------+---------+
| Type | IfcConvert Option | Default |
+======+===================+=========+
| BOOL | N/A | False |
+------+-------------------+---------+
.. warning::
Only available in Python when an import of ``OCC.Core.BRepTools`` or ``OCC.BRepTools`` succeeds.
This implies ``USE_WORLD_COORDS`` ``USE_BREP_DATA`` and ``DISABLE_TRIANGULATION``. The serialized TopoDS_Shape of ``USE_BREP_DATA`` is deserialized by Python OpenCASCADE.
USE_WORLD_COORDS
----------------
+------+------------------------+---------+
| Type | IfcConvert Option | Default |
+======+========================+=========+
| BOOL | ``--use-world-coords`` | False |
+------+------------------------+---------+
Apply the ObjectPlacement of the building elements to the geometric output. This is implied when using the Wavefront .OBJ output in IfcConvert. Note that this also eliminates the possibility for geometric elements to point to the same interpreted geometry result.
VALIDATE_QUANTITIES
-------------------
+------+-------------------+---------+
| Type | IfcConvert Option | Default |
+======+===================+=========+
| BOOL | ``--validate`` | False |
+------+-------------------+---------+
Running IfcConvert with ``--validate`` will set a non-zero exit code when ever a log message with severity equal or greater than ERROR has been emitted.
Currently for internal use only. For every building element geometry converted, looks for an associated quantity set where the OwnerHistory's organization name is IfcOpenShell. And looks for the quantities "Total Surface Area", "Volume", "Shape Validation Properties.Surface Genus" and validates these according to the interpreted geometry definition. Emit Logger::Error when calculated values are outside of the tolerance range for the value stored in the model.
WELD_VERTICES
-------------
+------+---------------------+---------------------------------------------+
| Type | IfcConvert Option | Default |
+======+=====================+=============================================+
| BOOL | ``--weld-vertices`` | False in IfcConvert, True in C++ and Python |
+------+---------------------+---------------------------------------------+
.. note::
This setting only affects triangulated output.
Discards normals and joins vertices solely based on position. This is useful when output is to be modified in a modeling application.
>>> import ifcopenshell, ifcopenshell.geom
>>> s = ifcopenshell.geom.settings()
>>> s.set(s.WELD_VERTICES, False)
>>> f = ifcopenshell.open("model.ifc")
>>> c = f["3bXiCStxP6Fgxdej$yc50U"]
>>> shp = ifcopenshell.geom.create_shape(s, c)
>>> shp.geometry.verts
(4.675000000000003, -8.07499999999999, 2.657, 4.674999999999999, -10.24600000000002, 2.657, 6.226000000000004, -8.074999999999996, 2.657, 6.226, -10.24600000000003, 2.657, 4.675000000000003, -8.07499999999999, 2.6, 4.674999999999999, -10.24600000000002, 2.6, 6.226000000000004, -8.074999999999996, 2.6, 6.226, -10.24600000000003, 2.6, 4.674999999999999, -10.24600000000002, 2.657, 4.674999999999999, -10.24600000000002, 2.6, 4.675000000000003, -8.07499999999999, 2.657, 4.675000000000003, -8.07499999999999, 2.6, 6.226, -10.24600000000003, 2.657, 4.674999999999999, -10.24600000000002, 2.657, 6.226, -10.24600000000003, 2.6, 4.674999999999999, -10.24600000000002, 2.6, 6.226000000000004, -8.074999999999996, 2.657, 6.226, -10.24600000000003, 2.657, 6.226000000000004, -8.074999999999996, 2.6, 6.226, -10.24600000000003, 2.6, 4.675000000000003, -8.07499999999999, 2.657, 4.675000000000003, -8.07499999999999, 2.6, 6.226000000000004, -8.074999999999996, 2.657, 6.226000000000004, -8.074999999999996, 2.6)
>>> shp.geometry.normals
(3.059754518198021e-17, 0.0, -1.0, 3.059754518198021e-17, 0.0, -1.0, 3.059754518198021e-17, 0.0, -1.0, 3.059754518198021e-17, 0.0, -1.0, 2.110175529791737e-16, 0.0, -1.0, 2.110175529791737e-16, 0.0, -1.0, 2.110175529791737e-16, 0.0, -1.0, 2.110175529791737e-16, 0.0, -1.0, -1.0, 1.79434333701042e-15, 0.0, -1.0, 1.79434333701042e-15, 0.0, -1.0, 1.79434333701042e-15, 0.0, -1.0, 1.79434333701042e-15, 0.0, 6.8717866127669046e-15, 1.0, 0.0, 6.8717866127669046e-15, 1.0, 0.0, 6.8717866127669046e-15, 1.0, 0.0, 6.8717866127669046e-15, 1.0, 0.0, -1.0, 1.79434333701042e-15, 0.0, -1.0, 1.79434333701042e-15, 0.0, -1.0, 1.79434333701042e-15, 0.0, -1.0, 1.79434333701042e-15, 0.0, 3.4358933063834523e-15, 1.0, 0.0, 3.4358933063834523e-15, 1.0, 0.0, 3.4358933063834523e-15, 1.0, 0.0, 3.4358933063834523e-15, 1.0, 0.0)
>>>
>>> s.set(s.WELD_VERTICES, True)
>>> shp = ifcopenshell.geom.create_shape(s, c)
>>> shp.geometry.verts
(4.675000000000003, -8.07499999999999, 2.657, 4.674999999999999, -10.24600000000002, 2.657, 6.226000000000004, -8.074999999999996, 2.657, 6.226, -10.24600000000003, 2.657, 4.675000000000003, -8.07499999999999, 2.6, 4.674999999999999, -10.24600000000002, 2.6, 6.226000000000004, -8.074999999999996, 2.6, 6.226, -10.24600000000003, 2.6)
>>> shp.geometry.normals
()