This commit is contained in:
Andrej730
2024-05-17 15:19:22 +05:00
parent 8662e20c58
commit 42be4eb064
14 changed files with 57 additions and 16 deletions
@@ -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: