Return a BCF viewpoint of an IFC element. This function is cached to speed up the creation of multiple BCF topics regarding the same element. Args: element: The IFC element to point at. Returns: The BCF viewpoint definition.
(element: entity_instance)
| 305 | |
| 306 | |
| 307 | def build_viewpoint(element: entity_instance) -> mdl.VisualizationInfo: |
| 308 | """ |
| 309 | Return a BCF viewpoint of an IFC element. |
| 310 | |
| 311 | This function is cached to speed up the creation of multiple BCF topics regarding the same element. |
| 312 | |
| 313 | Args: |
| 314 | element: The IFC element to point at. |
| 315 | |
| 316 | Returns: |
| 317 | The BCF viewpoint definition. |
| 318 | """ |
| 319 | ifc_file = element.wrapped_data.file |
| 320 | unit_scale = ifcopenshell.util.unit.calculate_unit_scale(ifc_file) |
| 321 | elem_placement = ifcopenshell.util.placement.get_local_placement(element.ObjectPlacement) |
| 322 | elem_placement[:3, 3] *= unit_scale |
| 323 | |
| 324 | return mdl.VisualizationInfo( |
| 325 | guid=str(uuid.uuid4()), |
| 326 | components=build_components(element.GlobalId), |
| 327 | perspective_camera=build_camera(elem_placement), |
| 328 | ) |
| 329 | |
| 330 | |
| 331 | def build_viewpoint_from_position_and_guids(position: NDArray[np.float64], *guids: str) -> mdl.VisualizationInfo: |
no test coverage detected