This commit is contained in:
Andrej730
2024-06-04 13:50:00 +05:00
parent 61c2a2c6c6
commit db98f13982
6 changed files with 48 additions and 33 deletions
@@ -169,7 +169,7 @@ class entity_instance:
return file.from_pointer(self.wrapped_data.file_pointer())
def __getattr__(self, name):
def __getattr__(self, name: str) -> Any:
INVALID, FORWARD, INVERSE = range(3)
attr_cat = self.wrapped_data.get_attribute_category(name)
if attr_cat == FORWARD:
@@ -27,9 +27,13 @@ from ..entity_instance import entity_instance
from . import has_occ
from typing import TypeVar, Union, Optional
from typing import TypeVar, Union, Optional, Generator
T = TypeVar("T")
ShapeElementType = Union[
ifcopenshell_wrapper.BRepElement, ifcopenshell_wrapper.TriangulationElement, ifcopenshell_wrapper.SerializedElement
]
ShapeType = Union[ifcopenshell_wrapper.BRep, ifcopenshell_wrapper.Triangulation, ifcopenshell_wrapper.Serialization]
def wrap_shape_creation(settings, shape):
@@ -122,7 +126,7 @@ class iterator(ifcopenshell_wrapper.Iterator):
def get(self):
return wrap_shape_creation(self.settings, ifcopenshell_wrapper.Iterator.get(self))
def __iter__(self):
def __iter__(self) -> Generator[ShapeElementType, None, None]:
if self.initialize():
while True:
yield self.get()
@@ -738,7 +738,7 @@ def get_elements_by_style(
def get_elements_by_representation(
ifc_file: ifcopenshell.file, representation: ifcopenshell.entity_instance
) -> list[ifcopenshell.entity_instance]:
) -> set[ifcopenshell.entity_instance]:
"""Gets all elements using a geometric representation
:param ifc_file: The IFC file
@@ -746,7 +746,7 @@ def get_elements_by_representation(
:param representation: The IfcShapeRepresentation representation
:type representation: ifcopenshell.entity_instance
:return: The elements using the geometric representation
:rtype: list[ifcopenshell.entity_instance]
:rtype: set[ifcopenshell.entity_instance]
Example:
@@ -26,7 +26,7 @@ import ifcopenshell.util.element
import ifcopenshell.util.representation
import ifcopenshell.util.unit
from math import cos, sin, pi, tan, radians, degrees, atan, sqrt, ceil
from typing import Union, Optional, Literal, Any
from typing import Union, Optional, Literal, Any, Sequence
from itertools import chain
from mathutils import Vector, Matrix
@@ -304,9 +304,9 @@ class ShapeBuilder:
x_axis_radius: float,
y_axis_radius: float,
position=Vector((0.0, 0.0)).freeze(),
trim_points: list[Vector] = (),
trim_points: Sequence[Vector] = (),
ref_x_direction: Vector = Vector((1.0, 0.0)),
trim_points_mask: list[int] = (),
trim_points_mask: Sequence[int] = (),
) -> ifcopenshell.entity_instance:
"""
Ellipse trimming points should be specified in counter clockwise order.
@@ -345,7 +345,7 @@ class ShapeBuilder:
self,
outer_curve: ifcopenshell.entity_instance,
name: Optional[str] = None,
inner_curves: list[ifcopenshell.entity_instance] = (),
inner_curves: Sequence[ifcopenshell.entity_instance] = (),
profile_type: str = "AREA",
) -> ifcopenshell.entity_instance:
# > inner_curves - list of IfcCurve;
@@ -882,8 +882,8 @@ class ShapeBuilder:
def get_simple_2dcurve_data(
self,
coords: list[Vector],
fillets: list[int] = (),
fillet_radius: list[float] = (),
fillets: Sequence[int] = (),
fillet_radius: Sequence[float] = (),
closed: bool = True,
create_ifc_curve: bool = False,
) -> tuple[list[Vector], list[tuple[int, int], Union[ifcopenshell.entity_instance, None]]]: