diff --git a/src/ifcopenshell-python/ifcopenshell/geom/__init__.py b/src/ifcopenshell-python/ifcopenshell/geom/__init__.py index 347851aa07..1a33696037 100644 --- a/src/ifcopenshell-python/ifcopenshell/geom/__init__.py +++ b/src/ifcopenshell-python/ifcopenshell/geom/__init__.py @@ -1,2 +1,21 @@ +############################################################################### +# # +# This file is part of IfcOpenShell. # +# # +# IfcOpenShell is free software: you can redistribute it and/or modify # +# it under the terms of the Lesser GNU General Public License as published by # +# the Free Software Foundation, either version 3.0 of the License, or # +# (at your option) any later version. # +# # +# IfcOpenShell is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# Lesser GNU General Public License for more details. # +# # +# You should have received a copy of the Lesser GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + from . import occ_utils as utils from .main import * diff --git a/src/ifcopenshell-python/ifcopenshell/geom/occ_utils.py b/src/ifcopenshell-python/ifcopenshell/geom/occ_utils.py index e8ec739f94..97186735a7 100644 --- a/src/ifcopenshell-python/ifcopenshell/geom/occ_utils.py +++ b/src/ifcopenshell-python/ifcopenshell/geom/occ_utils.py @@ -21,13 +21,6 @@ import random import operator from collections import namedtuple, Iterable -import OCC.gp -import OCC.V3d -import OCC.AIS -import OCC.Quantity -import OCC.BRepTools -import OCC.Display.SimpleGui - shape_tuple = namedtuple('shape_tuple', ('data', 'geometry', 'styles')) handle, main_loop, add_menu, add_function_to_menu = None, None, None, None @@ -48,6 +41,9 @@ DEFAULT_STYLES = { } def initialize_display(): + import OCC.V3d + import OCC.Display.SimpleGui + global handle, main_loop, add_menu, add_function_to_menu handle, main_loop, add_menu, add_function_to_menu = OCC.Display.SimpleGui.init_display() @@ -76,12 +72,18 @@ def initialize_display(): return handle def yield_subshapes(shape): + import OCC.TopoDS + it = OCC.TopoDS.TopoDS_Iterator(shape) while it.More(): yield it.Value() it.Next() def display_shape(shape, clr=None, viewer_handle=None): + import OCC.gp + import OCC.AIS + import OCC.Quantity + if viewer_handle is None: viewer_handle = handle if isinstance(shape, shape_tuple): @@ -172,12 +174,16 @@ def set_shape_transparency(ais, t): def get_bounding_box_center(bbox): + import OCC.gp + bbmin = [0.]*3; bbmax = [0.]*3 bbmin[0], bbmin[1], bbmin[2], bbmax[0], bbmax[1], bbmax[2] = bbox.Get() return OCC.gp.gp_Pnt(*map(lambda xy: (xy[0]+xy[1])/2., zip(bbmin, bbmax))) def create_shape_from_serialization(brep_object): + import OCC.BRepTools + brep_data, occ_shape, styles = None, None, () is_product_shape = True