ifctrano 0.3.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ifctrano
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Package for generating building energy simulation model from IFC
5
5
  License: GPL V3
6
6
  Keywords: BIM,IFC,energy simulation,modelica,building energy simulation,buildings,ideas
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.12
15
15
  Requires-Dist: ifcopenshell (>=0.8.1.post1,<0.9.0)
16
16
  Requires-Dist: open3d (>=0.19.0,<0.20.0)
17
17
  Requires-Dist: shapely (>=2.0.7,<3.0.0)
18
- Requires-Dist: trano (>=0.5.0,<0.6.0)
18
+ Requires-Dist: trano (>=0.6.0,<0.7.0)
19
19
  Requires-Dist: typer (>=0.12.5,<0.13.0)
20
20
  Requires-Dist: vedo (>=2025.5.3,<2026.0.0)
21
21
  Project-URL: Repository, https://github.com/andoludo/ifctrano
@@ -23,33 +23,11 @@ Description-Content-Type: text/markdown
23
23
 
24
24
  # ifctrano - IFC to Energy Simulation Tool
25
25
 
26
+ ---
26
27
  📖 **Full Documentation:** 👉 [ifctrano Docs](https://andoludo.github.io/ifctrano/)
28
+ ---
27
29
 
28
- ```bash
29
- pip install ifctrano
30
- ```
31
-
32
- To check the installation, run the following commands:
33
-
34
- ```bash
35
- ifctrano --help
36
-
37
- ifctrano verify
38
- ```
39
-
40
- # ⚠️ WARNING ⚠️
41
-
42
- **This package is still under construction and is largely a work in progress.**
43
- There are still several aspects that need further development, including:
44
-
45
- - Material and construction extraction
46
- - Slab and roof boundaries
47
- - Systems integration
48
- - Additional validation
49
- - Bug fixes
50
- - ...
51
- -
52
- Help and contribution are more than appreciated! 🚧
30
+ Generate Modelica building models directly from IFC files — with support for simulation, visualization, and multiple libraries.
53
31
 
54
32
  ## Overview
55
33
  ifctrano is yet another **IFC to energy simulation** tool designed to translate **Industry Foundation Classes (IFC)** models into energy simulation models in **Modelica**.
@@ -79,10 +57,104 @@ ifctrano has been tested using open-source IFC files from various repositories:
79
57
  - 🕸️ [Ifc2Graph Test Files](https://github.com/JBjoernskov/Ifc2Graph/tree/main/test_ifc_files)
80
58
  - 🔓 [Open Source BIM](https://github.com/opensourceBIM)
81
59
 
82
- ## Installation & Usage
83
- (Installation and usage instructions will be provided here, depending on the package distribution method.)
60
+ ## 🚀 Installation
61
+
62
+ ### 📦 Install `ifctrano`
63
+
64
+ !!! warning
65
+ Trano requires python 3.9 or higher and docker to be installed on the system.
66
+
67
+
68
+ ifctrano is a Python package that can be installed via pip.
69
+
70
+ ```bash
71
+ pip install ifctrano
72
+ ```
73
+
74
+ ### ✅ Verify Installation
75
+
76
+ Run the following commands to ensure everything is working:
77
+
78
+ ```bash
79
+ ifctrano --help
80
+ ifctrano verify
81
+ ```
82
+
83
+ ---
84
+
85
+ ## 🔧 Optional Dependencies
86
+
87
+ ### 🐳 Docker (for simulation)
88
+
89
+ To enable model simulation using the official OpenModelica Docker image, install Docker Desktop:
90
+
91
+ 👉 [https://docs.docker.com/desktop/](https://docs.docker.com/desktop/)
92
+
93
+ Required for using the `--simulate-model` flag.
94
+
95
+ ---
84
96
 
97
+ ### 🧠 Graphviz (for layout visualization)
98
+
99
+ `ifctrano` leverages Graphviz to optimize component layout in generated Modelica models. It is optional, but **recommended**.
100
+
101
+ #### 📥 Install on Windows
102
+
103
+ - Download and install from: [https://graphviz.org/download/](https://graphviz.org/download/)
104
+ - Add the Graphviz `bin` folder to your **system `PATH`**.
105
+
106
+ #### 🐧 Install on Linux
107
+
108
+ ```bash
109
+ sudo apt update
110
+ sudo apt install graphviz
111
+ ```
112
+
113
+ ---
114
+
115
+ ## ⚙️ Usage
116
+
117
+ ### 📁 Generate Modelica models from IFC
118
+
119
+ #### 🏢 Using the **Buildings** library
120
+
121
+ ```bash
122
+ ifctrano create /path/to/your.ifc
123
+ ```
124
+
125
+ #### 🏫 Using the **IDEAS** library
126
+
127
+ ```bash
128
+ ifctrano create /path/to/your.ifc IDEAS
129
+ ```
130
+
131
+ #### 🧮 Using the **Reduced Order** library
132
+
133
+ ```bash
134
+ ifctrano create /path/to/your.ifc reduced_order
135
+ ```
136
+
137
+ ---
138
+
139
+ ### 🧱 Show Space Boundaries
140
+
141
+ To visualize the computed space boundaries:
142
+
143
+ ```bash
144
+ ifctrano create /path/to/your.ifc --show-space-boundaries
145
+ ```
146
+
147
+ ---
148
+
149
+ ### 🔁 Simulate the Model
150
+
151
+ Run a full simulation after model generation:
152
+
153
+ ```bash
154
+ ifctrano create /path/to/your.ifc --simulate-model
155
+ ```
85
156
 
157
+ Make sure Docker is installed and running before simulating.
86
158
 
87
159
  ---
88
160
  💡 **ifctrano** aims to make energy simulation model generation from IFC files **simpler, more accessible, and less reliant on incomplete IFC attributes**. 🚀
@@ -1,32 +1,10 @@
1
1
  # ifctrano - IFC to Energy Simulation Tool
2
2
 
3
+ ---
3
4
  📖 **Full Documentation:** 👉 [ifctrano Docs](https://andoludo.github.io/ifctrano/)
5
+ ---
4
6
 
5
- ```bash
6
- pip install ifctrano
7
- ```
8
-
9
- To check the installation, run the following commands:
10
-
11
- ```bash
12
- ifctrano --help
13
-
14
- ifctrano verify
15
- ```
16
-
17
- # ⚠️ WARNING ⚠️
18
-
19
- **This package is still under construction and is largely a work in progress.**
20
- There are still several aspects that need further development, including:
21
-
22
- - Material and construction extraction
23
- - Slab and roof boundaries
24
- - Systems integration
25
- - Additional validation
26
- - Bug fixes
27
- - ...
28
- -
29
- Help and contribution are more than appreciated! 🚧
7
+ Generate Modelica building models directly from IFC files — with support for simulation, visualization, and multiple libraries.
30
8
 
31
9
  ## Overview
32
10
  ifctrano is yet another **IFC to energy simulation** tool designed to translate **Industry Foundation Classes (IFC)** models into energy simulation models in **Modelica**.
@@ -56,10 +34,104 @@ ifctrano has been tested using open-source IFC files from various repositories:
56
34
  - 🕸️ [Ifc2Graph Test Files](https://github.com/JBjoernskov/Ifc2Graph/tree/main/test_ifc_files)
57
35
  - 🔓 [Open Source BIM](https://github.com/opensourceBIM)
58
36
 
59
- ## Installation & Usage
60
- (Installation and usage instructions will be provided here, depending on the package distribution method.)
37
+ ## 🚀 Installation
38
+
39
+ ### 📦 Install `ifctrano`
40
+
41
+ !!! warning
42
+ Trano requires python 3.9 or higher and docker to be installed on the system.
43
+
44
+
45
+ ifctrano is a Python package that can be installed via pip.
46
+
47
+ ```bash
48
+ pip install ifctrano
49
+ ```
50
+
51
+ ### ✅ Verify Installation
52
+
53
+ Run the following commands to ensure everything is working:
54
+
55
+ ```bash
56
+ ifctrano --help
57
+ ifctrano verify
58
+ ```
59
+
60
+ ---
61
+
62
+ ## 🔧 Optional Dependencies
63
+
64
+ ### 🐳 Docker (for simulation)
65
+
66
+ To enable model simulation using the official OpenModelica Docker image, install Docker Desktop:
67
+
68
+ 👉 [https://docs.docker.com/desktop/](https://docs.docker.com/desktop/)
69
+
70
+ Required for using the `--simulate-model` flag.
71
+
72
+ ---
61
73
 
74
+ ### 🧠 Graphviz (for layout visualization)
75
+
76
+ `ifctrano` leverages Graphviz to optimize component layout in generated Modelica models. It is optional, but **recommended**.
77
+
78
+ #### 📥 Install on Windows
79
+
80
+ - Download and install from: [https://graphviz.org/download/](https://graphviz.org/download/)
81
+ - Add the Graphviz `bin` folder to your **system `PATH`**.
82
+
83
+ #### 🐧 Install on Linux
84
+
85
+ ```bash
86
+ sudo apt update
87
+ sudo apt install graphviz
88
+ ```
89
+
90
+ ---
91
+
92
+ ## ⚙️ Usage
93
+
94
+ ### 📁 Generate Modelica models from IFC
95
+
96
+ #### 🏢 Using the **Buildings** library
97
+
98
+ ```bash
99
+ ifctrano create /path/to/your.ifc
100
+ ```
101
+
102
+ #### 🏫 Using the **IDEAS** library
103
+
104
+ ```bash
105
+ ifctrano create /path/to/your.ifc IDEAS
106
+ ```
107
+
108
+ #### 🧮 Using the **Reduced Order** library
109
+
110
+ ```bash
111
+ ifctrano create /path/to/your.ifc reduced_order
112
+ ```
113
+
114
+ ---
115
+
116
+ ### 🧱 Show Space Boundaries
117
+
118
+ To visualize the computed space boundaries:
119
+
120
+ ```bash
121
+ ifctrano create /path/to/your.ifc --show-space-boundaries
122
+ ```
123
+
124
+ ---
125
+
126
+ ### 🔁 Simulate the Model
127
+
128
+ Run a full simulation after model generation:
129
+
130
+ ```bash
131
+ ifctrano create /path/to/your.ifc --simulate-model
132
+ ```
62
133
 
134
+ Make sure Docker is installed and running before simulating.
63
135
 
64
136
  ---
65
137
  💡 **ifctrano** aims to make energy simulation model generation from IFC files **simpler, more accessible, and less reliant on incomplete IFC attributes**. 🚀
@@ -0,0 +1,8 @@
1
+ import warnings
2
+
3
+ warnings.filterwarnings("ignore", category=RuntimeWarning)
4
+ warnings.filterwarnings(
5
+ "ignore",
6
+ message=".*Pydantic serializer warnings.*",
7
+ category=UserWarning,
8
+ )
@@ -1,5 +1,6 @@
1
1
  import json
2
2
  import math
3
+ import sys
3
4
  from itertools import combinations
4
5
  from multiprocessing import Process
5
6
  from pathlib import Path
@@ -54,6 +55,9 @@ class BaseShow(BaseModel):
54
55
  def description(self) -> Any: ... # noqa: ANN401
55
56
 
56
57
  def show(self, interactive: bool = True) -> None:
58
+ if sys.platform == "win32":
59
+ _show(self.lines(), interactive)
60
+ return
57
61
  p = Process(target=_show, args=(self.lines(), interactive))
58
62
  p.start()
59
63
 
@@ -14,7 +14,7 @@ from pydantic import (
14
14
  Field,
15
15
  ConfigDict,
16
16
  )
17
- from scipy.spatial import ConvexHull # type: ignore
17
+ from scipy.spatial import ConvexHull, QhullError # type: ignore
18
18
  from vedo import Line # type: ignore
19
19
 
20
20
  from ifctrano.base import (
@@ -190,8 +190,14 @@ class OrientedBoundingBox(BaseShow):
190
190
  entity_shape, entity_shape.geometry # type: ignore
191
191
  )
192
192
  vertices_ = Vertices.from_arrays(np.asarray(vertices))
193
- hull = ConvexHull(vertices_.to_array())
194
- vertices_ = Vertices.from_arrays(vertices_.to_array()[hull.vertices])
193
+ try:
194
+ hull = ConvexHull(vertices_.to_array())
195
+ vertices_ = Vertices.from_arrays(vertices_.to_array()[hull.vertices])
196
+
197
+ except QhullError:
198
+ logger.error(
199
+ f"Convex hull failed for {entity.GlobalId} ({entity.is_a()}).... Continuing without it."
200
+ )
195
201
  points_ = open3d.utility.Vector3dVector(vertices_.to_array())
196
202
  aab = open3d.geometry.AxisAlignedBoundingBox.create_from_points(points_)
197
203
  return cls.from_vertices(aab.get_box_points(), entity)
@@ -189,9 +189,9 @@ class Constructions(BaseModel):
189
189
  def get_construction(self, entity: entity_instance) -> Construction:
190
190
  construction_id = self._get_construction_id(entity)
191
191
  if construction_id is None:
192
- logger.error(
193
- f"Construction ID not found for {entity.GlobalId} ({entity.is_a()}) "
194
- f"({entity.Name}). Using default construction."
192
+ logger.warning(
193
+ f"Construction ID not found for {entity.GlobalId} ({entity.is_a()}). "
194
+ f"Using default construction."
195
195
  )
196
196
  return default_construction
197
197
  constructions = [
@@ -210,11 +210,11 @@ class Constructions(BaseModel):
210
210
  if association.is_a() == "IfcRelAssociatesMaterial"
211
211
  ]
212
212
  if not associates_materials:
213
- logger.error(f"Associate materials not found for {entity.GlobalId}.")
213
+ logger.warning(f"Associate materials not found for {entity.GlobalId}.")
214
214
  return None
215
215
  relating_material = associates_materials[0].RelatingMaterial
216
216
  if relating_material.is_a() == "IfcMaterialList":
217
- logger.error(
217
+ logger.warning(
218
218
  f"Material list found for {entity.GlobalId}, but no construction ID available."
219
219
  )
220
220
  return None
@@ -15,6 +15,7 @@ from trano.utils.utils import is_success # type: ignore
15
15
  from ifctrano.base import Libraries
16
16
  from ifctrano.building import Building
17
17
  from ifctrano.exceptions import InvalidLibraryError
18
+ from rich import print
18
19
 
19
20
  app = typer.Typer()
20
21
  CHECKMARK = "[green]✔[/green]"
@@ -34,11 +35,11 @@ def create(
34
35
  show_space_boundaries: Annotated[
35
36
  bool,
36
37
  typer.Option(help="Show computed space boundaries."),
37
- ] = True,
38
+ ] = False,
38
39
  simulate_model: Annotated[
39
40
  bool,
40
41
  typer.Option(help="Simulate the generated model."),
41
- ] = True,
42
+ ] = False,
42
43
  ) -> None:
43
44
  with Progress(
44
45
  SpinnerColumn(),
@@ -66,12 +67,16 @@ def create(
66
67
  print(f"{CHECKMARK} Model generated at {modelica_model_path}")
67
68
  if simulate_model:
68
69
  print("Simulating...")
69
- results = simulate(
70
- modelica_model_path.parent,
71
- building.create_network(
72
- library=library # type: ignore
73
- ), # TODO: cannot use the network after cretingt he model
74
- )
70
+ try:
71
+ results = simulate(
72
+ modelica_model_path.parent,
73
+ building.create_network(
74
+ library=library # type: ignore
75
+ ), # TODO: cannot use the network after creating he model
76
+ )
77
+ except Exception as e:
78
+ print(f"{CROSS_MARK} Simulation failed: {e}")
79
+ return
75
80
  if not is_success(results):
76
81
  print(f"{CROSS_MARK} Simulation failed. See logs for more information.")
77
82
  return
@@ -24,7 +24,12 @@ from ifctrano.base import (
24
24
  from ifctrano.bounding_box import OrientedBoundingBox
25
25
  from ifctrano.construction import glass, Constructions
26
26
  from ifctrano.exceptions import HasWindowsWithoutWallsError
27
- from ifctrano.utils import remove_non_alphanumeric, _round, get_building_elements
27
+ from ifctrano.utils import (
28
+ remove_non_alphanumeric,
29
+ _round,
30
+ get_building_elements,
31
+ short_uuid,
32
+ )
28
33
 
29
34
  ROOF_VECTOR = Vector(x=0, y=0, z=1)
30
35
 
@@ -175,7 +180,10 @@ class SpaceBoundary(BaseModelConfig):
175
180
  return hash(self.common_surface)
176
181
 
177
182
  def boundary_name(self) -> str:
178
- return f"{self.entity.is_a()}_{remove_non_alphanumeric(self.entity.GlobalId)}"
183
+ return (
184
+ f"{remove_non_alphanumeric(self.entity.Name) or self.entity.is_a().lower()}_"
185
+ f"__{remove_non_alphanumeric(self.entity.GlobalId)}{short_uuid()}"
186
+ )
179
187
 
180
188
  def model_element( # noqa: PLR0911
181
189
  self,
@@ -1,4 +1,6 @@
1
+ import random
1
2
  import re
3
+ import string
2
4
  import uuid
3
5
  from typing import get_args
4
6
 
@@ -13,6 +15,12 @@ def remove_non_alphanumeric(text: str) -> str:
13
15
  return re.sub(r"[^a-zA-Z0-9_]", "", text).lower()
14
16
 
15
17
 
18
+ def short_uuid() -> str:
19
+ return "".join(
20
+ random.choices(string.ascii_letters + string.digits, k=3) # noqa: S311
21
+ )
22
+
23
+
16
24
  def generate_alphanumeric_uuid() -> str:
17
25
  return str(uuid.uuid4().hex).lower()
18
26
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ifctrano"
3
- version = "0.3.0"
3
+ version = "0.4.0"
4
4
  description = "Package for generating building energy simulation model from IFC"
5
5
  authors = ["Ando Andriamamonjy <andoludovic.andriamamonjy@gmail.com>"]
6
6
  license = "GPL V3"
@@ -11,7 +11,7 @@ keywords = ["BIM","IFC","energy simulation", "modelica", "building energy simula
11
11
  [tool.poetry.dependencies]
12
12
  python = ">=3.10,<3.13"
13
13
  ifcopenshell = "^0.8.1.post1"
14
- trano = "^0.5.0"
14
+ trano = "^0.6.0"
15
15
  shapely = "^2.0.7"
16
16
  typer = "^0.12.5"
17
17
  vedo = "^2025.5.3"
@@ -1,3 +0,0 @@
1
- import warnings
2
-
3
- warnings.filterwarnings("ignore", category=RuntimeWarning)
File without changes
File without changes
File without changes