Skip to content

Commit

Permalink
document
Browse files Browse the repository at this point in the history
  • Loading branch information
Licini committed Jun 13, 2024
1 parent c4a60e1 commit 0589f06
Show file tree
Hide file tree
Showing 22 changed files with 38,954 additions and 219 deletions.
38,907 changes: 38,907 additions & 0 deletions data/Duplex_A_20110907.ifc

Large diffs are not rendered by default.

Binary file removed docs/_images/attribute_tree.png
Binary file not shown.
Binary file removed docs/_images/element.png
Binary file not shown.
Binary file modified docs/_images/element_view.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/_images/ifc_viewer.jpg
Binary file not shown.
Binary file modified docs/_images/model_view.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/_images/opening.png
Binary file not shown.
Binary file removed docs/_images/spatial_tree.png
Binary file not shown.
Binary file removed docs/_images/viewer.png
Binary file not shown.
Binary file added docs/_images/visualisation.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/_images/wall_section.jpg
Binary file not shown.
17 changes: 4 additions & 13 deletions docs/examples/3.1_model_view.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,16 @@
3.1 Model View
*******************************************************************************

This example shows how to load an IFC file and display it in compas_view2.
This example shows how to load an IFC file and display it in compas_viewer.

.. code-block:: python
from compas_viewer import Viewer
from compas_ifc.model import Model
model = Model("data/wall-with-opening-and-window.ifc")
viewer = Viewer()
for entity in model.get_entities_by_type("IfcBuildingElement"):
print("Converting to brep:", entity)
print(entity.body_with_opening)
viewer.add(entity.body_with_opening, name=entity.name)
viewer.show()
model = Model("data/Duplex_A_20110907.ifc")
model.show()
Example Output:

.. image:: ../_images/viewer.png
.. image:: ../_images/model_view.jpg
:width: 100%
14 changes: 3 additions & 11 deletions docs/examples/3.2_element_view.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,11 @@ This example shows how to load an IFC file and display selected element in compa

.. code-block:: python
from compas_viewer import Viewer
from compas_ifc.model import Model
model = Model("data/wall-with-opening-and-window.ifc")
viewer = Viewer()
model = Model("data/Duplex_A_20110907.ifc")
model.get_entities_by_type("IfcWindow")[0].show()
for entity in model.get_entities_by_type("IfcWall"):
print("Converting to brep:", entity)
print(entity.body_with_opening)
viewer.add(entity.body_with_opening, name=entity.name)
viewer.show()
.. image:: ../_images/element.png
.. image:: ../_images/element_view.jpg
:width: 100%
30 changes: 0 additions & 30 deletions docs/examples/3.3_opening.rst

This file was deleted.

41 changes: 9 additions & 32 deletions docs/examples/4.2_create_new.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
*******************************************************************************
4.1 Create New (In Progess)
4.1 Create New
*******************************************************************************

This example shows how to insert new geometry into an existing IFC model and how to create a new IFC model from scratch.
This example shows how to create a new IFC model from scratch.

.. code-block:: python
Expand All @@ -14,39 +14,16 @@ This example shows how to insert new geometry into an existing IFC model and how
from compas_ifc.model import Model
model = Model("data/wall-with-opening-and-window.ifc")
model = Model.template(storey_count=1)
print("\n" + "*" * 53)
print("Create Geometry Examples")
print("*" * 53 + "\n")
print("\nInsert geometry into existing model")
print("=" * 53 + "\n")
building_storey = model.get_entities_by_type("IfcBuildingStorey")[0]
size = 1 / model.project.length_scale
box = Box.from_width_height_depth(size, size, size)
inserted_element = model.insert(box, parent=building_storey, name="Box", description="This is a box")
print("Inserted element: ", inserted_element)
model.save("temp/insert_geometry.ifc")
print("\nCreate IFC from scrach")
print("=" * 53 + "\n")
model = Model()
box = Box.from_width_height_depth(5, 5, 5)
box = Box.from_width_height_depth(5, 5, 0.5)
sphere = Sphere(2, Frame([10, 0, 0]))
mesh = Mesh.from_obj(compas.get("tubemesh.obj"))
# A minimal hierarchy will be created if parent is not specified
element1 = model.insert(box, name="Box")
element2 = model.insert(sphere, name="Sphere")
element3 = model.insert(mesh, name="Mesh")
storey = model.building_storeys[0]
print("Inserted elements: ", element1, element2, element3)
element1 = model.create("IfcWall", geometry=box, frame=Frame([0, 0, 0]), Name="Wall", parent=storey)
element3 = model.create("IfcRoof", geometry=mesh, frame=Frame([0, 0, 0]), Name="Roof", parent=storey)
element2 = model.create(geometry=sphere, frame=Frame([5, 0, 0]), Name="Sphere", parent=storey)
model.save("temp/create_geometry.ifc")
model.save("temp/create_geometry.ifc")
46 changes: 0 additions & 46 deletions docs/examples/5.1_custom_viewer.rst

This file was deleted.

46 changes: 0 additions & 46 deletions docs/examples/5.2_attribute_form.rst

This file was deleted.

16 changes: 6 additions & 10 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,20 @@
Installation
********************************************************************************

Install with conda (required)
================================

Create an environment named ``research`` and install COMPAS from the package channel ``conda-forge``.
A minimal version of COMPAS IFC can be installed directly with pip.

.. code-block:: bash
conda create -n ifc -c conda-forge compas compas_occ
pip install compas_ifc
Activate the environment.
If you want to visualize the IFC model, install COMPAS Viewer as well.

.. code-block:: bash
conda activate ifc
pip install compas_viewer
Install compas_ifc and optionally compas_viewer.
If you need to interact with IFC geometry using OCC Brep, install COMPAS OCC as well.

.. code-block:: bash
pip install compas_ifc compas_viewer
conda install compas_occ
30 changes: 22 additions & 8 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ Load IFC model

::

>>> import os
>>> from compas_ifc.model import Model
>>> model = Model("wall-with-opening-and-window.ifc")
>>> model = Model("data/wall-with-opening-and-window.ifc")
Opened file: d:\Github\compas_ifc\scripts\..\data\wall-with-opening-and-window.ifc
>>> print(model.schema)
<schema IFC4>
Expand Down Expand Up @@ -77,16 +76,31 @@ You can also inspect the spatial hierarchy of the model. For example, you can ge
>>> print("children", wall.children)
children: []

For geomtric information, you can use the ``body`` property of an entity. This will extract the representation of the entity (if exists) as a ``compas_occ BRep``.
For geomtric information, you can use the ``geometry`` property of an entity, if you have ``compas_occ`` installed, the geometry will be in form of ``Brep``.

::
>>> brep = wall.body[0]
>>> print(brep)
>>> geometry = wall.geometry
>>> print(geometry)
<compas_occ.brep.brep.BRep object at 0x000001F7480C97F0>
>>> print(brep.is_solid)
>>> print(geometry.is_solid)
True
>>> print(brep.volume)
>>> print(geometry.volume)
1.8

For more in-depth tutorials, please head to the next *Examples* section.



Visualisation
================================

If you have ``compas_viewer`` installed, you can visualize the model using the ``model.show()`` function.

::

>>> model.show()

.. image:: _images/visualisation.jpg
:width: 100%

For more in-depth tutorials, please head to the next *Examples* section.
2 changes: 1 addition & 1 deletion scripts/3.1_model_view.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from compas_ifc.model import Model

model = Model("data/wall-with-opening-and-window.ifc")
model = Model("data/Duplex_A_20110907.ifc")
model.show()
4 changes: 2 additions & 2 deletions scripts/3.2_element_view.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from compas_ifc.model import Model

model = Model("data/wall-with-opening-and-window.ifc")
model.get_entities_by_type("IfcWall")[0].show()
model = Model("data/Duplex_A_20110907.ifc")
model.get_entities_by_type("IfcWindow")[0].show()
20 changes: 0 additions & 20 deletions scripts/3.4_wall_sections.py

This file was deleted.

0 comments on commit 0589f06

Please sign in to comment.