This commit is contained in:
Andrej730
2026-03-13 18:28:51 +05:00
parent 1576302caf
commit eba798c544
30 changed files with 142 additions and 75 deletions
@@ -20,11 +20,11 @@ from __future__ import annotations
import math
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
import bmesh
import bpy.types
import bmesh # pyright: ignore[reportMissingImports]
import bpy # pyright: ignore[reportMissingImports]
import numpy as np
import numpy.typing as npt
from mathutils import Matrix, Vector
from mathutils import Matrix, Vector # pyright: ignore[reportMissingImports]
import ifcopenshell.util.shape_builder
import ifcopenshell.util.unit
@@ -22,7 +22,7 @@ from typing import TYPE_CHECKING, Any, Optional
import ifcopenshell
if TYPE_CHECKING:
import bpy
import bpy # pyright: ignore[reportMissingImports]
def add_surface_textures(
@@ -33,14 +33,14 @@ def _has_occ():
# Previous versions (pythonocc<=0.17.3) are using just OCC.
try:
import OCC.Core.BRepTools
import OCC.Core.BRepTools # pyright: ignore[reportMissingImports]
return True
except ImportError:
pass
try:
import OCC.BRepTools # noqa: F401
import OCC.BRepTools # noqa: F401 # pyright: ignore[reportMissingImports]
return True
except ImportError:
@@ -28,7 +28,7 @@ from ..file import file
from . import has_occ
if TYPE_CHECKING:
from OCC.Core import TopoDS
from OCC.Core import TopoDS # pyright: ignore[reportMissingImports]
IteratorOutput = Union["ShapeElementType", "utils.shape_tuple"]
@@ -47,9 +47,9 @@ if has_occ:
from . import occ_utils as utils
try:
from OCC.Core import TopoDS
from OCC.Core import TopoDS # pyright: ignore[reportMissingImports]
except ImportError:
from OCC import TopoDS
from OCC import TopoDS # pyright: ignore[reportMissingImports]
def wrap_shape_creation(settings: settings, shape: ifcopenshell_wrapper.Element):
if getattr(settings, "use_python_opencascade", False):
@@ -26,17 +26,17 @@ import warnings
from collections.abc import Iterable
from typing import NamedTuple, Union
import OCC
import OCC # pyright: ignore[reportMissingImports]
from typing_extensions import assert_never
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
try:
from OCC.Core import AIS, BRepTools, Graphic3d, Quantity, TopoDS, V3d, gp
from OCC.Core import AIS, BRepTools, Graphic3d, Quantity, TopoDS, V3d, gp # pyright: ignore[reportMissingImports]
USE_OCCT_HANDLE = False
except ImportError:
from OCC import AIS, BRepTools, Graphic3d, Quantity, TopoDS, V3d, gp
from OCC import AIS, BRepTools, Graphic3d, Quantity, TopoDS, V3d, gp # pyright: ignore[reportMissingImports]
USE_OCCT_HANDLE = True
@@ -68,7 +68,7 @@ DEFAULT_STYLES = {
def initialize_display():
import OCC.Display.SimpleGui
import OCC.Display.SimpleGui # pyright: ignore[reportMissingImports]
global handle, main_loop, add_menu, add_function_to_menu
handle, main_loop, add_menu, add_function_to_menu = OCC.Display.SimpleGui.init_display()
@@ -40,7 +40,7 @@ if TYPE_CHECKING:
# NOTE: mathutils is never used at runtime in ifcopenshell,
# only for type checking to ensure methods are compatible with
# Blender vectors.
from mathutils import Vector
from mathutils import Vector # pyright: ignore[reportMissingImports]
# Support both numpy arrays and python sequences as inputs.
VectorType = Union[Sequence[float], Vector, np.ndarray]
@@ -60,7 +60,6 @@ from typing import TYPE_CHECKING, Any, Optional, Union
import ifcopenshell
import ifcopenshell.express.rule_executor
import ifcopenshell.ifcopenshell_wrapper
import ifcopenshell.ifcopenshell_wrapper as W
if TYPE_CHECKING:
import ifcopenshell.simple_spf
@@ -705,10 +704,10 @@ def validate_ifc_header(
log_error(header_entity, name, index, STRING_TYPE, type(value).__name__)
# Ignore header.file_schema as file won't load to IfcOpenShell with invalid file_schema.
file_description: W.FileDescription = header.file_description
file_description = header.file_description
validate_attribute(file_description, "description", 0, aggregate=True)
validate_attribute(file_description, "implementation_level", 1)
file_name: W.FileName = header.file_name
file_name = header.file_name
validate_attribute(file_name, "name", 0)
validate_attribute(file_name, "time_stamp", 1)
validate_attribute(file_name, "author", 2, aggregate=True)