This commit is contained in:
Andrej
2025-06-04 19:49:35 +05:00
parent 5af7c9a32d
commit 87265d052b
14 changed files with 212 additions and 90 deletions
@@ -260,7 +260,7 @@ def schema_by_name(
return ifcopenshell_wrapper.schema_by_name(schema)
def guess_format(path: Path) -> Union[str, None]:
def guess_format(path: Path) -> Literal[".ifc", ".ifcZIP", ".ifcXML", ".ifcJSON", ".ifcSQLite", None]:
"""Guesses the IFC format using file extension
IFCs may be serialised as different formats. The most common is a ``.ifc``
@@ -273,8 +273,6 @@ def guess_format(path: Path) -> Union[str, None]:
Users generally won't call this function. The :func:`open` function uses
this internally to guess the file format.
:return: Either .ifc, .ifcZIP, .ifcXML, .ifcJSON, .ifcSQLite, or None.
"""
suffix = path.suffix.lower()
if suffix == ".ifc":
@@ -127,7 +127,7 @@ class BRep(Representation):
class BRepElement(Element):
def calculate_projected_surface_area(self, along_x, along_y, along_z): ...
@property
def geometry(self): ...
def geometry(self) -> BRep: ...
def geometry_pointer(self): ...
@property
def surface_area(self): ...
@@ -361,7 +361,7 @@ class Serialization(Representation):
class SerializedElement(Element):
@property
def geometry(self): ...
def geometry(self) -> Serialization: ...
class SerializerSettings:
def get_(self, name): ...
@@ -744,7 +744,7 @@ class ellipse(curve):
def matrix(self): ...
class entity(declaration):
def all_attributes(self): ...
def all_attributes(self) -> tuple[attribute, ...]: ...
def all_inverse_attributes(self): ...
def argument_types(self): ...
def as_entity(self): ...
@@ -1127,10 +1127,10 @@ class revolve(sweep):
class schema_definition:
def declaration_by_name(self, *args: str) -> declaration: ...
def declarations(self) -> tuple[declaration, ...]: ...
def entities(self): ...
def entities(self) -> tuple[entity, ...]: ...
def enumeration_types(self): ...
def instantiate(self, decl, data): ...
def name(self): ...
def name(self) -> str: ...
def select_types(self): ...
def type_declarations(self): ...
@@ -1446,7 +1446,7 @@ def polygons_to_svg(*args): ...
def read(data): ...
def register_schema(arg1): ...
def schema_by_name(arg1: str) -> schema_definition: ...
def schema_names(): ...
def schema_names() -> tuple[str, ...]: ...
def serialise(schema_name, shape_str, advanced): ...
def set_feature(x, v): ...
def set_log_format_json(): ...
@@ -1455,6 +1455,6 @@ def svg_to_line_segments(data, class_name): ...
def svg_to_polygons(data, class_name): ...
def taxonomy_item_repr(i): ...
def tesselate(schema_name, shape_str, d): ...
def turn_off_detailed_logging(): ...
def turn_on_detailed_logging(): ...
def version(): ...
def turn_off_detailed_logging() -> None: ...
def turn_on_detailed_logging() -> None: ...
def version() -> str: ...
+2 -2
View File
@@ -96,9 +96,9 @@ class sqlite(file):
self.preprocess_schema()
def preprocess_schema(self) -> None:
self.ifc_class_subtypes = {}
self.ifc_class_subtypes: dict[str, Any] = {}
self.ifc_class_attributes: dict[str, dict[str, ifcopenshell_wrapper.attribute]] = {}
self.ifc_class_inverse_attributes = {}
self.ifc_class_inverse_attributes: dict[str, Any] = {}
self.ifc_class_references = {}
self.ifc_class_inverses = {}
@@ -27,9 +27,7 @@ def get_constraints(product: ifcopenshell.entity_instance) -> list[ifcopenshell.
Retrieves the constraints assigned to the `product`.
:param product: The IFC element.
:type product: ifcopenshell.entity_instance
:return: List of assigned constraints.
:rtype: list[ifcopenshell.entity_instance]
"""
constraints = []
for rel in product.HasAssociations or []:
@@ -43,9 +41,7 @@ def get_constrained_elements(constraint: ifcopenshell.entity_instance) -> set[if
Retrieves the elements constrained by a `constraint`.
:param product: The IFC element.
:type product: ifcopenshell.entity_instance
:return: Set of elements constrained by a `constrant`.
:rtype: set[ifcopenshell.entity_instance]
"""
elements = set()
for rel in constraint.file.get_inverse(constraint):
@@ -59,9 +55,7 @@ def get_metrics(constraint: ifcopenshell.entity_instance) -> list[ifcopenshell.e
Retrieves the list of nested constraints for a IfcObjective `constraint`.
:param product: IfcObjective constraint.
:type product: ifcopenshell.entity_instance
:return: List of nested constraints.
:rtype: list[ifcopenshell.entity_instance]
"""
metrics = []