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

Class file

src/ifcopenshell-python/ifcopenshell/file.py:526–1072  ·  view source on GitHub ↗

Base class for containing IFC files. Class has instance methods for filtering by element Id, Type, etc. Instantiated objects can be subscripted by Id or Guid Example: .. code:: python model = ifcopenshell.open(file_path) products = model.by_type("IfcProduct")

Source from the content-addressed store, hash-verified

524
525
526class file:
527 """Base class for containing IFC files.
528
529 Class has instance methods for filtering by element Id, Type, etc.
530 Instantiated objects can be subscripted by Id or Guid
531
532 Example:
533
534 .. code:: python
535
536 model = ifcopenshell.open(file_path)
537 products = model.by_type("IfcProduct")
538 print(products[0].id(), products[0].GlobalId) # 122 2XQ$n5SLP5MBLyL442paFx
539 print(products[0] == model[122] == model["2XQ$n5SLP5MBLyL442paFx"]) # True
540 """
541
542 wrapped_data: ifcopenshell_wrapper.file
543 units: dict[str, entity_instance] = {}
544 history_size: int = 64
545 history: list[Transaction]
546 """Chronological order - from oldest to newest."""
547 future: list[Transaction]
548 """Reversed chronological order - from newest to oldest."""
549
550 to_delete: Union[set[ifcopenshell.entity_instance], None] = None
551 """Entities for batch removal."""
552
553 def __init__(
554 self,
555 f: Optional[ifcopenshell_wrapper.file] = None,
556 schema: Optional[ifcopenshell.util.schema.IFC_SCHEMA] = None,
557 schema_version: Optional[tuple[int, int, int, int]] = None,
558 ):
559 """Create a new blank IFC model
560
561 This IFC model does not have any entities in it yet. See the
562 ``create_entity`` function for how to create new entities. All data is
563 stored in memory. If you wish to write the IFC model to disk, see the
564 ``write`` function.
565
566 :param f: The underlying IfcOpenShell file object to be wrapped. This
567 is an internal implementation detail and should generally be left
568 as None by users.
569 :param schema: Which IFC schema to use, chosen from "IFC2X3", "IFC4",
570 or "IFC4X3". These refer to the ISO approved versions of IFC.
571 Defaults to "IFC4" if not specified, which is currently recommended
572 for all new projects.
573 :param schema_version: If you want to specify an exact version of IFC
574 that may not be an ISO approved version, use this argument instead
575 of ``schema``. IFC versions on technical.buildingsmart.org are
576 described using 4 integers representing the major, minor, addendum,
577 and corrigendum number. For example, (4, 0, 2, 1) refers to IFC4
578 ADD2 TC1, which is the official version approved by ISO when people
579 refer to "IFC4". Generally you should not use this argument unless
580 you are testing non-ISO IFC releases.
581
582 Example:
583

Callers 2

openFunction · 0.90
from_stringMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected