This commit is contained in:
Andrej730
2024-11-27 11:07:30 +05:00
parent 25eecded4e
commit ab069f431a
5 changed files with 19 additions and 14 deletions
@@ -29,6 +29,7 @@ import ifcopenshell
import bonsai.tool as tool
import bonsai.bim.handler
from pathlib import Path
from typing import Union
class ExecuteIfcTester(bpy.types.Operator):
@@ -66,7 +67,7 @@ class ExecuteIfcTester(bpy.types.Operator):
bonsai.bim.handler.refresh_ui_data()
return {"FINISHED"}
def execute_tester(self, ifc_data, ifc_path, specs_path):
def execute_tester(self, ifc_data: ifcopenshell.file, ifc_path: str, specs_path: str) -> Union[set[str], None]:
props = bpy.context.scene.IfcTesterProperties
with tempfile.TemporaryDirectory() as dirpath:
+7 -4
View File
@@ -29,7 +29,7 @@ import ifcopenshell.util.selector
import ifcopenshell.util.element
import ifcopenshell.util.schema
from statistics import mean
from typing import Optional, Union, Literal
from typing import Optional, Union, Literal, Iterable
try:
from odf.namespaces import OFFICENS
@@ -65,6 +65,9 @@ FILE_FORMAT = Literal[
class IfcCsv:
attributes: list[str]
headers: list[str]
def __init__(self):
self.headers = []
self.results = []
@@ -73,9 +76,9 @@ class IfcCsv:
def export(
self,
ifc_file: ifcopenshell.file,
elements: ifcopenshell.entity_instance,
attributes,
headers=None,
elements: Iterable[ifcopenshell.entity_instance],
attributes: Union[list[str], None],
headers: Optional[list[str]] = None,
output=None,
format: FILE_FORMAT = None,
should_preserve_existing: bool = False,
+4 -4
View File
@@ -33,7 +33,7 @@ from functools import reduce
chars = string.digits + string.ascii_uppercase + string.ascii_lowercase + "_$"
def compress(g):
def compress(g: str) -> str:
bs = [int(g[i : i + 2], 16) for i in range(0, len(g), 2)]
def b64(v, l=4):
@@ -42,7 +42,7 @@ def compress(g):
return "".join([b64(bs[0], 2)] + [b64((bs[i] << 16) + (bs[i + 1] << 8) + bs[i + 2]) for i in range(1, 16, 3)])
def expand(g):
def expand(g: str) -> str:
def b64(v):
return reduce(lambda a, b: a * 64 + b, map(lambda c: chars.index(c), v))
@@ -53,9 +53,9 @@ def expand(g):
return "".join(["%02x" % b for b in bs])
def split(g):
def split(g: str) -> str:
return "{%s-%s-%s-%s-%s}" % (g[:8], g[8:12], g[12:16], g[16:20], g[20:])
def new():
def new() -> str:
return compress(uuid.uuid4().hex)
@@ -23,15 +23,15 @@ import ifcopenshell.api.pset
import ifcopenshell.api.geometry
import ifcopenshell.util
import ifcopenshell.util.attribute
import ifcopenshell.util.fm
import ifcopenshell.util.unit
import ifcopenshell.util.element
import ifcopenshell.util.placement
import ifcopenshell.util.geolocation
import ifcopenshell.util.classification
import ifcopenshell.util.element
import ifcopenshell.util.fm
import ifcopenshell.util.geolocation
import ifcopenshell.util.placement
import ifcopenshell.util.schema
import ifcopenshell.util.shape
import ifcopenshell.util.system
import ifcopenshell.util.unit
from decimal import Decimal
from typing import Optional, Any, Union, Iterable
@@ -393,6 +393,7 @@ def validate(f: Union[ifcopenshell.file, str], logger: Logger, express_rules=Fal
logger.error(f"Unsupported schema: {schema_name}")
return
assert isinstance(f, ifcopenshell.file)
log_internal_cpp_errors(f, filename, logger)
validate_ifc_header(f, logger)