mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
typing
This commit is contained in:
@@ -17,12 +17,12 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
from typing import Optional
|
||||
from typing import Optional, Literal
|
||||
|
||||
|
||||
def add_context(
|
||||
file: ifcopenshell.file,
|
||||
context_type: str,
|
||||
context_type: Optional[Literal["Model", "Plan"]] = None,
|
||||
context_identifier: Optional[str] = None,
|
||||
target_view: Optional[str] = None,
|
||||
parent: Optional[ifcopenshell.entity_instance] = None,
|
||||
@@ -96,7 +96,7 @@ def add_context(
|
||||
|
||||
:param context_type: The type of the context, must be one of "Model" or
|
||||
"Plan" only.
|
||||
:type context_type: str
|
||||
:type context_type: str, optional
|
||||
:param context_identifier: The identifier of the context, chosen from
|
||||
one of the common identifiers above or consult the IFC documentation
|
||||
(under the IfcShapeRepresentation page) for more details. Optional
|
||||
|
||||
@@ -21,7 +21,7 @@ import math
|
||||
import bmesh
|
||||
import ifcopenshell.util.unit
|
||||
from mathutils import Vector, Matrix
|
||||
from typing import Union, Optional, Literal
|
||||
from typing import Union, Optional, Literal, Any
|
||||
|
||||
|
||||
Z_AXIS = Vector((0, 0, 1))
|
||||
@@ -93,6 +93,9 @@ def add_representation(
|
||||
|
||||
|
||||
class Usecase:
|
||||
file: ifcopenshell.file
|
||||
settings: dict[str, Any]
|
||||
|
||||
def execute(self):
|
||||
self.is_manifold = None
|
||||
if (
|
||||
|
||||
@@ -16,8 +16,13 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
|
||||
from typing import Union
|
||||
|
||||
def get_primitive_type(attribute_or_data_type):
|
||||
|
||||
def get_primitive_type(
|
||||
attribute_or_data_type: Union[ifcopenshell_wrapper.attribute, ifcopenshell_wrapper.parameter_type]
|
||||
) -> Union[str, tuple[str, list[str]]]:
|
||||
if hasattr(attribute_or_data_type, "type_of_attribute"):
|
||||
data_type = str(attribute_or_data_type.type_of_attribute())
|
||||
else:
|
||||
|
||||
@@ -21,6 +21,7 @@ import lark
|
||||
import numpy as np
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.util
|
||||
import ifcopenshell.util.attribute
|
||||
import ifcopenshell.util.fm
|
||||
import ifcopenshell.util.unit
|
||||
import ifcopenshell.util.element
|
||||
@@ -30,7 +31,7 @@ import ifcopenshell.util.classification
|
||||
import ifcopenshell.util.schema
|
||||
import ifcopenshell.util.shape
|
||||
from decimal import Decimal
|
||||
from typing import Optional, Any, Union
|
||||
from typing import Optional, Any, Union, Iterable
|
||||
|
||||
|
||||
filter_elements_grammar = lark.Lark(
|
||||
@@ -326,10 +327,10 @@ def filter_elements(
|
||||
|
||||
def set_element_value(
|
||||
ifc_file: ifcopenshell.file,
|
||||
element: ifcopenshell.entity_instance,
|
||||
element: Union[ifcopenshell.entity_instance, Iterable[ifcopenshell.entity_instance], None],
|
||||
query: Union[str, list[str]],
|
||||
value: Optional[str],
|
||||
) -> Union[ifcopenshell.entity_instance, None]:
|
||||
value: Any,
|
||||
) -> None:
|
||||
if isinstance(query, (list, tuple)):
|
||||
keys = query
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user