mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-11 22:31:55 +00:00
typing
This commit is contained in:
@@ -204,6 +204,7 @@ class entity_instance:
|
|||||||
vs = entity_instance.wrap_value(self.wrapped_data.get_inverse(name), self.wrapped_data.file)
|
vs = entity_instance.wrap_value(self.wrapped_data.get_inverse(name), self.wrapped_data.file)
|
||||||
if settings.unpack_non_aggregate_inverses:
|
if settings.unpack_non_aggregate_inverses:
|
||||||
schema_name = self.wrapped_data.is_a(True).split(".")[0]
|
schema_name = self.wrapped_data.is_a(True).split(".")[0]
|
||||||
|
ent: ifcopenshell_wrapper.entity
|
||||||
ent = ifcopenshell_wrapper.schema_by_name(schema_name).declaration_by_name(self.is_a())
|
ent = ifcopenshell_wrapper.schema_by_name(schema_name).declaration_by_name(self.is_a())
|
||||||
inv = [i for i in ent.all_inverse_attributes() if i.name() == name][0]
|
inv = [i for i in ent.all_inverse_attributes() if i.name() == name][0]
|
||||||
if (inv.bound1(), inv.bound2()) == (-1, -1):
|
if (inv.bound1(), inv.bound2()) == (-1, -1):
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from typing import Any, Union
|
from typing import Any, Union, Literal
|
||||||
|
|
||||||
# `std::vector<xxx>` usually translated to `tuple[xxx, ...]`.
|
# `std::vector<xxx>` usually translated to `tuple[xxx, ...]`.
|
||||||
|
|
||||||
@@ -569,7 +569,7 @@ class aggregation_type(parameter_type):
|
|||||||
def bound2(self): ...
|
def bound2(self): ...
|
||||||
def type_of_aggregation(self): ...
|
def type_of_aggregation(self): ...
|
||||||
def type_of_aggregation_string(self): ...
|
def type_of_aggregation_string(self): ...
|
||||||
def type_of_element(self): ...
|
def type_of_element(self) -> parameter_type: ...
|
||||||
|
|
||||||
class attribute:
|
class attribute:
|
||||||
def name(self) -> str: ...
|
def name(self) -> str: ...
|
||||||
@@ -708,13 +708,16 @@ class cylinder(surface):
|
|||||||
|
|
||||||
class declaration:
|
class declaration:
|
||||||
def _is(self, *args: str) -> bool: ...
|
def _is(self, *args: str) -> bool: ...
|
||||||
def as_entity(self): ...
|
def as_entity(self) -> Union[entity, None]: ...
|
||||||
def as_enumeration_type(self): ...
|
def as_enumeration_type(self) -> Union[enumeration_type, None]: ...
|
||||||
def as_select_type(self): ...
|
def as_select_type(self) -> Union[select_type, None]: ...
|
||||||
def as_type_declaration(self): ...
|
def as_type_declaration(self) -> Union[type_declaration, None]: ...
|
||||||
def index_in_schema(self): ...
|
def index_in_schema(self) -> int: ...
|
||||||
def name(self) -> str: ...
|
def name(self) -> str: ...
|
||||||
def name_uc(self): ...
|
def name_uc(self) -> str:
|
||||||
|
"""Get name in upper case."""
|
||||||
|
...
|
||||||
|
|
||||||
def schema(self) -> schema_definition: ...
|
def schema(self) -> schema_definition: ...
|
||||||
def type(self): ...
|
def type(self): ...
|
||||||
|
|
||||||
@@ -745,40 +748,63 @@ class ellipse(curve):
|
|||||||
|
|
||||||
class entity(declaration):
|
class entity(declaration):
|
||||||
def all_attributes(self) -> tuple[attribute, ...]: ...
|
def all_attributes(self) -> tuple[attribute, ...]: ...
|
||||||
def all_inverse_attributes(self): ...
|
def all_inverse_attributes(self) -> tuple[inverse_attribute, ...]: ...
|
||||||
def argument_types(self): ...
|
def argument_types(self) -> tuple[str, ...]:
|
||||||
def as_entity(self): ...
|
"""Get a tuple of types for each attribute in ``all_attributes()``."""
|
||||||
|
...
|
||||||
|
|
||||||
|
def as_entity(self) -> entity: ...
|
||||||
def attribute_by_index(self, index: int) -> attribute: ...
|
def attribute_by_index(self, index: int) -> attribute: ...
|
||||||
def attribute_count(self) -> int: ...
|
def attribute_count(self) -> int: ...
|
||||||
def attribute_index(self, *args): ...
|
def attribute_index(self, *args: Union[str, attribute]) -> int:
|
||||||
def attributes(self): ...
|
"""
|
||||||
|
:param args: A single attribute name / attribute.
|
||||||
|
"""
|
||||||
|
...
|
||||||
|
|
||||||
|
def attributes(self) -> tuple[attribute, ...]: ...
|
||||||
def derived(self) -> tuple[bool, ...]:
|
def derived(self) -> tuple[bool, ...]:
|
||||||
"""Return a tuple of booleans indicating whether each direct attribute is derived."""
|
"""Return a tuple of booleans indicating whether each direct attribute is derived."""
|
||||||
...
|
...
|
||||||
|
|
||||||
def is_abstract(self): ...
|
def is_abstract(self) -> bool: ...
|
||||||
def set_attributes(self, attributes, derived): ...
|
def set_attributes(self, attributes, derived): ...
|
||||||
def set_inverse_attributes(self, inverse_attributes): ...
|
def set_inverse_attributes(self, inverse_attributes): ...
|
||||||
def set_subtypes(self, subtypes): ...
|
def set_subtypes(self, subtypes): ...
|
||||||
def subtypes(self): ...
|
def subtypes(self) -> tuple[entity, ...]: ...
|
||||||
def supertype(self): ...
|
def supertype(self) -> Union[entity, None]: ...
|
||||||
|
|
||||||
class entity_instance:
|
class entity_instance:
|
||||||
file_: Any
|
file_: Any
|
||||||
id_: Any
|
id_: Any
|
||||||
def data(self, *args): ...
|
def data(self, *args): ...
|
||||||
def declaration(self): ...
|
def declaration(self) -> declaration: ...
|
||||||
def file_pointer(self): ...
|
def file_pointer(self):
|
||||||
|
"""Internal IfcFile pointer address."""
|
||||||
|
...
|
||||||
|
|
||||||
def get_argument(self, *args): ...
|
def get_argument(self, *args): ...
|
||||||
def get_argument_index(self, a): ...
|
def get_argument_index(self, a): ...
|
||||||
def get_argument_name(self, i): ...
|
def get_argument_name(self, i): ...
|
||||||
def get_argument_type(self, i): ...
|
def get_argument_type(self, i): ...
|
||||||
def get_attribute_category(self, name): ...
|
def get_attribute_category(self, name: str) -> Literal[0, 1, 2]:
|
||||||
|
"""Get attribute category id.
|
||||||
|
|
||||||
|
Available categories:
|
||||||
|
- `0` - invalid attribute
|
||||||
|
- `1` - forward attribute
|
||||||
|
- `2` - inverse attributes
|
||||||
|
"""
|
||||||
|
...
|
||||||
|
|
||||||
def get_attribute_names(self): ...
|
def get_attribute_names(self): ...
|
||||||
def get_inverse(self, a): ...
|
def get_inverse(self, a): ...
|
||||||
def get_inverse_attribute_names(self): ...
|
def get_inverse_attribute_names(self): ...
|
||||||
def id(self): ...
|
def id(self) -> int: ...
|
||||||
def identity(self): ...
|
def identity(self) -> int:
|
||||||
|
"""Entity instance identity, unique across all opened IFC files during current session."""
|
||||||
|
...
|
||||||
|
|
||||||
def is_a(self, *args): ...
|
def is_a(self, *args): ...
|
||||||
def setArgumentAsAggregateOfAggregateOfDouble(self, i, v): ...
|
def setArgumentAsAggregateOfAggregateOfDouble(self, i, v): ...
|
||||||
def setArgumentAsAggregateOfAggregateOfEntityInstance(self, i, v): ...
|
def setArgumentAsAggregateOfAggregateOfEntityInstance(self, i, v): ...
|
||||||
@@ -799,11 +825,16 @@ class entity_instance:
|
|||||||
def unset_attribute_value(self, i): ...
|
def unset_attribute_value(self, i): ...
|
||||||
|
|
||||||
class enumeration_type(declaration):
|
class enumeration_type(declaration):
|
||||||
def argument_types(self): ...
|
def argument_types(self) -> tuple[str, ...]: ...
|
||||||
def as_enumeration_type(self): ...
|
def as_enumeration_type(self) -> enumeration_type: ...
|
||||||
def enumeration_items(self): ...
|
def enumeration_items(self) -> tuple[str, ...]: ...
|
||||||
def lookup_enum_offset(self, string): ...
|
def lookup_enum_offset(self, string: str) -> int:
|
||||||
def lookup_enum_value(self, i): ...
|
"""Get index of the string in enum."""
|
||||||
|
...
|
||||||
|
|
||||||
|
def lookup_enum_value(self, i: int) -> str:
|
||||||
|
"""Get a string for the index in enum."""
|
||||||
|
...
|
||||||
|
|
||||||
class extrusion(sweep):
|
class extrusion(sweep):
|
||||||
depth: Any
|
depth: Any
|
||||||
@@ -843,7 +874,10 @@ class file:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def createTimestamp(): ...
|
def createTimestamp(): ...
|
||||||
def entity_names(self): ...
|
def entity_names(self): ...
|
||||||
def file_pointer(self): ...
|
def file_pointer(self) -> int:
|
||||||
|
"""Internal IfcFile pointer address."""
|
||||||
|
...
|
||||||
|
|
||||||
def getInverse(self, instance_id, type, attribute_index): ...
|
def getInverse(self, instance_id, type, attribute_index): ...
|
||||||
def getMaxId(self): ...
|
def getMaxId(self): ...
|
||||||
def getTotalInverses(self, instance_id): ...
|
def getTotalInverses(self, instance_id): ...
|
||||||
@@ -861,7 +895,7 @@ class file:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def guid_map(*args): ...
|
def guid_map(*args): ...
|
||||||
@property
|
@property
|
||||||
def header(self): ...
|
def header(self) -> IfcSpfHeader: ...
|
||||||
def ifcroot_type(self): ...
|
def ifcroot_type(self): ...
|
||||||
def instance_by_guid(self, guid): ...
|
def instance_by_guid(self, guid): ...
|
||||||
def instances_by_reference(self, id): ...
|
def instances_by_reference(self, id): ...
|
||||||
@@ -1131,18 +1165,29 @@ class revolve(sweep):
|
|||||||
def matrix(self): ...
|
def matrix(self): ...
|
||||||
|
|
||||||
class schema_definition:
|
class schema_definition:
|
||||||
def declaration_by_name(self, *args: str) -> declaration: ...
|
def declaration_by_name(self, *args: str) -> declaration:
|
||||||
def declarations(self) -> tuple[declaration, ...]: ...
|
"""
|
||||||
|
:return: ``declaration`` but upcasted to the most advanced available type
|
||||||
|
(e.g. ``entity``, ``type_declaration``, etc).
|
||||||
|
"""
|
||||||
|
...
|
||||||
|
|
||||||
|
def declarations(self) -> tuple[declaration, ...]:
|
||||||
|
"""
|
||||||
|
:return: returned declarations are also upcasted, see ``declaration_by_name``.
|
||||||
|
"""
|
||||||
|
...
|
||||||
|
|
||||||
def entities(self) -> tuple[entity, ...]: ...
|
def entities(self) -> tuple[entity, ...]: ...
|
||||||
def enumeration_types(self): ...
|
def enumeration_types(self) -> tuple[enumeration_type, ...]: ...
|
||||||
|
def select_types(self) -> tuple[select_type, ...]: ...
|
||||||
|
def type_declarations(self) -> tuple[type_declaration, ...]: ...
|
||||||
def instantiate(self, decl, data): ...
|
def instantiate(self, decl, data): ...
|
||||||
def name(self) -> str: ...
|
def name(self) -> str: ...
|
||||||
def select_types(self): ...
|
|
||||||
def type_declarations(self): ...
|
|
||||||
|
|
||||||
class select_type(declaration):
|
class select_type(declaration):
|
||||||
def as_select_type(self): ...
|
def as_select_type(self) -> select_type: ...
|
||||||
def select_list(self): ...
|
def select_list(self) -> tuple[declaration, ...]: ...
|
||||||
|
|
||||||
class shell:
|
class shell:
|
||||||
closed: Any
|
closed: Any
|
||||||
@@ -1424,7 +1469,7 @@ class type_by_kind:
|
|||||||
|
|
||||||
class type_declaration(declaration):
|
class type_declaration(declaration):
|
||||||
def argument_types(self): ...
|
def argument_types(self): ...
|
||||||
def as_type_declaration(self): ...
|
def as_type_declaration(self) -> type_declaration: ...
|
||||||
def declared_type(self): ...
|
def declared_type(self): ...
|
||||||
|
|
||||||
def arrange_polygons(polygons): ...
|
def arrange_polygons(polygons): ...
|
||||||
|
|||||||
Reference in New Issue
Block a user