MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / build_viewpoint

Function build_viewpoint

src/bcf/bcf/v2/visinfo.py:307–328  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

305
306
307def 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
331def build_viewpoint_from_position_and_guids(position: NDArray[np.float64], *guids: str) -> mdl.VisualizationInfo:

Callers 1

create_newMethod · 0.70

Calls 3

calculate_unit_scaleMethod · 0.80
build_componentsFunction · 0.70
build_cameraFunction · 0.70

Tested by

no test coverage detected