mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
Merge remote-tracking branch 'origin/v0.8.0' into datamodel-v1.0
This commit is contained in:
@@ -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] # ty:ignore[unresolved-import]
|
||||
|
||||
return True
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
try:
|
||||
import OCC.BRepTools
|
||||
import OCC.BRepTools # noqa: F401 # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
|
||||
return True
|
||||
except ImportError:
|
||||
@@ -52,6 +52,6 @@ def _has_occ():
|
||||
has_occ = _has_occ()
|
||||
|
||||
if has_occ:
|
||||
from . import occ_utils as utils
|
||||
from . import occ_utils as utils # noqa: F401
|
||||
|
||||
from .main import *
|
||||
|
||||
@@ -16,24 +16,23 @@
|
||||
# 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 functools
|
||||
import multiprocessing
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import operator
|
||||
import functools
|
||||
import multiprocessing
|
||||
|
||||
import ifcopenshell.ifcopenshell_wrapper as W
|
||||
|
||||
try:
|
||||
from OCC.Core import AIS
|
||||
from OCC.Core import AIS # noqa: F401
|
||||
|
||||
USE_OCCT_HANDLE = False
|
||||
except ImportError:
|
||||
from OCC import AIS
|
||||
|
||||
USE_OCCT_HANDLE = True
|
||||
|
||||
from collections import defaultdict, OrderedDict
|
||||
from collections import OrderedDict, defaultdict
|
||||
from collections.abc import Iterable
|
||||
|
||||
try:
|
||||
@@ -55,7 +54,6 @@ from .code_editor_pane import code_edit
|
||||
try:
|
||||
from OCC.Display.pyqt5Display import qtViewer3d
|
||||
except BaseException:
|
||||
import OCC.Display
|
||||
|
||||
try:
|
||||
import OCC.Display.backend
|
||||
@@ -69,11 +67,10 @@ except BaseException:
|
||||
|
||||
from OCC.Display.qtDisplay import qtViewer3d
|
||||
|
||||
from .main import settings, iterator
|
||||
from .occ_utils import display_shape
|
||||
|
||||
from .. import open as open_ifc_file
|
||||
from .. import version as ifcopenshell_version
|
||||
from .main import iterator, settings
|
||||
from .occ_utils import display_shape
|
||||
|
||||
if ifcopenshell_version < "0.6":
|
||||
# not yet ported
|
||||
@@ -148,8 +145,7 @@ class configuration:
|
||||
config.set(
|
||||
"snippets",
|
||||
"print all wall ids",
|
||||
self.config_encode(
|
||||
"""
|
||||
self.config_encode("""
|
||||
###########################################################################
|
||||
# A simple script that iterates over all walls in the current model #
|
||||
# and prints their Globally unique IDs (GUIDS) to the console window #
|
||||
@@ -157,15 +153,13 @@ class configuration:
|
||||
|
||||
for wall in model.by_type("IfcWall"):
|
||||
print ("wall with global id: "+str(wall.GlobalId))
|
||||
""".lstrip()
|
||||
),
|
||||
""".lstrip()),
|
||||
)
|
||||
|
||||
config.set(
|
||||
"snippets",
|
||||
"print properties of current selection",
|
||||
self.config_encode(
|
||||
"""
|
||||
self.config_encode("""
|
||||
###########################################################################
|
||||
# A simple script that iterates over all IfcPropertySets of the currently #
|
||||
# selected object and prints them to the console #
|
||||
@@ -183,8 +177,7 @@ if selection:
|
||||
for prop in relDefinesByProperties.RelatingPropertyDefinition.HasProperties:
|
||||
print ("{:<20} :{}".format(prop.Name,prop.NominalValue.wrappedValue))
|
||||
print ("\\n")
|
||||
""".lstrip()
|
||||
),
|
||||
""".lstrip()),
|
||||
)
|
||||
with open(conf_file, "w") as configfile:
|
||||
config.write(configfile)
|
||||
|
||||
@@ -16,11 +16,10 @@
|
||||
# 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 os
|
||||
import sys
|
||||
import logging
|
||||
|
||||
import sys
|
||||
from code import InteractiveConsole
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
try:
|
||||
@@ -29,15 +28,12 @@ except BaseException:
|
||||
QtWidgets = QtGui
|
||||
|
||||
try:
|
||||
from pyqode.core.panels import CheckerPanel
|
||||
from pyqode.core import api
|
||||
from pyqode.core import modes
|
||||
from pyqode.core import panels
|
||||
from pyqode.core.api import CodeEdit, ColorScheme
|
||||
from pyqode.python.modes import PyAutoIndentMode, PythonSH
|
||||
from pyqode.core import api, modes, panels
|
||||
from pyqode.core.api import CodeEdit
|
||||
from pyqode.python import modes as pymodes
|
||||
from pyqode.python import panels as pypanels
|
||||
from pyqode.python.backend import server
|
||||
from pyqode.python import modes as pymodes, panels as pypanels, widgets
|
||||
from pyqode.python.widgets import PyInteractiveConsole
|
||||
from pyqode.python.modes import PythonSH
|
||||
|
||||
has_pyqode = True
|
||||
except BaseException:
|
||||
|
||||
@@ -18,20 +18,17 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import os
|
||||
import sys
|
||||
import operator
|
||||
|
||||
from .. import open, ifcopenshell_wrapper
|
||||
from ifcopenshell import file, entity_instance
|
||||
from collections.abc import Generator, Iterable
|
||||
from typing import TYPE_CHECKING, Any, Literal, Optional, TypeVar, Union, cast, overload
|
||||
|
||||
from .. import ifcopenshell_wrapper, open
|
||||
from ..entity_instance import entity_instance
|
||||
from ..file import file
|
||||
from . import has_occ
|
||||
|
||||
from typing import TypeVar, Union, Optional, Any, Literal, overload, TYPE_CHECKING, cast
|
||||
from collections.abc import Generator, Iterable
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from OCC.Core import TopoDS
|
||||
from OCC.Core import TopoDS # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
|
||||
IteratorOutput = Union["ShapeElementType", "utils.shape_tuple"]
|
||||
|
||||
@@ -50,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] # ty:ignore[unresolved-import]
|
||||
except ImportError:
|
||||
from OCC import TopoDS
|
||||
from OCC import TopoDS # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
|
||||
def wrap_shape_creation(settings: settings, shape: ifcopenshell_wrapper.Element):
|
||||
if getattr(settings, "use_python_opencascade", False):
|
||||
@@ -92,6 +89,7 @@ SETTING = Literal[
|
||||
"keep-bounding-boxes",
|
||||
"layerset-first",
|
||||
"length-unit",
|
||||
"make-volume",
|
||||
"max-offset-deviation",
|
||||
"max-offset",
|
||||
"mesher-angular-deflection",
|
||||
@@ -127,6 +125,7 @@ SERIALIZER_SETTING = Literal[
|
||||
"ecef",
|
||||
"digits",
|
||||
"wkt-use-section",
|
||||
"separate-z-up-node",
|
||||
]
|
||||
|
||||
# NOTE: hybrid-cgal-simple-opencascade is added just as an example
|
||||
|
||||
@@ -18,24 +18,41 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import inspect
|
||||
import random
|
||||
import operator
|
||||
import random
|
||||
import warnings
|
||||
from collections.abc import Iterable
|
||||
from typing import NamedTuple, Union
|
||||
|
||||
import OCC # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
from typing_extensions import assert_never
|
||||
|
||||
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
|
||||
|
||||
from typing import NamedTuple, Any, Union
|
||||
from typing_extensions import assert_never
|
||||
from collections.abc import Iterable
|
||||
|
||||
import OCC
|
||||
|
||||
try:
|
||||
from OCC.Core import V3d, TopoDS, gp, AIS, Quantity, BRepTools, Graphic3d
|
||||
from OCC.Core import ( # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
AIS,
|
||||
BRepTools,
|
||||
Graphic3d,
|
||||
Quantity,
|
||||
TopoDS,
|
||||
V3d,
|
||||
gp,
|
||||
)
|
||||
|
||||
USE_OCCT_HANDLE = False
|
||||
except ImportError:
|
||||
from OCC import V3d, TopoDS, gp, AIS, Quantity, BRepTools, Graphic3d
|
||||
from OCC import ( # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
AIS,
|
||||
BRepTools,
|
||||
Graphic3d,
|
||||
Quantity,
|
||||
TopoDS,
|
||||
V3d,
|
||||
gp,
|
||||
)
|
||||
|
||||
USE_OCCT_HANDLE = True
|
||||
|
||||
@@ -67,7 +84,7 @@ DEFAULT_STYLES = {
|
||||
|
||||
|
||||
def initialize_display():
|
||||
import OCC.Display.SimpleGui
|
||||
import OCC.Display.SimpleGui # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
|
||||
global handle, main_loop, add_menu, add_function_to_menu
|
||||
handle, main_loop, add_menu, add_function_to_menu = OCC.Display.SimpleGui.init_display()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from typing import Optional, IO
|
||||
from itertools import accumulate
|
||||
from typing import IO, Optional
|
||||
|
||||
from . import ifcopenshell_wrapper
|
||||
|
||||
|
||||
Reference in New Issue
Block a user