bcf.v2.topic#

BCF XML V2 Topic handler.

Module Contents#

class bcf.v2.topic.TopicHandler(topic_dir: Optional[zipfile.Path] = None, xml_handler: Optional[bcf.xml_parser.AbstractXmlParserSerializer] = None)#

BCF Topic and related objects handler.

__eq__(self, other: object) bool | NoReturn#

Return self==value.

_load_bim_snippet(self) Optional[bytes]#
_load_viewpoints(self) dict[str, bcf.v2.visinfo.VisualizationInfoHandler]#
_save_bim_snippet(self, destination_zip: bcf.inmemory_zipfile.ZipFileInterface) None#
_save_document_references(self, destination_zip: bcf.inmemory_zipfile.ZipFileInterface) None#
_save_reference_files(self, destination_zip: bcf.inmemory_zipfile.ZipFileInterface) None#
_save_viewpoints(self, destination_zip: bcf.inmemory_zipfile.ZipFileInterface, topic_dir: str) None#
_save_xml(self, destination_zip: bcf.inmemory_zipfile.ZipFileInterface, item: Any, target: str) None#
add_viewpoint(self, element: ifcopenshell.entity_instance) None#

Add a viewpoint pointed at the placement of an IFC element to the topic.

Args:

element: The IFC element.

add_viewpoint_from_point_and_guids(self, position: numpy.typing.NDArray[numpy.float_], *guids: str) None#

Add a viewpoint pointing at an XYZ point in space

Args:

position: the XYZ point in space guids: one or more element GlobalIds.

add_visinfo_handler(self, new_viewpoint: bcf.v2.visinfo.VisualizationInfoHandler) None#
property bim_snippet(self) Optional[bytes]#
property comments(self) list[bcf.v2.model.Comment]#

Return the comments of the topic.

classmethod create_new(cls, title: str, description: str, author: str, topic_type: str = '', topic_status: str = '', xml_handler: Optional[bcf.xml_parser.AbstractXmlParserSerializer] = None) TopicHandler#

Create a new BCF topic.

Args:

title: The title of the topic. description: The description of the topic. author: The author of the topic. topic_type: The type of the topic. topic_status: The status of the topic. xml_handler: The XML parser/serializer to use.

Returns:

The BCF topic definition.

property document_references(self) dict[str, bytes]#
extract_file(self, entity, outfile: Optional[pathlib.Path] = None) pathlib.Path#

Extracts an element with a file into a temporary directory

These include header files, bim snippets, document references, and viewpoint bitmaps. External reference are not downloaded. Instead, the URI reference is returned.

Parameters
  • entity (bcf.v2.model.HeaderFile,bcf.v2.model.BimSnippet,bcf.v2.model.TopicDocumentReference) – The entity with a file reference to extract

  • outfile (pathlib.Path,optional) – If provided, save the header file to that location. Otherwise, a temporary directory is created and the filename is derived from the header’s original filename.

Returns

The filepath of the extracted file. It may be a URL if the header file is external.

Return type

Path

property guid(self) str#

Return the GUID of the topic.

property header(self) Optional[bcf.v2.model.Header]#

Return the header of the topic.

property markup(self) Optional[bcf.v2.model.Markup]#
property reference_files(self) dict[str, bytes]#
save(self, destination_zip: bcf.inmemory_zipfile.ZipFileInterface) None#

Save the topic to a BCF zip file.

Args:

bcf_zip: The BCF zip file to save to.

property topic(self) bcf.v2.model.Topic#

Return the Topic object.

property viewpoints(self) dict[str, bcf.v2.visinfo.VisualizationInfoHandler]#