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

Function load

src/bcf/bcf/bcfxml.py:35–54  ·  view source on GitHub ↗

Load a BCF file. Args: filepath: The path to the BCF file. Returns: The loaded BCF file. Raises: ValueError: If the BCF version is not supported.

(filepath: Path, xml_handler: Optional[AbstractXmlParserSerializer] = None)

Source from the content-addressed store, hash-verified

33
34
35def load(filepath: Path, xml_handler: Optional[AbstractXmlParserSerializer] = None) -> Optional[BcfXml]:
36 """
37 Load a BCF file.
38
39 Args:
40 filepath: The path to the BCF file.
41
42 Returns:
43 The loaded BCF file.
44
45 Raises:
46 ValueError: If the BCF version is not supported.
47 """
48 xml_handler = xml_handler or XmlParserSerializer()
49 version_id = _get_version(filepath, xml_handler)
50 if version_id in {"2.1", "2.0"}:
51 return BcfXml2.load(filepath, xml_handler)
52 if version_id == "3.0":
53 return BcfXml3.load(filepath, xml_handler)
54 raise ValueError(f"Version {version_id} not supported.")
55
56
57def _get_version(filepath: Union[str, Path], xml_handler: Optional[AbstractXmlParserSerializer] = None) -> str:

Callers 3

loadMethod · 0.85
readMethod · 0.85
export_odsMethod · 0.85

Calls 3

XmlParserSerializerClass · 0.90
_get_versionFunction · 0.85
loadMethod · 0.45

Tested by

no test coverage detected