This commit is contained in:
Andrej
2025-05-29 17:23:02 +05:00
parent ea7ced738a
commit 0663c5130a
25 changed files with 42 additions and 22 deletions
@@ -22,9 +22,9 @@ import numpy as np
from math import sin from math import sin
from mathutils import Vector from mathutils import Vector
import ifcopenshell import ifcopenshell
import ifcopenshell.api
import ifcopenshell.util.attribute
import ifcopenshell.util.placement import ifcopenshell.util.placement
import ifcopenshell.util.representation
import ifcopenshell.util.unit
import ifcopenshell.util.unit as ifcunit import ifcopenshell.util.unit as ifcunit
import bonsai.tool as tool import bonsai.tool as tool
from bonsai.bim.module.structural.shader import DecorationShader from bonsai.bim.module.structural.shader import DecorationShader
+2
View File
@@ -21,7 +21,9 @@ import bpy
import bonsai.core.tool import bonsai.core.tool
import bonsai.tool as tool import bonsai.tool as tool
import bonsai.bim.helper import bonsai.bim.helper
import bonsai.core.geometry
import ifcopenshell import ifcopenshell
import ifcopenshell.util.representation
from typing import Iterable, TYPE_CHECKING from typing import Iterable, TYPE_CHECKING
if TYPE_CHECKING: if TYPE_CHECKING:
+1
View File
@@ -20,6 +20,7 @@
import csv import csv
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.util.date
import locale import locale
import re import re
+1
View File
@@ -20,6 +20,7 @@ import uuid
import datetime import datetime
import ifcopenshell import ifcopenshell
import ifcopenshell.util.date import ifcopenshell.util.date
import ifcopenshell.util.sequence
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
+1
View File
@@ -20,6 +20,7 @@ import uuid
import datetime import datetime
import ifcopenshell import ifcopenshell
import ifcopenshell.util.date import ifcopenshell.util.date
import ifcopenshell.util.sequence
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from .common import ScheduleIfcGenerator from .common import ScheduleIfcGenerator
+1 -1
View File
@@ -29,7 +29,7 @@ import ifcopenshell.util.cost
import ifcopenshell.util.date import ifcopenshell.util.date
import ifcopenshell.util.unit import ifcopenshell.util.unit
from collections import Counter from collections import Counter
from typing import Union, Optional, Any, TypedDict, NotRequired from typing import Union, Optional, Any, TypedDict
class CostItem(TypedDict): class CostItem(TypedDict):
@@ -258,6 +258,7 @@ class Cityjson2ifc:
# TODO but maybe there is a better method. # TODO but maybe there is a better method.
file = self.properties["file_destination"] + lod + self.properties["file_extension"] file = self.properties["file_destination"] + lod + self.properties["file_extension"]
self.IFC_model.write(file) self.IFC_model.write(file)
IFC_copied_model: ifcopenshell.file
IFC_copied_model = ifcopenshell.open(file) IFC_copied_model = ifcopenshell.open(file)
IFC_copied_model_sub_contexts = IFC_copied_model.by_type("IfcGeometricRepresentationSubContext") IFC_copied_model_sub_contexts = IFC_copied_model.by_type("IfcGeometricRepresentationSubContext")
for sub_context in IFC_copied_model_sub_contexts: for sub_context in IFC_copied_model_sub_contexts:
@@ -65,7 +65,7 @@ if TYPE_CHECKING:
import ifcopenshell.express.schema_class import ifcopenshell.express.schema_class
if hasattr(os, "uname"): if sys.platform != "win32":
platform_system = os.uname()[0].lower() platform_system = os.uname()[0].lower()
else: else:
platform_system = "windows" platform_system = "windows"
@@ -43,9 +43,11 @@ import numpy
import inspect import inspect
import importlib import importlib
import ifcopenshell import ifcopenshell
from typing import Callable, Any, Optional from typing import Callable, Any, Optional, TYPE_CHECKING
from functools import partial from functools import partial
if TYPE_CHECKING:
import ifcopenshell.api
pre_listeners: dict[str, dict] = {} pre_listeners: dict[str, dict] = {}
post_listeners: dict[str, dict] = {} post_listeners: dict[str, dict] = {}
@@ -185,7 +187,7 @@ def extract_docs(module: str, usecase: str) -> dict[str, Any]:
type_hints = typing.get_type_hints(function_init) type_hints = typing.get_type_hints(function_init)
for name, socket_data in inputs.items(): for name, socket_data in inputs.items():
type_hint = type_hints[name] type_hint = type_hints[name]
if isinstance(type_hint, typing._UnionGenericAlias): if isinstance(type_hint, typing._UnionGenericAlias): # pyright: ignore[reportAttributeAccessIssue]
inputs[name]["type"] = [t.__name__ for t in typing.get_args(type_hint)] inputs[name]["type"] = [t.__name__ for t in typing.get_args(type_hint)]
else: else:
inputs[name]["type"] = type_hint.__name__ inputs[name]["type"] = type_hint.__name__
@@ -19,6 +19,8 @@
import ifcopenshell import ifcopenshell
import ifcopenshell.api.alignment import ifcopenshell.api.alignment
import ifcopenshell.api.nest import ifcopenshell.api.nest
import ifcopenshell.api.pset
import ifcopenshell.util.stationing
import ifcopenshell.guid import ifcopenshell.guid
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
@@ -21,6 +21,7 @@ import ifcopenshell.api.aggregate
import ifcopenshell.api.alignment import ifcopenshell.api.alignment
import ifcopenshell.api.geometry import ifcopenshell.api.geometry
import ifcopenshell.api.nest import ifcopenshell.api.nest
import ifcopenshell.api.root
import ifcopenshell.guid import ifcopenshell.guid
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.representation import ifcopenshell.util.representation
@@ -17,7 +17,9 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell import ifcopenshell
import ifcopenshell.api.aggregate
import ifcopenshell.api.alignment import ifcopenshell.api.alignment
import ifcopenshell.api.nest
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
from typing import Sequence from typing import Sequence
@@ -17,11 +17,10 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.util.representation
import ifcopenshell.api.alignment import ifcopenshell.api.alignment
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
from ifcopenshell import ifcopenshell_wrapper
import math
from typing import Sequence
def create_segment_representations( def create_segment_representations(
@@ -17,9 +17,7 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell import ifcopenshell
import ifcopenshell.api.alignment import ifcopenshell.util.element
import ifcopenshell.api.nest
import ifcopenshell.guid
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
@@ -49,8 +49,6 @@ def map_alignment_segments(
elif alignment.is_a("IfcAlignmentCant") and not composite_curve.is_a("IfcSegmentedReferenceCurve"): elif alignment.is_a("IfcAlignmentCant") and not composite_curve.is_a("IfcSegmentedReferenceCurve"):
raise TypeError(f"Expected to see IfcSegmentedReferenceCurve, instead received '{composite_curve.is_a()}'.") raise TypeError(f"Expected to see IfcSegmentedReferenceCurve, instead received '{composite_curve.is_a()}'.")
settings = ifcopenshell.geom.settings()
composite_curve.SelfIntersect = False composite_curve.SelfIntersect = False
for rel_nests in alignment.IsNestedBy: for rel_nests in alignment.IsNestedBy:
@@ -64,6 +62,8 @@ def map_alignment_segments(
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment( mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(
file, layout, alignment.RailHeadDistance file, layout, alignment.RailHeadDistance
) )
else:
assert False
for mapped_segment in mapped_segments: for mapped_segment in mapped_segments:
if mapped_segment: if mapped_segment:
ifcopenshell.api.alignment.add_segment_to_curve(file, mapped_segment, composite_curve) ifcopenshell.api.alignment.add_segment_to_curve(file, mapped_segment, composite_curve)
@@ -19,6 +19,7 @@
from __future__ import annotations from __future__ import annotations
import numpy as np import numpy as np
import dataclasses import dataclasses
import ifcopenshell.api.geometry
import ifcopenshell.util.unit import ifcopenshell.util.unit
from itertools import chain from itertools import chain
from ifcopenshell.util.shape_builder import ShapeBuilder, V from ifcopenshell.util.shape_builder import ShapeBuilder, V
@@ -18,11 +18,10 @@
import numpy as np import numpy as np
import ifcopenshell import ifcopenshell
import ifcopenshell.api.owner import ifcopenshell.api.geometry
import ifcopenshell.guid
import ifcopenshell.util.element
import ifcopenshell.util.placement import ifcopenshell.util.placement
import ifcopenshell.util.representation import ifcopenshell.util.representation
import ifcopenshell.util.shape_builder
from typing import Optional from typing import Optional
@@ -19,11 +19,13 @@
import json import json
import numpy as np import numpy as np
import ifcopenshell import ifcopenshell
import ifcopenshell.api.context
import ifcopenshell.api.geometry import ifcopenshell.api.geometry
import ifcopenshell.util.unit
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.placement import ifcopenshell.util.placement
import ifcopenshell.util.representation
import ifcopenshell.util.shape_builder import ifcopenshell.util.shape_builder
import ifcopenshell.util.unit
from collections import namedtuple from collections import namedtuple
from math import sin, cos from math import sin, cos
from typing import Optional from typing import Optional
@@ -19,6 +19,7 @@
import ifcopenshell import ifcopenshell
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.geolocation import ifcopenshell.util.geolocation
import ifcopenshell.util.unit
import numpy as np import numpy as np
from math import sin, cos, radians from math import sin, cos, radians
@@ -19,8 +19,9 @@
import os import os
import json import json
import ifcopenshell import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.util.classification import ifcopenshell.util.classification
import ifcopenshell.util.element
import ifcopenshell.util.system
from typing import Union from typing import Union
@@ -19,8 +19,9 @@
import numpy as np import numpy as np
import numpy.typing as npt import numpy.typing as npt
import ifcopenshell import ifcopenshell
import ifcopenshell.util.shape import ifcopenshell.util.representation
import ifcopenshell.util.placement import ifcopenshell.util.placement
import ifcopenshell.util.shape
from typing import Optional, Union, TypedDict, Literal, Generator, Sequence from typing import Optional, Union, TypedDict, Literal, Generator, Sequence
@@ -18,6 +18,9 @@
import ifcopenshell import ifcopenshell
import ifcopenshell.util.schema
import ifcopenshell.util.shape_builder
import ifcopenshell.util.unit
import logging import logging
from typing import Optional from typing import Optional
@@ -18,6 +18,7 @@
import ifcopenshell import ifcopenshell
import ifcopenshell.guid import ifcopenshell.guid
import ifcopenshell.util.element
class Patcher: class Patcher:
@@ -18,6 +18,7 @@
import ifcopenshell import ifcopenshell
import ifcopenshell.api.georeference import ifcopenshell.api.georeference
import ifcopenshell.util.geolocation
from ifcpatch.recipes import OffsetObjectPlacements, SetWorldCoordinateSystem from ifcpatch.recipes import OffsetObjectPlacements, SetWorldCoordinateSystem
import typing import typing
+2 -2
View File
@@ -23,8 +23,9 @@ import sys
import math import math
import datetime import datetime
import ifcopenshell import ifcopenshell
import ifcopenshell.util.unit
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.placement
import ifcopenshell.util.unit
from .ids import Specification, Ids from .ids import Specification, Ids
from .facet import Facet, FacetFailure from .facet import Facet, FacetFailure
from typing import TypedDict, Union, Literal, Optional from typing import TypedDict, Union, Literal, Optional
@@ -766,7 +767,6 @@ class Bcf(Json):
def to_file(self, filepath: str) -> None: def to_file(self, filepath: str) -> None:
import numpy as np import numpy as np
import ifcopenshell.util.placement
from bcf.v2.bcfxml import BcfXml from bcf.v2.bcfxml import BcfXml
unit_scale = None unit_scale = None