|
22 | 22 | import sectionproperties.pre.pre as pre |
23 | 23 | import sectionproperties.pre.bisect_section as bisect |
24 | 24 | import sectionproperties.post.post as post |
25 | | -import sectionproperties.pre.rhino as rhino_importer |
26 | 25 |
|
27 | 26 |
|
28 | 27 | class Geometry: |
@@ -262,6 +261,16 @@ def from_3dm(cls, filepath: Union[str, pathlib.Path], **kwargs) -> Geometry: |
262 | 261 | If true, all non parallel surfaces are filtered out. |
263 | 262 | Default is False. |
264 | 263 | """ |
| 264 | + try: |
| 265 | + import sectionproperties.pre.rhino as rhino_importer # type: ignore |
| 266 | + except ImportError as e: |
| 267 | + print(e) |
| 268 | + print( |
| 269 | + "There is something wrong with your rhino library installation. " |
| 270 | + "Please report this error at https://github.com/robbievanleeuwen/section-properties/issues" |
| 271 | + ) |
| 272 | + return |
| 273 | + |
265 | 274 | geom = None |
266 | 275 | list_poly = rhino_importer.load_3dm(filepath, **kwargs) |
267 | 276 | if len(list_poly) == 1: |
@@ -313,6 +322,15 @@ def from_rhino_encoding(cls, r3dm_brep: str, **kwargs) -> Geometry: |
313 | 322 | If true, all non parallel surfaces are filtered out. |
314 | 323 | Default is False. |
315 | 324 | """ |
| 325 | + try: |
| 326 | + import sectionproperties.pre.rhino as rhino_importer # type: ignore |
| 327 | + except ImportError as e: |
| 328 | + print(e) |
| 329 | + print( |
| 330 | + "There is something wrong with your rhino library installation. " |
| 331 | + "Please report this error at https://github.com/robbievanleeuwen/section-properties/issues" |
| 332 | + ) |
| 333 | + return |
316 | 334 | return cls(geom=rhino_importer.load_brep_encoding(r3dm_brep, **kwargs)[0]) |
317 | 335 |
|
318 | 336 | def create_facets_and_control_points(self): |
@@ -1320,6 +1338,15 @@ def from_3dm(cls, filepath: Union[str, pathlib.Path], **kwargs) -> CompoundGeome |
1320 | 1338 | If true, all non parallel surfaces are filtered out. |
1321 | 1339 | Default is False. |
1322 | 1340 | """ |
| 1341 | + try: |
| 1342 | + import sectionproperties.pre.rhino as rhino_importer # type: ignore |
| 1343 | + except ImportError as e: |
| 1344 | + print(e) |
| 1345 | + print( |
| 1346 | + "There is something wrong with your rhino library installation. " |
| 1347 | + "Please report this error at https://github.com/robbievanleeuwen/section-properties/issues" |
| 1348 | + ) |
| 1349 | + return |
1323 | 1350 | list_poly = rhino_importer.load_3dm(filepath, **kwargs) |
1324 | 1351 | return cls(geoms=MultiPolygon(list_poly)) |
1325 | 1352 |
|
|
0 commit comments