diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index d151525a6c..0c6c7dfdaa 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -23,6 +23,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) # not necessary, but encouraged project (IfcOpenShell) + +#set(Boost_DEBUG 1) + + foreach(max_year RANGE 2014 2030) set(max_sdk "$ENV{ADSK_3DSMAX_SDK_${max_year}}") if (NOT "${max_sdk}" STREQUAL "") @@ -104,6 +108,17 @@ MACRO(UNIFY_ENVVARS_AND_CACHE VAR) ENDIF() ENDMACRO() +UNIFY_ENVVARS_AND_CACHE(BOOST_ROOT) +UNIFY_ENVVARS_AND_CACHE(BOOST_LIBRARYDIR) + + +UNIFY_ENVVARS_AND_CACHE(BOOST_ROOT) +UNIFY_ENVVARS_AND_CACHE(BOOST_LIBRARYDIR) + +message(STATUS "BOOST_ROOT ${BOOST_ROOT}") +message(STATUS "BOOST_LIBRARYDIR ${BOOST_LIBRARYDIR}") + + UNIFY_ENVVARS_AND_CACHE(OCC_INCLUDE_DIR) UNIFY_ENVVARS_AND_CACHE(OCC_LIBRARY_DIR) UNIFY_ENVVARS_AND_CACHE(OPENCOLLADA_INCLUDE_DIR) @@ -208,7 +223,7 @@ function(add_debug_variants NAME LIBRARIES POSTFIX) endfunction() if(BUILD_IFCGEOM) - +MESSAGE(STATUS "OCC_INCLUDE_DIR ${OCC_INCLUDE_DIR}") # Find Open CASCADE IF("${OCC_INCLUDE_DIR}" STREQUAL "") SET(OCC_INCLUDE_DIR "/usr/include/oce/" CACHE FILEPATH "Open CASCADE header files") diff --git a/ifcopenshell/__init__.py b/ifcopenshell/__init__.py new file mode 100644 index 0000000000..d573b57ac6 --- /dev/null +++ b/ifcopenshell/__init__.py @@ -0,0 +1,78 @@ +############################################################################### +# # +# 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 __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import os +import sys + +if hasattr(os, 'uname'): + platform_system = os.uname()[0].lower() +else: + platform_system = 'windows' + +if sys.maxsize == (1 << 31) - 1: + platform_architecture = '32bit' +else: + platform_architecture = '64bit' + +python_version_tuple = tuple(sys.version.split(' ')[0].split('.')) + +python_distribution = os.path.join(platform_system, + platform_architecture, + 'python%s.%s' % python_version_tuple[:2]) +sys.path.append(os.path.abspath(os.path.join( + os.path.dirname(__file__), + 'lib', python_distribution))) + +try: + from . import ifcopenshell_wrapper +except Exception as e: + if int(python_version_tuple[0]) == 2: + # Only for py2, as py3 has exception chaining + import traceback + + traceback.print_exc() + print('-' * 64) + raise ImportError("IfcOpenShell not built for '%s'" % python_distribution) + +from . import guid +from .file import file +from .entity_instance import entity_instance + + +def open(fn): + f = ifcopenshell_wrapper.open(os.path.abspath(fn)) + if f.good(): + return file(f) + else: + raise IOError("Unable to open file for reading") + +def create_entity(type, *args, **kwargs): + e = entity_instance(type) + attrs = list(enumerate(args)) + \ + [(e.wrapped_data.get_argument_index(name), arg) for name, arg in kwargs.items()] + for idx, arg in attrs: + e[idx] = arg + return e + + +from .main import * diff --git a/ifcopenshell/_ifcopenshell_wrapper.so b/ifcopenshell/_ifcopenshell_wrapper.so new file mode 100644 index 0000000000..87b46bfbc2 Binary files /dev/null and b/ifcopenshell/_ifcopenshell_wrapper.so differ diff --git a/ifcopenshell/entity_instance.py b/ifcopenshell/entity_instance.py new file mode 100644 index 0000000000..313e898e1f --- /dev/null +++ b/ifcopenshell/entity_instance.py @@ -0,0 +1,254 @@ +############################################################################### +# # +# 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 __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import functools +import numbers +import itertools + +from . import ifcopenshell_wrapper + +try: + import logging +except ImportError as e: + logging = type('logger', (object,), {'exception': staticmethod(lambda s: print(s))}) + + +class entity_instance(object): + """This is the base Python class for all IFC objects. + + An instantiated entity_instance will have methods of Python and the IFC class itself. + + Example:: + + ifc_file = ifcopenshell.open(file_path) + products = ifc_file.by_type("IfcProduct") + print(products[0].__class__) + >>> + print(products[0].Representation) + >>> #423=IfcProductDefinitionShape($,$,(#409,#421)) + """ + def __init__(self, e): + if isinstance(e, tuple): + e = ifcopenshell_wrapper.new_IfcBaseClass(*e) + super(entity_instance, self).__setattr__('wrapped_data', e) + + def __getattr__(self, name): + INVALID, FORWARD, INVERSE = range(3) + attr_cat = self.wrapped_data.get_attribute_category(name) + if attr_cat == FORWARD: + return entity_instance.wrap_value( + self.wrapped_data.get_argument(self.wrapped_data.get_argument_index(name))) + elif attr_cat == INVERSE: + return entity_instance.wrap_value(self.wrapped_data.get_inverse(name)) + else: + raise AttributeError( + "entity instance of type '%s' has no attribute '%s'" % (self.wrapped_data.is_a(), name)) + + @staticmethod + def walk(f, g, value): + if isinstance(value, (tuple, list)): + return tuple(map(functools.partial(entity_instance.walk, f, g), value)) + elif f(value): + return g(value) + else: + return value + + @staticmethod + def wrap_value(v): + def wrap(e): return entity_instance(e) + + def is_instance(e): return isinstance(e, ifcopenshell_wrapper.entity_instance) + + return entity_instance.walk(is_instance, wrap, v) + + @staticmethod + def unwrap_value(v): + def unwrap(e): return e.wrapped_data + + def is_instance(e): return isinstance(e, entity_instance) + + return entity_instance.walk(is_instance, unwrap, v) + + def attribute_type(self, attr): + """Return the data type of a positional attribute of the element + + :param attr: The index of the attribute + :type attr: int + :rtype: string + """ + attr_idx = attr if isinstance(attr, numbers.Integral) else self.wrapped_data.get_argument_index(attr) + return self.wrapped_data.get_argument_type(attr_idx) + + def attribute_name(self, attr_idx): + """Return the name of a positional attribute of the element + + :param attr_idx: The index of the attribute + :type attr_idx: int + :rtype: string + """ + return self.wrapped_data.get_argument_name(attr_idx) + + def __setattr__(self, key, value): + self[self.wrapped_data.get_argument_index(key)] = value + + def __getitem__(self, key): + if key < 0 or key >= len(self): + raise IndexError("Attribute index {} out of range for instance of type {}".format(key, self.is_a())) + return entity_instance.wrap_value(self.wrapped_data.get_argument(key)) + + def __setitem__(self, idx, value): + attr_type = real_attr_type = self.attribute_type(idx).title().replace(' ', '') + real_attr_type = real_attr_type.replace('Derived', 'None') + attr_type = attr_type.replace('Binary', 'String') + attr_type = attr_type.replace('Enumeration', 'String') + + if value is None: + if attr_type != "Derived": + self.wrapped_data.setArgumentAsNull(idx) + else: + valid = attr_type != "Derived" + if valid: + try: + if isinstance(value, unicode): + value = value.encode("utf-8") + except BaseException: + pass + + try: + if attr_type != "Derived": + getattr(self.wrapped_data, "setArgumentAs%s" % attr_type)(idx, entity_instance.unwrap_value(value)) + except BaseException as e: + valid = False + + if not valid: + raise ValueError("Expected %s for attribute %s.%s, got %r" % ( + real_attr_type, self.is_a(), self.attribute_name(idx), value)) + + return value + + def __len__(self): + return len(self.wrapped_data) + + def __repr__(self): + return repr(self.wrapped_data) + + def is_a(self, *args): + """Return the IFC class name of an instance, or checks if an instance belongs to a class. + + The check will also return true if a parent class name is provided. + + :param args: If specified, is a case insensitive IFC class name to check + :type args: string + :returns: Either the name of the class, or a boolean if it passes the check + :rtype: string|bool + + Example:: + + f = ifcopenshell.file() + f.create_entity('IfcPerson') + f.is_a() + >>> 'IfcPerson' + f.is_a('IfcPerson') + >>> True + """ + return self.wrapped_data.is_a(*args) + + def id(self): + """Return the STEP numerical identifier + + :rtype: int + """ + return self.wrapped_data.id() + + def __eq__(self, other): + if not isinstance(self, type(other)): + return False + return self.wrapped_data == other.wrapped_data + + def __hash__(self): + return hash((self.id(), self.wrapped_data.file_pointer())) + + def __dir__(self): + return sorted(set(itertools.chain( + dir(type(self)), + map(str, self.wrapped_data.get_attribute_names()), + map(str, self.wrapped_data.get_inverse_attribute_names()) + ))) + + def get_info(self, include_identifier=True, recursive=False, return_type=dict, ignore=()): + """Return a dictionary of the entity_instance's properties (Python and IFC) and their values. + + :param include_identifier: Whether or not to include the STEP numerical identifier + :type include_identifier: bool + :param recursive: Whether or not to convert referenced IFC elements into dictionaries too. All attributes also apply recursively + :type recursive: bool + :param return_type: The return data type to be casted into + :type return_type: dict|list|other + :param ignore: A list of attribute names to ignore + :type ignore: set|list + :returns: A dictionary of properties and their corresponding values + :rtype: dict + + Example:: + + ifc_file = ifcopenshell.open(file_path) + products = ifc_file.by_type("IfcProduct") + obj_info = products[0].get_info() + print(obj_info.keys()) + >>> dict_keys(['Description', 'Name', 'BuildingAddress', 'LongName', 'GlobalId', 'ObjectPlacement', 'OwnerHistory', 'ObjectType', + >>> ...'ElevationOfTerrain', 'CompositionType', 'id', 'Representation', 'type', 'ElevationOfRefHeight']) + """ + def _(): + try: + if include_identifier: + yield "id", self.id() + yield "type", self.is_a() + except BaseException: + logging.exception("unhandled exception while getting id / type info on {}".format(self)) + for i in range(len(self)): + try: + if self.wrapped_data.get_attribute_names()[i] in ignore: + continue + attr_value = self[i] + if recursive: + def is_instance(e): return isinstance(e, entity_instance) + + def get_info_(inst): + # for ty in ignore: + # if inst.is_a(ty): + # return None + return entity_instance.get_info(inst, + include_identifier=include_identifier, + recursive=recursive, + return_type=return_type, + ignore=ignore + ) + + attr_value = entity_instance.walk(is_instance, get_info_, attr_value) + yield self.attribute_name(i), attr_value + except BaseException: + logging.exception("unhandled exception occurred setting attribute name for {}".format(self)) + + return return_type(_()) + + __dict__ = property(get_info) diff --git a/ifcopenshell/file.py b/ifcopenshell/file.py new file mode 100644 index 0000000000..a16c7d6835 --- /dev/null +++ b/ifcopenshell/file.py @@ -0,0 +1,184 @@ +############################################################################### +# # +# 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 __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import numbers +import functools + +from . import ifcopenshell_wrapper +from .entity_instance import entity_instance + +try: + # Python 2 + basestring +except NameError: + # Python 3 or newer + basestring = (str, bytes) + + +class file(object): + """Base class for containing IFC files. + + Class has instance methods for filtering by element Id, Type, etc. + Instantiated objects can be subscripted by Id or Guid + + Example:: + + ifc_file = ifcopenshell.open(file_path) + products = ifc_file.by_type("IfcProduct") + print(products[0].id(), products[0].GlobalId) + >>> 122 2XQ$n5SLP5MBLyL442paFx + # Subscripting + print(products[0] == ifc_file[122] == ifc_file['2XQ$n5SLP5MBLyL442paFx']) + >>> True + """ + def __init__(self, f=None, schema=None): + if f is not None: + self.wrapped_data = f + else: + args = filter(None, [schema]) + args = map(ifcopenshell_wrapper.schema_by_name, args) + self.wrapped_data = ifcopenshell_wrapper.file(*args) + + def create_entity(self, type, *args, **kwargs): + """Create a new IFC entity in the file. + + :param type: Case insensitive name of the IFC class + :type type: string + :param args: The positional arguments of the IFC class + :param kwargs: The keyword arguments of the IFC class + :returns: An entity instance + :rtype: ifcopenshell.entity_instance.entity_instance + + Example:: + + f = ifcopenshell.file() + f.create_entity('IfcPerson') + >>> #1=IfcPerson($,$,$,$,$,$,$,$) + f.create_entity('IfcPerson', 'Foobar') + >>> #2=IfcPerson('Foobar',$,$,$,$,$,$,$) + f.create_entity('IfcPerson', Identification='Foobar') + >>> #3=IfcPerson('Foobar',$,$,$,$,$,$,$) + """ + e = entity_instance((self.schema, type)) + self.wrapped_data.add(e.wrapped_data) + e.wrapped_data.this.disown() + attrs = list(enumerate(args)) + \ + [(e.wrapped_data.get_argument_index(name), arg) for name, arg in kwargs.items()] + for idx, arg in attrs: + e[idx] = arg + return e + + def __getattr__(self, attr): + if attr[0:6] == 'create': + return functools.partial(self.create_entity, attr[6:]) + else: + return getattr(self.wrapped_data, attr) + + def __getitem__(self, key): + if isinstance(key, numbers.Integral): + return entity_instance(self.wrapped_data.by_id(key)) + elif isinstance(key, basestring): + return entity_instance(self.wrapped_data.by_guid(str(key))) + + def by_id(self, id): + """Return an IFC entity instance filtered by IFC ID. + + :param id: STEP numerical identifier + :type id: int + :returns: An ifcopenshell.entity_instance.entity_instance + :rtype: ifcopenshell.entity_instance.entity_instance + """ + return self[id] + + def by_guid(self, guid): + """Return an IFC entity instance filtered by IFC GUID. + + :param guid: GlobalId value in 22-character encoded form + :type guid: string + :returns: An ifcopenshell.entity_instance.entity_instance + :rtype: ifcopenshell.entity_instance.entity_instance + """ + return self[guid] + + def add(self, inst): + """Adds an entity including any dependent entities to an IFC file. + + If the entity already exists, it is not re-added.""" + inst.wrapped_data.this.disown() + return entity_instance(self.wrapped_data.add(inst.wrapped_data)) + + def by_type(self, type): + """Return IFC objects filtered by IFC Type and wrapped with the entity_instance class. + + If an IFC type class has subclasses, all entities of those subclasses are also returned. + + :param type: The case insensitive type of IFC class to return. + :type type: string + :returns: A list of ifcopenshell.entity_instance.entity_instance objects + :rtype: list + """ + return [entity_instance(e) for e in self.wrapped_data.by_type(type)] + + def traverse(self, inst, max_levels=None): + """Get a list of all referenced instances for a particular instance including itself + + :param inst: The entity instance to get all sub instances + :type inst: ifcopenshell.entity_instance.entity_instance + :param max_levels: How far deep to recursively fetch sub instances. None or -1 means infinite. + :type max_levels: None|int + :returns: A list of ifcopenshell.entity_instance.entity_instance objects + :rtype: list + """ + if max_levels is None: + max_levels = -1 + return [entity_instance(e) for e in self.wrapped_data.traverse(inst.wrapped_data, max_levels)] + + def get_inverse(self, inst): + """Return a list of entities that reference this entity + + :param inst: The entity instance to get inverse relationships + :type inst: ifcopenshell.entity_instance.entity_instance + :returns: A list of ifcopenshell.entity_instance.entity_instance objects + :rtype: list + """ + return [entity_instance(e) for e in self.wrapped_data.get_inverse(inst.wrapped_data)] + + def remove(self, inst): + """Deletes an IFC object in the file. + + Attribute values in other entity instances that reference the deleted + object will be set to null. In the case of a list or set of references, + the reference to the deleted will be removed from the aggregate. + + :param inst: The entity instance to delete + :type inst: ifcopenshell.entity_instance.entity_instance + :rtype: None + """ + return self.wrapped_data.remove(inst.wrapped_data) + + def __iter__(self): + return iter(self[id] for id in self.wrapped_data.entity_names()) + + @staticmethod + def from_string(s): + return file(ifcopenshell_wrapper.read(s)) diff --git a/ifcopenshell/geom/__init__.py b/ifcopenshell/geom/__init__.py new file mode 100644 index 0000000000..04db49a6e2 --- /dev/null +++ b/ifcopenshell/geom/__init__.py @@ -0,0 +1,45 @@ +############################################################################### +# # +# 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 __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +def _has_occ(): + try: + import OCC.Core.BRepTools + return True + except ImportError: + pass + + try: + import OCC.BRepTools + return True + except ImportError: + pass + + return False + + +has_occ = _has_occ() + +if has_occ: + from . import occ_utils as utils + +from .main import * diff --git a/ifcopenshell/geom/app.py b/ifcopenshell/geom/app.py new file mode 100644 index 0000000000..16bfdb8349 --- /dev/null +++ b/ifcopenshell/geom/app.py @@ -0,0 +1,647 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import os +import sys +import time +import operator +import functools +import multiprocessing + +import OCC.AIS + +from collections import defaultdict, Iterable, OrderedDict + +try: + QString = unicode +except NameError: + # Python 3 + QString = str + +os.environ['QT_API'] = 'pyqt5' +try: + from pyqode.qt import QtCore +except BaseException: + pass + +from PyQt5 import QtCore, QtGui, QtWidgets + +from .code_editor_pane import code_edit + +try: + from OCC.Display.pyqt5Display import qtViewer3d +except BaseException: + import OCC.Display + + try: + import OCC.Display.backend + except BaseException: + pass + + try: + OCC.Display.backend.get_backend("qt-pyqt5") + except BaseException: + OCC.Display.backend.load_backend("qt-pyqt5") + + 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 + +if ifcopenshell_version < "0.6": + # not yet ported + from .. import get_supertype + +class geometry_creation_signals(QtCore.QObject): + completed = QtCore.pyqtSignal('PyQt_PyObject') + progress = QtCore.pyqtSignal('PyQt_PyObject') + +class geometry_creation_thread(QtCore.QThread): + def __init__(self, signals, settings, f): + QtCore.QThread.__init__(self) + self.signals = signals + self.settings = settings + self.f = f + + def run(self): + t0 = time.time() + + # detect concurrency from hardware, we need to have + # at least two threads because otherwise the interface + # is different + # is different + it = iterator(self.settings, self.f, max(2, multiprocessing.cpu_count())) + if not it.initialize(): + self.signals.completed.emit([]) + return + + def _(): + + old_progress = -1 + while True: + shape = it.get() + + if shape: + yield shape + + if not it.next(): + break + + self.signals.completed.emit((it, self.f, list(_()))) + +class configuration(object): + def __init__(self): + try: + import ConfigParser + Cfg = ConfigParser.RawConfigParser + except BaseException: + import configparser + + def Cfg(): + return configparser.ConfigParser(interpolation=None) + + conf_file = os.path.expanduser(os.path.join("~", ".ifcopenshell", "app", "snippets.conf")) + if conf_file.startswith("~"): + conf_file = None + return + + self.config_encode = lambda s: s.replace("\\", "\\\\").replace("\n", "\n|") + self.config_decode = lambda s: s.replace("\n|", "\n").replace("\\\\", "\\") + + if not os.path.exists(os.path.dirname(conf_file)): + os.makedirs(os.path.dirname(conf_file)) + + if not os.path.exists(conf_file): + config = Cfg() + config.add_section("snippets") + config.set("snippets", "print all wall ids", 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 # +########################################################################### + +for wall in model.by_type("IfcWall"): + print ("wall with global id: "+str(wall.GlobalId)) +""".lstrip())) + + config.set("snippets", "print properties of current selection", self.config_encode(""" +########################################################################### +# A simple script that iterates over all IfcPropertySets of the currently # +# selected object and prints them to the console # +########################################################################### + +# check if something is selected +if selection: + #get the IfcProduct that is stored in the global variable 'selection' + obj = selection + for relDefinesByProperties in obj.IsDefinedBy: + print("[{0}]".format(relDefinesByProperties.RelatingPropertyDefinition.Name)) + for prop in relDefinesByProperties.RelatingPropertyDefinition.HasProperties: + print ("{:<20} :{}".format(prop.Name,prop.NominalValue.wrappedValue)) + print ("\\n") +""".lstrip())) + with open(conf_file, 'w') as configfile: + config.write(configfile) + + self.config = Cfg() + self.config.read(conf_file) + + def options(self, s): + return OrderedDict([(k, self.config_decode(self.config.get(s, k))) for k in self.config.options(s)]) + + +class application(QtWidgets.QApplication): + """A pythonOCC, PyQt based IfcOpenShell application + with two tree views and a graphical 3d view""" + + class abstract_treeview(QtWidgets.QTreeWidget): + + """Base class for the two treeview controls""" + + instanceSelected = QtCore.pyqtSignal([object]) + instanceVisibilityChanged = QtCore.pyqtSignal([object, int]) + instanceDisplayModeChanged = QtCore.pyqtSignal([object, int]) + + def __init__(self): + QtWidgets.QTreeView.__init__(self) + self.setColumnCount(len(self.ATTRIBUTES)) + self.setHeaderLabels(self.ATTRIBUTES) + self.children = defaultdict(list) + + def get_children(self, inst): + c = [inst] + i = 0 + while i < len(c): + c.extend(self.children[c[i]]) + i += 1 + return c + + def contextMenuEvent(self, event): + menu = QtWidgets.QMenu(self) + visibility = [menu.addAction("Show"), menu.addAction("Hide")] + displaymode = [menu.addAction("Solid"), menu.addAction("Wireframe")] + action = menu.exec_(self.mapToGlobal(event.pos())) + index = self.selectionModel().currentIndex() + inst = index.data(QtCore.Qt.UserRole) + if hasattr(inst, 'toPyObject'): + inst = inst + if action in visibility: + self.instanceVisibilityChanged.emit(inst, visibility.index(action)) + elif action in displaymode: + self.instanceDisplayModeChanged.emit(inst, displaymode.index(action)) + + def clicked_(self, index): + inst = index.data(QtCore.Qt.UserRole) + if hasattr(inst, 'toPyObject'): + inst = inst + if inst: + self.instanceSelected.emit(inst) + + def select(self, product): + itm = self.product_to_item.get(product) + if itm is None: + return + self.selectionModel().setCurrentIndex(itm, + QtCore.QItemSelectionModel.SelectCurrent | QtCore.QItemSelectionModel.Rows) + + class decomposition_treeview(abstract_treeview): + + """Treeview with typical IFC decomposition relationships""" + + ATTRIBUTES = ['Entity', 'GlobalId', 'Name'] + + def parent(self, instance): + if instance.is_a("IfcOpeningElement"): + return instance.VoidsElements[0].RelatingBuildingElement + if instance.is_a("IfcElement"): + fills = instance.FillsVoids + if len(fills): + return fills[0].RelatingOpeningElement + containments = instance.ContainedInStructure + if len(containments): + return containments[0].RelatingStructure + if instance.is_a("IfcObjectDefinition"): + decompositions = instance.Decomposes + if len(decompositions): + return decompositions[0].RelatingObject + + def load_file(self, f, **kwargs): + products = list(f.by_type("IfcProduct")) + list(f.by_type("IfcProject")) + parents = list(map(self.parent, products)) + items = {} + skipped = 0 + ATTRS = self.ATTRIBUTES + while len(items) + skipped < len(products): + for product, parent in zip(products, parents): + if parent is None and not product.is_a("IfcProject"): + skipped += 1 + continue + if (parent is None or parent in items) and product not in items: + sl = [] + for attr in ATTRS: + if attr == 'Entity': + sl.append(product.is_a()) + else: + sl.append(getattr(product, attr) or '') + itm = items[product] = QtWidgets.QTreeWidgetItem(items.get(parent, self), sl) + itm.setData(0, QtCore.Qt.UserRole, product) + self.children[parent].append(product) + self.product_to_item = dict(zip(items.keys(), map(self.indexFromItem, items.values()))) + self.clicked.connect(self.clicked_) + self.expandAll() + + class type_treeview(abstract_treeview): + + """Treeview with typical IFC decomposition relationships""" + + ATTRIBUTES = ['Name'] + + def load_file(self, f, **kwargs): + products = list(f.by_type("IfcProduct")) + types = set(map(lambda i: i.is_a(), products)) + items = {} + for t in types: + def add(t): + s = get_supertype(t) + if s: + add(s) + s2, t2 = map(QString, (s, t)) + if t2 not in items: + itm = items[t2] = QtWidgets.QTreeWidgetItem(items.get(s2, self), [t2]) + itm.setData(0, QtCore.Qt.UserRole, t2) + self.children[s2].append(t2) + + if ifcopenshell_version < "0.6": + add(t) + + for p in products: + t = QString(p.is_a()) + itm = items[p] = QtWidgets.QTreeWidgetItem(items.get(t, self), [p.Name or '']) + itm.setData(0, QtCore.Qt.UserRole, t) + self.children[t].append(p) + + self.product_to_item = dict(zip(items.keys(), map(self.indexFromItem, items.values()))) + self.clicked.connect(self.clicked) + self.expandAll() + + class property_table(QtWidgets.QWidget): + + def __init__(self): + QtWidgets.QWidget.__init__(self) + self.layout = QtWidgets.QVBoxLayout(self) + self.setLayout(self.layout) + self.scroll = QtWidgets.QScrollArea(self) + self.layout.addWidget(self.scroll) + self.scroll.setWidgetResizable(True) + self.scrollContent = QtWidgets.QWidget(self.scroll) + self.scrollLayout = QtWidgets.QVBoxLayout(self.scrollContent) + self.scrollContent.setLayout(self.scrollLayout) + self.scroll.setWidget(self.scrollContent) + self.prop_dict = {} + + # triggered by selection event in either component of parent + def select(self, product): + + # Clear the old contents if any + while self.scrollLayout.count(): + child = self.scrollLayout.takeAt(0) + if child is not None: + if child.widget() is not None: + child.widget().deleteLater() + + self.scroll = QtWidgets.QScrollArea() + self.scroll.setWidgetResizable(True) + + prop_sets = self.prop_dict.get(str(product)) + + if prop_sets is not None: + for k, v in prop_sets: + group_box = QtWidgets.QGroupBox() + + group_box.setTitle(k) + group_layout = QtWidgets.QVBoxLayout() + group_box.setLayout(group_layout) + + for name, value in v.items(): + prop_name = str(name) + + value_str = value + if hasattr(value_str, "wrappedValue"): + value_str = value_str.wrappedValue + + if isinstance(value_str, unicode): + value_str = value_str.encode('utf-8') + else: + value_str = str(value_str) + + if hasattr(value, "is_a"): + type_str = " (%s)" % value.is_a() + else: + type_str = "" + label = QtWidgets.QLabel("%s: %s%s" % (prop_name, value_str, type_str)) + group_layout.addWidget(label) + + group_layout.addStretch() + self.scrollLayout.addWidget(group_box) + + self.scrollLayout.addStretch() + else: + label = QtWidgets.QLabel("No IfcPropertySets asscociated with selected entity instance") + self.scrollLayout.addWidget(label) + + def load_file(self, f, **kwargs): + for p in f.by_type("IfcProduct"): + propsets = [] + + def process_pset(prop_def): + if prop_def is not None: + prop_set_name = prop_def.Name + props = {} + if prop_def.is_a("IfcElementQuantity"): + for q in prop_def.Quantities: + if q.is_a("IfcPhysicalSimpleQuantity"): + props[q.Name] = q[3] + elif prop_def.is_a("IfcPropertySet"): + for prop in prop_def.HasProperties: + if prop.is_a("IfcPropertySingleValue"): + props[prop.Name] = prop.NominalValue + else: + # Entity introduced in IFC4 + # prop_def.is_a("IfcPreDefinedPropertySet"): + for prop in range(4, len(prop_def)): + props[prop_def.attribute_name(prop)] = prop_def[prop] + return prop_set_name, props + + try: + for is_def_by in p.IsDefinedBy: + if is_def_by.is_a("IfcRelDefinesByProperties"): + propsets.append(process_pset(is_def_by.RelatingPropertyDefinition)) + elif is_def_by.is_a("IfcRelDefinesByType"): + type_psets = is_def_by.RelatingType.HasPropertySets + if type_psets is None: + continue + for propset in type_psets: + propsets.append(process_pset(propset)) + except Exception as e: + import traceback + print("failed to load properties: {}".format(e)) + traceback.print_exc() + + if len(propsets): + self.prop_dict[str(p)] = propsets + + print("property set dictionary has {} entries".format(len(self.prop_dict))) + + class viewer(qtViewer3d): + + instanceSelected = QtCore.pyqtSignal([object]) + + @staticmethod + def ais_to_key(ais_handle): + def yield_shapes(): + ais = ais_handle.GetObject() + if hasattr(ais, 'Shape'): + yield ais.Shape() + return + shp = OCC.AIS.Handle_AIS_Shape.DownCast(ais_handle) + if not shp.IsNull(): + yield shp.Shape() + return + mult = ais_handle + if mult.IsNull(): + shp = OCC.AIS.Handle_AIS_Shape.DownCast(ais_handle) + if not shp.IsNull(): + yield shp + else: + li = mult.GetObject().ConnectedTo() + for i in range(li.Length()): + shp = OCC.AIS.Handle_AIS_Shape.DownCast(li.Value(i + 1)) + if not shp.IsNull(): + yield shp + + return tuple(shp.HashCode(1 << 24) for shp in yield_shapes()) + + def __init__(self, widget): + qtViewer3d.__init__(self, widget) + self.ais_to_product = {} + self.product_to_ais = {} + self.counter = 0 + self.window = widget + self.thread = None + + def initialize(self): + self.InitDriver() + self._display.Select = self.HandleSelection + + def finished(self, file_shapes): + it, f, shapes = file_shapes + v = self._display + + t = {0: time.time()} + + def update(dt=None): + t1 = time.time() + if dt is None or t1 - t[0] > dt: + v.FitAll() + v.Repaint() + t[0] = t1 + + for shape in shapes: + ais = display_shape(shape, viewer_handle=v) + product = f[shape.data.id] + + ais.GetObject().SetSelectionPriority(self.counter) + self.ais_to_product[self.counter] = product + self.product_to_ais[product] = ais + self.counter += 1 + + QtWidgets.QApplication.processEvents() + + if product.is_a() in {'IfcSpace', 'IfcOpeningElement'}: + v.Context.Erase(ais, True) + + update(1.) + + update() + + self.thread = None + + def load_file(self, f, setting=None): + + if self.thread is not None: + return + + if setting is None: + setting = settings() + setting.set(setting.INCLUDE_CURVES, True) + setting.set(setting.USE_PYTHON_OPENCASCADE, True) + + self.signals = geometry_creation_signals() + thread = self.thread = geometry_creation_thread(self.signals, setting, f) + self.window.window_closed.connect(lambda *args: thread.terminate()) + self.signals.completed.connect(self.finished) + self.thread.start() + + def select(self, product): + ais = self.product_to_ais.get(product) + if ais is None: + return + v = self._display.Context + v.ClearSelected(False) + v.SetSelected(ais, True) + + def toggle(self, product_or_products, fn): + if not isinstance(product_or_products, Iterable): + product_or_products = [product_or_products] + aiss = list(filter(None, map(self.product_to_ais.get, product_or_products))) + last = len(aiss) - 1 + for i, ais in enumerate(aiss): + fn(ais, i == last) + + def toggle_visibility(self, product_or_products, flag): + v = self._display.Context + if flag: + def visibility(ais, last): + v.Erase(ais, last) + else: + def visibility(ais, last): + v.Display(ais, last) + self.toggle(product_or_products, visibility) + + def toggle_wireframe(self, product_or_products, flag): + v = self._display.Context + if flag: + def wireframe(ais, last): + if v.IsDisplayed(ais): + v.SetDisplayMode(ais, 0, last) + else: + def wireframe(ais, last): + if v.IsDisplayed(ais): + v.SetDisplayMode(ais, 1, last) + self.toggle(product_or_products, wireframe) + + def HandleSelection(self, X, Y): + v = self._display.Context + v.Select() + v.InitSelected() + if v.MoreSelected(): + ais = v.SelectedInteractive() + inst = self.ais_to_product[ais.GetObject().SelectionPriority()] + self.instanceSelected.emit(inst) + + class window(QtWidgets.QMainWindow): + + TITLE = "IfcOpenShell IFC viewer" + + window_closed = QtCore.pyqtSignal([]) + + def __init__(self): + QtWidgets.QMainWindow.__init__(self) + self.setWindowTitle(self.TITLE) + self.menu = self.menuBar() + self.menus = {} + + def closeEvent(self, *args): + self.window_closed.emit() + + def add_menu_item(self, menu, label, callback, icon=None, shortcut=None): + m = self.menus.get(menu) + if m is None: + m = self.menu.addMenu(menu) + self.menus[menu] = m + + if icon: + a = QtWidgets.QAction(QtGui.QIcon(icon), label, self) + else: + a = QtWidgets.QAction(label, self) + + if shortcut: + a.setShortcut(shortcut) + + a.triggered.connect(callback) + m.addAction(a) + + def makeSelectionHandler(self, component): + def handler(inst): + for c in self.components: + if c != component: + c.select(inst) + + return handler + + def __init__(self, settings=None): + QtWidgets.QApplication.__init__(self, sys.argv) + self.window = application.window() + self.tree = application.decomposition_treeview() + self.tree2 = application.type_treeview() + self.propview = self.property_table() + self.canvas = application.viewer(self.window) + self.tabs = QtWidgets.QTabWidget() + self.window.resize(800, 600) + splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal) + splitter.addWidget(self.tabs) + self.tabs.addTab(self.tree, 'Decomposition') + self.tabs.addTab(self.tree2, 'Types') + self.tabs.addTab(self.propview, "Properties") + splitter2 = QtWidgets.QSplitter(QtCore.Qt.Vertical) + splitter2.addWidget(self.canvas) + self.editor = code_edit(self.canvas, configuration().options('snippets')) + splitter2.addWidget(self.editor) + splitter.addWidget(splitter2) + splitter.setSizes([200, 600]) + splitter2.setSizes([400, 200]) + self.window.setCentralWidget(splitter) + self.canvas.initialize() + self.components = [self.tree, self.tree2, self.canvas, self.propview, self.editor] + self.files = {} + + self.window.add_menu_item('File', '&Open', self.browse, shortcut='CTRL+O') + self.window.add_menu_item('File', '&Close', self.clear, shortcut='CTRL+W') + self.window.add_menu_item('File', '&Exit', self.window.close, shortcut='ALT+F4') + + self.tree.instanceSelected.connect(self.makeSelectionHandler(self.tree)) + self.tree2.instanceSelected.connect(self.makeSelectionHandler(self.tree2)) + self.canvas.instanceSelected.connect(self.makeSelectionHandler(self.canvas)) + for t in [self.tree, self.tree2]: + t.instanceVisibilityChanged.connect(functools.partial(self.change_visibility, t)) + t.instanceDisplayModeChanged.connect(functools.partial(self.change_displaymode, t)) + + self.settings = settings + + def change_visibility(self, tree, inst, flag): + insts = tree.get_children(inst) + self.canvas.toggle_visibility(insts, flag) + + def change_displaymode(self, tree, inst, flag): + insts = tree.get_children(inst) + self.canvas.toggle_wireframe(insts, flag) + + def start(self): + self.window.show() + sys.exit(self.exec_()) + + def browse(self): + filename = QtWidgets.QFileDialog.getOpenFileName(self.window, 'Open file', ".", + "Industry Foundation Classes (*.ifc)")[0] + self.load(filename) + + def clear(self): + self.canvas._display.Context.RemoveAll() + self.tree.clear() + self.files.clear() + + def load(self, fn): + if fn in self.files: + return + f = open_ifc_file(str(fn)) + self.files[fn] = f + for c in self.components: + c.load_file(f, setting=self.settings) + + +if __name__ == "__main__": + application().start() diff --git a/ifcopenshell/geom/client.py b/ifcopenshell/geom/client.py new file mode 100644 index 0000000000..d4eca22783 --- /dev/null +++ b/ifcopenshell/geom/client.py @@ -0,0 +1,103 @@ +############################################################################### +# # +# 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 . # +# # +############################################################################### + +""" +Rough draft of a client application for the C++ IfcGeomServer binary +""" + +import os +import numpy +import subprocess + +from collections import namedtuple + +class message_headers(object): + HELLO = 0xff00 + IFC_MODEL = HELLO + 1 + GET = IFC_MODEL + 1 + ENTITY = GET + 1 + MORE = ENTITY + 1 + NEXT = MORE + 1 + BYE = NEXT + 1 + GET_LOG = BYE + 1 + LOG = GET_LOG + 1 + DEFLECTION = LOG + 1 + SETTING = DEFLECTION + 1 + +message = namedtuple("message", ("header", "contents")) + +def process(geomserver_exe, ifc_filename): + + proc = subprocess.Popen([geomserver_exe], stdout=subprocess.PIPE, stdin=subprocess.PIPE) + + def cast(data, dtype, n=None): + arr = numpy.frombuffer(data, dtype=dtype) + if n is None: return arr[0] + else: return arr + + def read(dtype, n=None): + data = proc.stdout.read(dtype().nbytes * (n or 1)) + return cast(data, dtype, n) + + def read_message(header_assertion=None): + header, size = read(numpy.int32, 2) + assert header_assertion is None or header_assertion == header + contents = b"" + if size > 0: + contents = proc.stdout.read(size) + return message(header, contents) + + def write(header, contents=None): + if contents is None: contents = [] + proc.stdin.write(numpy.int32(header).tobytes()) + integers_as_int32 = list(map(lambda s: numpy.int32(s) if isinstance(s, int) else s, contents)) + to_bytes = list(map(lambda s: s.tobytes() if hasattr(s, 'tobytes') else s, integers_as_int32)) + total_length = numpy.int32(sum(map(len, to_bytes))) + proc.stdin.write(total_length.tobytes()) + for b in to_bytes: + proc.stdin.write(b) + proc.stdin.flush() + + read_message(message_headers.HELLO) + + # @todo: no need to read the entire file in memory + s = open(ifc_filename, "rb").read() + + write(message_headers.SETTING, [numpy.int32((1 << 4)), numpy.int32(1)]) + write(message_headers.IFC_MODEL, [numpy.int32(len(s)), s, b"\x00" * ((4 - (len(s) % 4)) % 4)]) + + while True: + has_more = cast(read_message(message_headers.MORE).contents, numpy.int32) == 1 + if not has_more: break + write(message_headers.GET) + print(read_message(message_headers.ENTITY).contents) + write(message_headers.NEXT) + + write(message_headers.BYE) + read_message(message_headers.BYE) + proc.wait() + assert proc.returncode == 0 + +if __name__ == "__main__": + import sys + import platform + exe_extension = ".exe" if platform.system() == 'Windows' else "" + exe = os.environ.get("IFCGEOMSERVER") or ("IfcGeomServer" + exe_extension) + for fn in sys.argv[1:]: + process(exe, fn) diff --git a/ifcopenshell/geom/code_editor_pane.py b/ifcopenshell/geom/code_editor_pane.py new file mode 100644 index 0000000000..b64787f32b --- /dev/null +++ b/ifcopenshell/geom/code_editor_pane.py @@ -0,0 +1,149 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import os +import sys +import logging + +from code import InteractiveConsole +from PyQt5 import QtCore, QtGui, QtWidgets + +try: + from PyQt5 import QtWidgets +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.python.backend import server + from pyqode.python import modes as pymodes, panels as pypanels, widgets + from pyqode.python.widgets import PyInteractiveConsole + + has_pyqode = True +except BaseException: + has_pyqode = False + CodeEdit = QtWidgets.QPlainTextEdit + + +class StdoutRedirector(object): + """A class for redirecting stdout to this Text widget.""" + + def __init__(self, widget): + self.widget = widget + self.isError = False + + def write(self, myStr): + self.widget.moveCursor(QtGui.QTextCursor.End) + if self.isError: + self.widget.setTextColor(QtCore.Qt.red) + else: + self.widget.setTextColor(QtCore.Qt.white) + self.widget.insertPlainText(myStr) + self.widget.moveCursor(QtGui.QTextCursor.End) + + +class code_edit(QtWidgets.QWidget): + class Console(InteractiveConsole): + def __init__(*args): + InteractiveConsole.__init__(*args) + + def enter(self, source): + self.runcode(source) + + def runCode(self): + sys.stdout = StdoutRedirector(self.output) + sys.stderr = StdoutRedirector(self.output) + sys.stderr.isError = True + + if not self.model: + print("please load a model first", file=sys.stderr) + else: + self.c.enter(str(self.editor.toPlainText())) + + sys.stdout = sys.__stdout__ + sys.stderr = sys.__stderr__ + + def select(self, product): + self.c = self.Console({'model': self.model, 'viewer': self.viewer, 'selection': product}) + + def __init__(self, viewer, snippets=None): + self.model = None + self.viewer = viewer + QtWidgets.QWidget.__init__(self) + self.layout = QtWidgets.QVBoxLayout(self) + self.setLayout(self.layout) + self.c = None + self.tools = QtWidgets.QHBoxLayout(self) + self.layout.addLayout(self.tools) + self.runbutton = QtWidgets.QPushButton("Run") + width = self.runbutton.fontMetrics().boundingRect("Run").width() + 20 + self.runbutton.setMaximumWidth(width) + self.tools.addWidget(self.runbutton) + self.runbutton.clicked.connect(self.runCode) + + editor = CodeEdit() + if has_pyqode: + editor.backend.start(server.__file__) + editor.panels.append(panels.FoldingPanel()) + editor.panels.append(panels.LineNumberPanel()) + editor.panels.append(panels.SearchAndReplacePanel(), + panels.SearchAndReplacePanel.Position.BOTTOM) + editor.panels.append(panels.EncodingPanel(), api.Panel.Position.TOP) + editor.add_separator() + editor.panels.append(pypanels.QuickDocPanel(), api.Panel.Position.BOTTOM) + sh = editor.modes.append(PythonSH(editor.document())) + editor.modes.append(modes.CaretLineHighlighterMode()) + editor.modes.append(modes.CodeCompletionMode()) + editor.modes.append(modes.ExtendedSelectionMode()) + editor.modes.append(modes.FileWatcherMode()) + editor.modes.append(modes.OccurrencesHighlighterMode()) + editor.modes.append(modes.RightMarginMode()) + editor.modes.append(modes.SmartBackSpaceMode()) + editor.modes.append(modes.SymbolMatcherMode()) + editor.modes.append(modes.ZoomMode()) + editor.modes.append(pymodes.CommentsMode()) + editor.modes.append(pymodes.CalltipsMode()) + auto = pymodes.PyAutoCompleteMode() + auto.logger.setLevel(logging.CRITICAL) + editor.modes.append(auto) + editor.modes.append(pymodes.PyAutoIndentMode()) + editor.modes.append(pymodes.PyIndenterMode()) + editor.show() + else: + editor.setStyleSheet('font-size: 10pt; font-family: Consolas, Courier;') + + self.editor = editor + self.snippets = snippets + if self.snippets: + self.list = QtWidgets.QComboBox(self) + self.replace_snippet(0) + for snip_name in self.snippets.keys(): + self.list.addItem(snip_name) + self.tools.addWidget(self.list) + self.list.currentIndexChanged[int].connect(self.replace_snippet) + + self.layout.addWidget(self.editor) + self.output = QtWidgets.QTextEdit() + self.output.setReadOnly(True) + self.output.setStyleSheet('font-size: 10pt; font-family: Consolas, Courier; background-color: #444;') + self.layout.addWidget(self.output) + + def replace_snippet(self, number=None): + snip = list(self.snippets.values())[number] + if has_pyqode: + self.editor.setPlainText(snip, "", "") + else: + self.editor.setPlainText(snip) + + def load_file(self, f, **kwargs): + output = [] + sys.stdout = StdoutRedirector(self.output) + self.model = f + self.c = self.Console({'model': self.model, 'selection': None, 'viewer': self.viewer}) + sys.stdout = sys.__stdout__ diff --git a/ifcopenshell/geom/main.py b/ifcopenshell/geom/main.py new file mode 100644 index 0000000000..8421a389b7 --- /dev/null +++ b/ifcopenshell/geom/main.py @@ -0,0 +1,193 @@ +############################################################################### +# # +# 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 __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import os +import sys + +from .. import ifcopenshell_wrapper +from ..file import file +from ..entity_instance import entity_instance + +from . import has_occ + + +def wrap_shape_creation(settings, shape): + return shape + + +if has_occ: + from . import occ_utils as utils + + try: + from OCC.Core import TopoDS + except ImportError: + from OCC import TopoDS + + def wrap_shape_creation(settings, shape): + if getattr(settings, 'use_python_opencascade', False): + return utils.create_shape_from_serialization(shape) + else: + return shape + +# Subclass the settings module to provide an additional +# setting to enable pythonOCC when available +class settings(ifcopenshell_wrapper.settings): + if has_occ: + USE_PYTHON_OPENCASCADE = -1 + + def set(self, *args): + setting, value = args + if setting == settings.USE_PYTHON_OPENCASCADE: + self.set(settings.USE_BREP_DATA, value) + self.set(settings.USE_WORLD_COORDS, value) + self.set(settings.DISABLE_TRIANGULATION, value) + self.use_python_opencascade = value + else: + ifcopenshell_wrapper.settings.set(self, *args) + + +# Assert templated precision to match Python's internal float type +assert ifcopenshell_wrapper.iterator_double_precision.mantissa_size() == sys.float_info.mant_dig +_iterator = ifcopenshell_wrapper.iterator_double_precision + +# Make sure people are able to use python's platform agnostic paths +class iterator(_iterator): + def __init__(self, settings, file_or_filename, num_threads = 1): + self.settings = settings + if isinstance(file_or_filename, file): + file_or_filename = file_or_filename.wrapped_data + else: + file_or_filename = os.path.abspath(file_or_filename) + _iterator.__init__(self, settings, file_or_filename, num_threads) + + if has_occ: + def get(self): + return wrap_shape_creation(self.settings, _iterator.get(self)) + + def __iter__(self): + if self.initialize(): + while True: + yield self.get() + if not self.next(): break + +class tree(ifcopenshell_wrapper.tree): + + def __init__(self, file=None, settings=None): + args = [self] + if file is not None: + args.append(file.wrapped_data) + if settings is not None: + args.append(settings) + ifcopenshell_wrapper.tree.__init__(*args) + + def add_file(self, file, settings): + ifcopenshell_wrapper.tree.add_file(self, file.wrapped_data, settings) + + def select(self, value, **kwargs): + def unwrap(value): + if isinstance(value, entity_instance): + return value.wrapped_data + elif all(map(lambda v: hasattr(value, v), "XYZ")): + return value.X(), value.Y(), value.Z() + return value + + args = [self, unwrap(value)] + if isinstance(value, entity_instance): + args.append(kwargs.get("completely_within", False)) + elif has_occ: + if isinstance(value, TopoDS.TopoDS_Shape): + args[1] = utils.serialize_shape(value) + return [entity_instance(e) for e in ifcopenshell_wrapper.tree.select(*args)] + + def select_box(self, value, **kwargs): + def unwrap(value): + if isinstance(value, entity_instance): + return value.wrapped_data + elif hasattr(value, "Get"): + return value.Get()[:3], value.Get()[3:] + return value + + args = [self, unwrap(value)] + if "extend" in kwargs or "completely_within" in kwargs: + args.append(kwargs.get("completely_within", False)) + if "extend" in kwargs: + args.append(kwargs.get("extend", -1.e-5)) + return [entity_instance(e) for e in ifcopenshell_wrapper.tree.select_box(*args)] + + +def create_shape(settings, inst, repr=None): + """ + Return a geometric representation from STEP-based IFCREPRESENTATIONSHAPE + or + Return an OpenCASCADE BRep if settings.USE_PYTHON_OPENCASCADE == True + + example: + + settings = ifcopenshell.geom.settings() + settings.set(settings.USE_PYTHON_OPENCASCADE, True) + + ifc_file = ifcopenshell.open(file_path) + products = ifc_file.by_type("IfcProduct") + + for i, product in enumerate(products): + if product.Representation is not None: + try: + shape = geom.create_shape(settings, inst=product).geometry + shape_gpXYZ = shape.Location().Transformation().TranslationPart() # These are methods of the TopoDS_Shape class from pythonOCC + print(shape_gpXYZ.X(), shape_gpXYZ.Y(), shape_gpXYZ.Z()) # These are methods of the gpXYZ class from pythonOCC + """ + return wrap_shape_creation( + settings, + ifcopenshell_wrapper.create_shape( + settings, + inst.wrapped_data, + repr.wrapped_data if repr is not None else None + )) + + +def iterate(settings, filename): + it = iterator(settings, filename) + if it.initialize(): + while True: + yield it.get() + if not it.next(): + break + + +def make_shape_function(fn): + def entity_instance_or_none(e): + return None if e is None else entity_instance(e) + + if has_occ: + def _(schema, string_or_shape, *args): + if isinstance(string_or_shape, TopoDS.TopoDS_Shape): + string_or_shape = utils.serialize_shape(string_or_shape) + return entity_instance_or_none(fn(schema, string_or_shape, *args)) + else: + def _(schema, string, *args): + return entity_instance_or_none(fn(schema, string, *args)) + return _ + + +serialise = make_shape_function(ifcopenshell_wrapper.serialise) +tesselate = make_shape_function(ifcopenshell_wrapper.tesselate) diff --git a/ifcopenshell/geom/occ_utils.py b/ifcopenshell/geom/occ_utils.py new file mode 100644 index 0000000000..0565f836fb --- /dev/null +++ b/ifcopenshell/geom/occ_utils.py @@ -0,0 +1,233 @@ +############################################################################### +# # +# 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 __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import random +import operator +import warnings + +from collections import namedtuple, Iterable + +try: + from OCC.Core import V3d, TopoDS, gp, AIS, Quantity, BRepTools, Graphic3d +except ImportError: + from OCC import V3d, TopoDS, gp, AIS, Quantity, BRepTools, Graphic3d + +shape_tuple = namedtuple('shape_tuple', ('data', 'geometry', 'styles')) + +handle, main_loop, add_menu, add_function_to_menu = None, None, None, None + +DEFAULT_STYLES = { + "DEFAULT": (.7, .7, .7), + "IfcWall": (.8, .8, .8), + "IfcSite": (.75, .8, .65), + "IfcSlab": (.4, .4, .4), + "IfcWallStandardCase": (.9, .9, .9), + "IfcWall": (.9, .9, .9), + "IfcWindow": (.75, .8, .75, .3), + "IfcDoor": (.55, .3, .15), + "IfcBeam": (.75, .7, .7), + "IfcRailing": (.65, .6, .6), + "IfcMember": (.65, .6, .6), + "IfcPlate": (.8, .8, .8) +} + + +def initialize_display(): + 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() + + def setup(): + viewer_handle = handle.GetViewer() + viewer = viewer_handle.GetObject() if hasattr(viewer_handle, "GetObject") else viewer_handle + + def lights(): + viewer.InitActiveLights() + for _ in range(2): + try: + active_light = viewer.ActiveLight() + except BaseException: + break + yield active_light + viewer.NextActiveLights() + + lights = list(lights()) + for l in lights: + viewer.DelLight(l) + + for dir in [V3d.V3d_TypeOfOrientation_Yup_AxoRight, V3d.V3d_TypeOfOrientation_Zup_AxoRight]: + light = V3d.V3d_DirectionalLight(viewer_handle) + light.SetDirection(dir) + viewer.SetLightOn(light) + + setup() + return handle + + +def yield_subshapes(shape): + it = TopoDS.TopoDS_Iterator(shape) + while it.More(): + yield it.Value() + it.Next() + + +def display_shape(shape, clr=None, viewer_handle=None): + if viewer_handle is None: + viewer_handle = handle + + if isinstance(shape, shape_tuple): + shape, representation = shape.geometry, shape + else: + representation = None + + material = Graphic3d.Graphic3d_MaterialAspect(Graphic3d.Graphic3d_NOM_PLASTER) + + if representation and not clr: + if len(set(representation.styles)) == 1: + clr = representation.styles[0] + if min(clr) < 0. or max(clr) > 1.: + clr = DEFAULT_STYLES.get(representation.data.type, DEFAULT_STYLES["DEFAULT"]) + + if clr: + ais = AIS.AIS_Shape(shape) + ais.SetMaterial(material) + + if isinstance(clr, str): + qclr = getattr(Quantity, "Quantity_NOC_%s" % clr.upper(), + getattr(Quantity, "Quantity_NOC_%s1" % clr.upper(), None)) + if qclr is None: + raise Exception("No color named '%s'" % clr.upper()) + elif isinstance(clr, Iterable): + clr = tuple(clr) + if len(clr) < 3 or len(clr) > 4: + raise Exception("Need 3 or 4 color components. Got '%r'." % len(clr)) + qclr = Quantity.Quantity_Color(clr[0], clr[1], clr[2], Quantity.Quantity_TOC_RGB) + elif isinstance(clr, Quantity.Quantity_Color): + qclr = clr + else: + raise Exception("Object of type %r cannot be used as a color." % type(clr)) + + ais.SetColor(qclr) + if isinstance(clr, tuple) and len(clr) == 4 and clr[3] < 1.: + ais.SetTransparency(1. - clr[3]) + + elif representation and hasattr(AIS, "AIS_MultipleConnectedShape"): + default_style_applied = None + + ais = AIS.AIS_MultipleConnectedShape(shape) + + subshapes = list(yield_subshapes(shape)) + lens = len(representation.styles), len(subshapes) + if lens[0] != lens[1]: + warnings.warn("Unable to assign styles to subshapes. Encountered %d styles for %d shapes." % lens) + else: + for shp, stl in zip(subshapes, representation.styles): + subshape = AIS.AIS_Shape(shp) + if min(stl) < 0. or max(stl) > 1.: + default_style_applied = stl = DEFAULT_STYLES.get(representation.data.type, + DEFAULT_STYLES["DEFAULT"]) + subshape.SetColor(Quantity.Quantity_Color(stl[0], stl[1], stl[2], Quantity.Quantity_TOC_RGB)) + subshape.SetMaterial(material) + if len(stl) == 4 and stl[3] < 1.: + subshape.SetTransparency(1. - stl[3]) + ais.Connect(subshape.GetHandle()) + + # For some reason it is necessary to set transparency here again + # in order for transparency to be rendered on the subshape. + applied_styles = representation.styles + if default_style_applied: + if len(default_style_applied) == 3: + default_style_applied += (1.,) + applied_styles += (default_style_applied,) + + if len(applied_styles): + # The only way for this not to be true if is the entire shape is NULL + min_transp = min(map(operator.itemgetter(3), applied_styles)) + if min_transp < 1.: + ais.SetTransparency(1.) + + else: + ais = AIS.AIS_Shape(shape) + ais.SetMaterial(material) + + def r(): + return random.random() * 0.3 + 0.7 + + clr = Quantity.Quantity_Color(r(), r(), r(), Quantity.Quantity_TOC_RGB) + ais.SetColor(clr) + + ais_handle = ais + viewer_handle.Context.Display(ais_handle, False) + + return ais_handle + + +def set_shape_transparency(ais, t): + handle.Context.SetTransparency(ais, t) + + +def get_bounding_box_center(bbox): + bbmin = [0.] * 3 + bbmax = [0.] * 3 + bbmin[0], bbmin[1], bbmin[2], bbmax[0], bbmax[1], bbmax[2] = bbox.Get() + return gp.gp_Pnt(*map(lambda xy: (xy[0] + xy[1]) / 2., zip(bbmin, bbmax))) + + +def serialize_shape(shape): + shapes = BRepTools.BRepTools_ShapeSet() + shapes.Add(shape) + return shapes.WriteToString() + + +def create_shape_from_serialization(brep_object): + brep_data, occ_shape, styles = None, None, () + + is_product_shape = True + try: + brep_data = brep_object.geometry.brep_data + styles = brep_object.geometry.surface_styles + except BaseException: + try: + brep_data = brep_object.brep_data + styles = brep_object.surface_styles + is_product_shape = False + except BaseException: + pass + + styles = tuple(styles[i:i + 4] for i in range(0, len(styles), 4)) + + if not brep_data: + return shape_tuple(brep_object, None, styles) + + try: + ss = BRepTools.BRepTools_ShapeSet() + ss.ReadFromString(brep_data) + occ_shape = ss.Shape(ss.NbShapes()) + except BaseException: + pass + + if is_product_shape: + return shape_tuple(brep_object, occ_shape, styles) + else: + return occ_shape diff --git a/ifcopenshell/guid.py b/ifcopenshell/guid.py new file mode 100644 index 0000000000..b14ce43f4e --- /dev/null +++ b/ifcopenshell/guid.py @@ -0,0 +1,57 @@ +############################################################################### +# # +# 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 __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import uuid +import string + +from functools import reduce + +chars = string.digits + string.ascii_uppercase + string.ascii_lowercase + '_$' + + +def compress(g): + bs = [int(g[i:i + 2], 16) for i in range(0, len(g), 2)] + + def b64(v, l=4): + return ''.join([chars[(v // (64 ** i)) % 64] for i in range(l)][::-1]) + + 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 b64(v): + return reduce(lambda a, b: a * 64 + b, map(lambda c: chars.index(c), v)) + + bs = [b64(g[0:2])] + for i in range(5): + d = b64(g[2 + 4 * i:6 + 4 * i]) + bs += [(d >> (8 * (2 - j))) % 256 for j in range(3)] + return ''.join(['%02x' % b for b in bs]) + + +def split(g): + return '{%s-%s-%s-%s-%s}' % (g[:8], g[8:12], g[12:16], g[16:20], g[20:]) + + +def new(): + return compress(uuid.uuid4().hex) diff --git a/ifcopenshell/ifcopenshell_wrapper.py b/ifcopenshell/ifcopenshell_wrapper.py new file mode 100644 index 0000000000..f30ef71574 --- /dev/null +++ b/ifcopenshell/ifcopenshell_wrapper.py @@ -0,0 +1,2417 @@ +# This file was automatically generated by SWIG (http://www.swig.org). +# Version 3.0.12 +# +# Do not make changes to this file unless you know what you are doing--modify +# the SWIG interface file instead. + +from sys import version_info as _swig_python_version_info +if _swig_python_version_info >= (2, 7, 0): + def swig_import_helper(): + import importlib + pkg = __name__.rpartition('.')[0] + mname = '.'.join((pkg, '_ifcopenshell_wrapper')).lstrip('.') + try: + return importlib.import_module(mname) + except ImportError: + return importlib.import_module('_ifcopenshell_wrapper') + _ifcopenshell_wrapper = swig_import_helper() + del swig_import_helper +elif _swig_python_version_info >= (2, 6, 0): + def swig_import_helper(): + from os.path import dirname + import imp + fp = None + try: + fp, pathname, description = imp.find_module('_ifcopenshell_wrapper', [dirname(__file__)]) + except ImportError: + import _ifcopenshell_wrapper + return _ifcopenshell_wrapper + try: + _mod = imp.load_module('_ifcopenshell_wrapper', fp, pathname, description) + finally: + if fp is not None: + fp.close() + return _mod + _ifcopenshell_wrapper = swig_import_helper() + del swig_import_helper +else: + import _ifcopenshell_wrapper +del _swig_python_version_info + +try: + _swig_property = property +except NameError: + pass # Python < 2.2 doesn't have 'property'. + +try: + import builtins as __builtin__ +except ImportError: + import __builtin__ + +def _swig_setattr_nondynamic(self, class_type, name, value, static=1): + if (name == "thisown"): + return self.this.own(value) + if (name == "this"): + if type(value).__name__ == 'SwigPyObject': + self.__dict__[name] = value + return + method = class_type.__swig_setmethods__.get(name, None) + if method: + return method(self, value) + if (not static): + if _newclass: + object.__setattr__(self, name, value) + else: + self.__dict__[name] = value + else: + raise AttributeError("You cannot add attributes to %s" % self) + + +def _swig_setattr(self, class_type, name, value): + return _swig_setattr_nondynamic(self, class_type, name, value, 0) + + +def _swig_getattr(self, class_type, name): + if (name == "thisown"): + return self.this.own() + method = class_type.__swig_getmethods__.get(name, None) + if method: + return method(self) + raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name)) + + +def _swig_repr(self): + try: + strthis = "proxy of " + self.this.__repr__() + except __builtin__.Exception: + strthis = "" + return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) + +try: + _object = object + _newclass = 1 +except __builtin__.Exception: + class _object: + pass + _newclass = 0 + +class settings(_object): + """Proxy of C++ IfcGeom::IteratorSettings class.""" + + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, settings, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, settings, name) + __repr__ = _swig_repr + WELD_VERTICES = _ifcopenshell_wrapper.settings_WELD_VERTICES + USE_WORLD_COORDS = _ifcopenshell_wrapper.settings_USE_WORLD_COORDS + CONVERT_BACK_UNITS = _ifcopenshell_wrapper.settings_CONVERT_BACK_UNITS + USE_BREP_DATA = _ifcopenshell_wrapper.settings_USE_BREP_DATA + SEW_SHELLS = _ifcopenshell_wrapper.settings_SEW_SHELLS + FASTER_BOOLEANS = _ifcopenshell_wrapper.settings_FASTER_BOOLEANS + DISABLE_OPENING_SUBTRACTIONS = _ifcopenshell_wrapper.settings_DISABLE_OPENING_SUBTRACTIONS + DISABLE_TRIANGULATION = _ifcopenshell_wrapper.settings_DISABLE_TRIANGULATION + APPLY_DEFAULT_MATERIALS = _ifcopenshell_wrapper.settings_APPLY_DEFAULT_MATERIALS + INCLUDE_CURVES = _ifcopenshell_wrapper.settings_INCLUDE_CURVES + EXCLUDE_SOLIDS_AND_SURFACES = _ifcopenshell_wrapper.settings_EXCLUDE_SOLIDS_AND_SURFACES + NO_NORMALS = _ifcopenshell_wrapper.settings_NO_NORMALS + GENERATE_UVS = _ifcopenshell_wrapper.settings_GENERATE_UVS + APPLY_LAYERSETS = _ifcopenshell_wrapper.settings_APPLY_LAYERSETS + SEARCH_FLOOR = _ifcopenshell_wrapper.settings_SEARCH_FLOOR + SITE_LOCAL_PLACEMENT = _ifcopenshell_wrapper.settings_SITE_LOCAL_PLACEMENT + BUILDING_LOCAL_PLACEMENT = _ifcopenshell_wrapper.settings_BUILDING_LOCAL_PLACEMENT + VALIDATE_QUANTITIES = _ifcopenshell_wrapper.settings_VALIDATE_QUANTITIES + NUM_SETTINGS = _ifcopenshell_wrapper.settings_NUM_SETTINGS + + def __init__(self): + """__init__(IfcGeom::IteratorSettings self) -> settings""" + this = _ifcopenshell_wrapper.new_settings() + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + + def deflection_tolerance(self): + """deflection_tolerance(settings self) -> double""" + return _ifcopenshell_wrapper.settings_deflection_tolerance(self) + + + def set_deflection_tolerance(self, value): + """set_deflection_tolerance(settings self, double value)""" + return _ifcopenshell_wrapper.settings_set_deflection_tolerance(self, value) + + + def get(self, setting): + """get(settings self, IfcGeom::IteratorSettings::SettingField setting) -> bool""" + return _ifcopenshell_wrapper.settings_get(self, setting) + + + def set(self, setting, value): + """set(settings self, IfcGeom::IteratorSettings::SettingField setting, bool value)""" + return _ifcopenshell_wrapper.settings_set(self, setting, value) + + + attrs = ("convert_back_units", "deflection_tolerance", "disable_opening_subtractions", "disable_triangulation", "faster_booleans", "sew_shells", "use_brep_data", "use_world_coords", "weld_vertices") + def __repr__(self): + return "%s(%s)"%(self.__class__.__name__, ",".join(tuple("%s=%r"%(a, getattr(self, a)()) for a in self.attrs))) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_settings + __del__ = lambda self: None +settings_swigregister = _ifcopenshell_wrapper.settings_swigregister +settings_swigregister(settings) + +class ElementSettings(settings): + """Proxy of C++ IfcGeom::ElementSettings class.""" + + __swig_setmethods__ = {} + for _s in [settings]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, ElementSettings, name, value) + __swig_getmethods__ = {} + for _s in [settings]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, ElementSettings, name) + __repr__ = _swig_repr + + def __init__(self, settings, unit_magnitude, element_type): + """__init__(IfcGeom::ElementSettings self, settings settings, double unit_magnitude, std::string const & element_type) -> ElementSettings""" + this = _ifcopenshell_wrapper.new_ElementSettings(settings, unit_magnitude, element_type) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + + def unit_magnitude(self): + """unit_magnitude(ElementSettings self) -> double""" + return _ifcopenshell_wrapper.ElementSettings_unit_magnitude(self) + + + def element_type(self): + """element_type(ElementSettings self) -> std::string const &""" + return _ifcopenshell_wrapper.ElementSettings_element_type(self) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_ElementSettings + __del__ = lambda self: None +ElementSettings_swigregister = _ifcopenshell_wrapper.ElementSettings_swigregister +ElementSettings_swigregister(ElementSettings) + +class Material(_object): + """Proxy of C++ IfcGeom::Material class.""" + + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, Material, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, Material, name) + __repr__ = _swig_repr + + def __init__(self, style=None): + """ + __init__(IfcGeom::Material self, IfcGeom::SurfaceStyle const * style=None) -> Material + __init__(IfcGeom::Material self) -> Material + """ + this = _ifcopenshell_wrapper.new_Material(style) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + + def hasDiffuse(self): + """hasDiffuse(Material self) -> bool""" + return _ifcopenshell_wrapper.Material_hasDiffuse(self) + + + def hasSpecular(self): + """hasSpecular(Material self) -> bool""" + return _ifcopenshell_wrapper.Material_hasSpecular(self) + + + def hasTransparency(self): + """hasTransparency(Material self) -> bool""" + return _ifcopenshell_wrapper.Material_hasTransparency(self) + + + def hasSpecularity(self): + """hasSpecularity(Material self) -> bool""" + return _ifcopenshell_wrapper.Material_hasSpecularity(self) + + + def diffuse(self): + """diffuse(Material self) -> double const *""" + return _ifcopenshell_wrapper.Material_diffuse(self) + + + def specular(self): + """specular(Material self) -> double const *""" + return _ifcopenshell_wrapper.Material_specular(self) + + + def transparency(self): + """transparency(Material self) -> double""" + return _ifcopenshell_wrapper.Material_transparency(self) + + + def specularity(self): + """specularity(Material self) -> double""" + return _ifcopenshell_wrapper.Material_specularity(self) + + + def name(self): + """name(Material self) -> std::string const &""" + return _ifcopenshell_wrapper.Material_name(self) + + + def original_name(self): + """original_name(Material self) -> std::string const &""" + return _ifcopenshell_wrapper.Material_original_name(self) + + + def __eq__(self, other): + """__eq__(Material self, Material other) -> bool""" + return _ifcopenshell_wrapper.Material___eq__(self, other) + + + # Hide the getters with read-only property implementations + has_diffuse = property(hasDiffuse) + has_specular = property(hasSpecular) + has_transparency = property(hasTransparency) + has_specularity = property(hasSpecularity) + diffuse = property(diffuse) + specular = property(specular) + transparency = property(transparency) + specularity = property(specularity) + name = property(name) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_Material + __del__ = lambda self: None +Material_swigregister = _ifcopenshell_wrapper.Material_swigregister +Material_swigregister(Material) + +class Representation(_object): + """Proxy of C++ IfcGeom::Representation::Representation class.""" + + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, Representation, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, Representation, name) + __repr__ = _swig_repr + + def __init__(self, settings): + """__init__(IfcGeom::Representation::Representation self, ElementSettings settings) -> Representation""" + this = _ifcopenshell_wrapper.new_Representation(settings) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + + def settings(self): + """settings(Representation self) -> ElementSettings""" + return _ifcopenshell_wrapper.Representation_settings(self) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_Representation + __del__ = lambda self: None +Representation_swigregister = _ifcopenshell_wrapper.Representation_swigregister +Representation_swigregister(Representation) + +class BRep(Representation): + """Proxy of C++ IfcGeom::Representation::BRep class.""" + + __swig_setmethods__ = {} + for _s in [Representation]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, BRep, name, value) + __swig_getmethods__ = {} + for _s in [Representation]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, BRep, name) + __repr__ = _swig_repr + + def __init__(self, settings, id, shapes): + """__init__(IfcGeom::Representation::BRep self, ElementSettings settings, std::string const & id, IfcGeom::IfcRepresentationShapeItems const & shapes) -> BRep""" + this = _ifcopenshell_wrapper.new_BRep(settings, id, shapes) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _ifcopenshell_wrapper.delete_BRep + __del__ = lambda self: None + + def begin(self): + """begin(BRep self) -> IfcGeom::IfcRepresentationShapeItems::const_iterator""" + return _ifcopenshell_wrapper.BRep_begin(self) + + + def end(self): + """end(BRep self) -> IfcGeom::IfcRepresentationShapeItems::const_iterator""" + return _ifcopenshell_wrapper.BRep_end(self) + + + def shapes(self): + """shapes(BRep self) -> IfcGeom::IfcRepresentationShapeItems const &""" + return _ifcopenshell_wrapper.BRep_shapes(self) + + + def id(self): + """id(BRep self) -> std::string const &""" + return _ifcopenshell_wrapper.BRep_id(self) + + + def as_compound(self, force_meters=False): + """ + as_compound(BRep self, bool force_meters=False) -> TopoDS_Compound + as_compound(BRep self) -> TopoDS_Compound + """ + return _ifcopenshell_wrapper.BRep_as_compound(self, force_meters) + + + def calculate_volume(self, arg2): + """calculate_volume(BRep self, double & arg2) -> bool""" + return _ifcopenshell_wrapper.BRep_calculate_volume(self, arg2) + + + def calculate_surface_area(self, arg2): + """calculate_surface_area(BRep self, double & arg2) -> bool""" + return _ifcopenshell_wrapper.BRep_calculate_surface_area(self, arg2) + + + def calculate_projected_surface_area(self, ax, along_x, along_y, along_z): + """calculate_projected_surface_area(BRep self, gp_Ax3 const & ax, double & along_x, double & along_y, double & along_z) -> bool""" + return _ifcopenshell_wrapper.BRep_calculate_projected_surface_area(self, ax, along_x, along_y, along_z) + +BRep_swigregister = _ifcopenshell_wrapper.BRep_swigregister +BRep_swigregister(BRep) + +class Serialization(Representation): + """Proxy of C++ IfcGeom::Representation::Serialization class.""" + + __swig_setmethods__ = {} + for _s in [Representation]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, Serialization, name, value) + __swig_getmethods__ = {} + for _s in [Representation]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, Serialization, name) + __repr__ = _swig_repr + + def brep_data(self): + """brep_data(Serialization self) -> std::string const &""" + return _ifcopenshell_wrapper.Serialization_brep_data(self) + + + def surface_styles(self): + """surface_styles(Serialization self) -> std::vector< double > const &""" + return _ifcopenshell_wrapper.Serialization_surface_styles(self) + + + def __init__(self, brep): + """__init__(IfcGeom::Representation::Serialization self, BRep brep) -> Serialization""" + this = _ifcopenshell_wrapper.new_Serialization(brep) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _ifcopenshell_wrapper.delete_Serialization + __del__ = lambda self: None + + def id(self): + """id(Serialization self) -> std::string const &""" + return _ifcopenshell_wrapper.Serialization_id(self) + + + # Hide the getters with read-only property implementations + id = property(id) + brep_data = property(brep_data) + surface_styles = property(surface_styles) + +Serialization_swigregister = _ifcopenshell_wrapper.Serialization_swigregister +Serialization_swigregister(Serialization) + +class tree(_object): + """Proxy of C++ IfcGeom::tree class.""" + + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, tree, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, tree, name) + __repr__ = _swig_repr + + def __init__(self, *args): + """ + __init__(IfcGeom::tree self) -> tree + __init__(IfcGeom::tree self, file f) -> tree + __init__(IfcGeom::tree self, file f, settings settings) -> tree + """ + this = _ifcopenshell_wrapper.new_tree(*args) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + + def add_file(self, f, settings): + """add_file(tree self, file f, settings settings)""" + return _ifcopenshell_wrapper.tree_add_file(self, f, settings) + + + def vector_to_list(ps): + """vector_to_list(std::vector< IfcUtil::IfcBaseEntity * > const & ps) -> IfcEntityList::ptr""" + return _ifcopenshell_wrapper.tree_vector_to_list(ps) + + vector_to_list = staticmethod(vector_to_list) + + def select_box(self, *args): + """ + select_box(tree self, entity_instance e, bool completely_within=False, double extend=-1.e-5) -> IfcEntityList::ptr + select_box(tree self, entity_instance e, bool completely_within=False) -> IfcEntityList::ptr + select_box(tree self, entity_instance e) -> IfcEntityList::ptr + select_box(tree self, gp_Pnt const & p) -> IfcEntityList::ptr + select_box(tree self, Bnd_Box const & b, bool completely_within=False) -> IfcEntityList::ptr + select_box(tree self, Bnd_Box const & b) -> IfcEntityList::ptr + """ + return _ifcopenshell_wrapper.tree_select_box(self, *args) + + + def select(self, *args): + """ + select(tree self, entity_instance e, bool completely_within=False) -> IfcEntityList::ptr + select(tree self, entity_instance e) -> IfcEntityList::ptr + select(tree self, gp_Pnt const & p) -> IfcEntityList::ptr + select(tree self, std::string const & shape_serialization) -> IfcEntityList::ptr + """ + return _ifcopenshell_wrapper.tree_select(self, *args) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_tree + __del__ = lambda self: None +tree_swigregister = _ifcopenshell_wrapper.tree_swigregister +tree_swigregister(tree) + +def tree_vector_to_list(ps): + """tree_vector_to_list(std::vector< IfcUtil::IfcBaseEntity * > const & ps) -> IfcEntityList::ptr""" + return _ifcopenshell_wrapper.tree_vector_to_list(ps) + + +def create_shape(settings, instance, representation=None): + """ + create_shape(settings settings, entity_instance instance, entity_instance representation=None) -> boost::variant< IfcGeom::Element< double,double > *,IfcGeom::Representation::Representation * > + create_shape(settings settings, entity_instance instance) -> boost::variant< IfcGeom::Element< double,double > *,IfcGeom::Representation::Representation * > + """ + return _ifcopenshell_wrapper.create_shape(settings, instance, representation) + +def serialise(schema_name, shape_str, advanced=True): + """ + serialise(std::string const & schema_name, std::string const & shape_str, bool advanced=True) -> entity_instance + serialise(std::string const & schema_name, std::string const & shape_str) -> entity_instance + """ + return _ifcopenshell_wrapper.serialise(schema_name, shape_str, advanced) + +def tesselate(schema_name, shape_str, d): + """tesselate(std::string const & schema_name, std::string const & shape_str, double d) -> entity_instance""" + return _ifcopenshell_wrapper.tesselate(schema_name, shape_str, d) +class iterator_double_precision(_object): + """Proxy of C++ IfcGeom::Iterator<(double)> class.""" + + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, iterator_double_precision, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, iterator_double_precision, name) + __repr__ = _swig_repr + + def __init__(self, *args): + """ + __init__(IfcGeom::Iterator<(double)> self, settings settings, file file, int num_threads=1) -> iterator_double_precision + __init__(IfcGeom::Iterator<(double)> self, settings settings, file file) -> iterator_double_precision + __init__(IfcGeom::Iterator<(double)> self, settings settings, file file, std::vector< IfcGeom::filter_t > const & filters, size_t num_threads=1) -> iterator_double_precision + __init__(IfcGeom::Iterator<(double)> self, settings settings, file file, std::vector< IfcGeom::filter_t > const & filters) -> iterator_double_precision + """ + this = _ifcopenshell_wrapper.new_iterator_double_precision(*args) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + + def initialize(self): + """initialize(iterator_double_precision self) -> bool""" + return _ifcopenshell_wrapper.iterator_double_precision_initialize(self) + + + def progress(self): + """progress(iterator_double_precision self) -> int""" + return _ifcopenshell_wrapper.iterator_double_precision_progress(self) + + + def compute_bounds(self): + """compute_bounds(iterator_double_precision self)""" + return _ifcopenshell_wrapper.iterator_double_precision_compute_bounds(self) + + + def bounds_min(self): + """bounds_min(iterator_double_precision self) -> gp_XYZ const &""" + return _ifcopenshell_wrapper.iterator_double_precision_bounds_min(self) + + + def bounds_max(self): + """bounds_max(iterator_double_precision self) -> gp_XYZ const &""" + return _ifcopenshell_wrapper.iterator_double_precision_bounds_max(self) + + + def unit_name(self): + """unit_name(iterator_double_precision self) -> std::string const &""" + return _ifcopenshell_wrapper.iterator_double_precision_unit_name(self) + + + def unit_magnitude(self): + """unit_magnitude(iterator_double_precision self) -> double""" + return _ifcopenshell_wrapper.iterator_double_precision_unit_magnitude(self) + + + def file(self): + """file(iterator_double_precision self) -> file""" + return _ifcopenshell_wrapper.iterator_double_precision_file(self) + + + def next(self): + """next(iterator_double_precision self) -> entity_instance""" + return _ifcopenshell_wrapper.iterator_double_precision_next(self) + + + def get(self): + """get(iterator_double_precision self) -> element_double_precision""" + return _ifcopenshell_wrapper.iterator_double_precision_get(self) + + + def get_native(self): + """get_native(iterator_double_precision self) -> IfcGeom::BRepElement< double,double > *""" + return _ifcopenshell_wrapper.iterator_double_precision_get_native(self) + + + def get_object(self, id): + """get_object(iterator_double_precision self, int id) -> element_double_precision""" + return _ifcopenshell_wrapper.iterator_double_precision_get_object(self, id) + + + def create(self): + """create(iterator_double_precision self) -> entity_instance""" + return _ifcopenshell_wrapper.iterator_double_precision_create(self) + + + def mantissa_size(): + """mantissa_size() -> int""" + return _ifcopenshell_wrapper.iterator_double_precision_mantissa_size() + + mantissa_size = staticmethod(mantissa_size) + __swig_destroy__ = _ifcopenshell_wrapper.delete_iterator_double_precision + __del__ = lambda self: None +iterator_double_precision_swigregister = _ifcopenshell_wrapper.iterator_double_precision_swigregister +iterator_double_precision_swigregister(iterator_double_precision) + +def iterator_double_precision_mantissa_size(): + """iterator_double_precision_mantissa_size() -> int""" + return _ifcopenshell_wrapper.iterator_double_precision_mantissa_size() + +class element_double_precision(_object): + """Proxy of C++ IfcGeom::Element<(double)> class.""" + + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, element_double_precision, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, element_double_precision, name) + __repr__ = _swig_repr + + def id(self): + """id(element_double_precision self) -> int""" + return _ifcopenshell_wrapper.element_double_precision_id(self) + + + def parent_id(self): + """parent_id(element_double_precision self) -> int""" + return _ifcopenshell_wrapper.element_double_precision_parent_id(self) + + + def name(self): + """name(element_double_precision self) -> std::string const &""" + return _ifcopenshell_wrapper.element_double_precision_name(self) + + + def type(self): + """type(element_double_precision self) -> std::string const &""" + return _ifcopenshell_wrapper.element_double_precision_type(self) + + + def guid(self): + """guid(element_double_precision self) -> std::string const &""" + return _ifcopenshell_wrapper.element_double_precision_guid(self) + + + def context(self): + """context(element_double_precision self) -> std::string const &""" + return _ifcopenshell_wrapper.element_double_precision_context(self) + + + def unique_id(self): + """unique_id(element_double_precision self) -> std::string const &""" + return _ifcopenshell_wrapper.element_double_precision_unique_id(self) + + + def transformation(self): + """transformation(element_double_precision self) -> transformation_double_precision""" + return _ifcopenshell_wrapper.element_double_precision_transformation(self) + + + def product(self): + """product(element_double_precision self) -> IfcBaseEntity""" + return _ifcopenshell_wrapper.element_double_precision_product(self) + + + def parents(self): + """parents(element_double_precision self) -> std::vector< IfcGeom::Element< double,double > const * > const""" + return _ifcopenshell_wrapper.element_double_precision_parents(self) + + + def SetParents(self, newparents): + """SetParents(element_double_precision self, std::vector< IfcGeom::Element< double,double > const * > newparents)""" + return _ifcopenshell_wrapper.element_double_precision_SetParents(self, newparents) + + + def __init__(self, settings, id, parent_id, name, type, guid, context, trsf, product): + """__init__(IfcGeom::Element<(double)> self, ElementSettings settings, int id, int parent_id, std::string const & name, std::string const & type, std::string const & guid, std::string const & context, gp_Trsf const & trsf, IfcBaseEntity product) -> element_double_precision""" + this = _ifcopenshell_wrapper.new_element_double_precision(settings, id, parent_id, name, type, guid, context, trsf, product) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _ifcopenshell_wrapper.delete_element_double_precision + __del__ = lambda self: None + + def product_(self): + """product_(element_double_precision self) -> entity_instance""" + return _ifcopenshell_wrapper.element_double_precision_product_(self) + + + # Hide the getters with read-only property implementations + id = property(id) + parent_id = property(parent_id) + name = property(name) + type = property(type) + guid = property(guid) + context = property(context) + unique_id = property(unique_id) + transformation = property(transformation) + product = property(product_) + +element_double_precision_swigregister = _ifcopenshell_wrapper.element_double_precision_swigregister +element_double_precision_swigregister(element_double_precision) + +def __eq__(*args): + """ + __eq__(Element< P,PP > const & element1, Element< P,PP > const & element2) -> bool + __eq__(element_double_precision element1, element_double_precision element2) -> bool + """ + return _ifcopenshell_wrapper.__eq__(*args) + +def __lt__(*args): + """ + __lt__(Element< P,PP > const & element1, Element< P,PP > const & element2) -> bool + __lt__(element_double_precision element1, element_double_precision element2) -> bool + """ + return _ifcopenshell_wrapper.__lt__(*args) + +class triangulation_element_double_precision(element_double_precision): + """Proxy of C++ IfcGeom::TriangulationElement<(double)> class.""" + + __swig_setmethods__ = {} + for _s in [element_double_precision]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, triangulation_element_double_precision, name, value) + __swig_getmethods__ = {} + for _s in [element_double_precision]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, triangulation_element_double_precision, name) + __repr__ = _swig_repr + + def geometry(self): + """geometry(triangulation_element_double_precision self) -> triangulation_double_precision""" + return _ifcopenshell_wrapper.triangulation_element_double_precision_geometry(self) + + + def geometry_pointer(self): + """geometry_pointer(triangulation_element_double_precision self) -> boost::shared_ptr< IfcGeom::Representation::Triangulation< double > > const &""" + return _ifcopenshell_wrapper.triangulation_element_double_precision_geometry_pointer(self) + + + def __init__(self, *args): + """ + __init__(IfcGeom::TriangulationElement<(double)> self, IfcGeom::BRepElement< double,double > const & shape_model) -> triangulation_element_double_precision + __init__(IfcGeom::TriangulationElement<(double)> self, element_double_precision element, boost::shared_ptr< IfcGeom::Representation::Triangulation< double > > const & geometry) -> triangulation_element_double_precision + """ + this = _ifcopenshell_wrapper.new_triangulation_element_double_precision(*args) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + + # Hide the getters with read-only property implementations + geometry = property(geometry) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_triangulation_element_double_precision + __del__ = lambda self: None +triangulation_element_double_precision_swigregister = _ifcopenshell_wrapper.triangulation_element_double_precision_swigregister +triangulation_element_double_precision_swigregister(triangulation_element_double_precision) + +class serialized_element_double_precision(element_double_precision): + """Proxy of C++ IfcGeom::SerializedElement<(double)> class.""" + + __swig_setmethods__ = {} + for _s in [element_double_precision]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, serialized_element_double_precision, name, value) + __swig_getmethods__ = {} + for _s in [element_double_precision]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, serialized_element_double_precision, name) + __repr__ = _swig_repr + + def geometry(self): + """geometry(serialized_element_double_precision self) -> Serialization""" + return _ifcopenshell_wrapper.serialized_element_double_precision_geometry(self) + + + def __init__(self, shape_model): + """__init__(IfcGeom::SerializedElement<(double)> self, IfcGeom::BRepElement< double,double > const & shape_model) -> serialized_element_double_precision""" + this = _ifcopenshell_wrapper.new_serialized_element_double_precision(shape_model) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _ifcopenshell_wrapper.delete_serialized_element_double_precision + __del__ = lambda self: None + + # Hide the getters with read-only property implementations + geometry = property(geometry) + +serialized_element_double_precision_swigregister = _ifcopenshell_wrapper.serialized_element_double_precision_swigregister +serialized_element_double_precision_swigregister(serialized_element_double_precision) + +class transformation_double_precision(_object): + """Proxy of C++ IfcGeom::Transformation<(double)> class.""" + + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, transformation_double_precision, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, transformation_double_precision, name) + __repr__ = _swig_repr + + def __init__(self, settings, trsf): + """__init__(IfcGeom::Transformation<(double)> self, ElementSettings settings, gp_Trsf const & trsf) -> transformation_double_precision""" + this = _ifcopenshell_wrapper.new_transformation_double_precision(settings, trsf) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + + def data(self): + """data(transformation_double_precision self) -> gp_Trsf const &""" + return _ifcopenshell_wrapper.transformation_double_precision_data(self) + + + def matrix(self): + """matrix(transformation_double_precision self) -> matrix_double_precision""" + return _ifcopenshell_wrapper.transformation_double_precision_matrix(self) + + + def inverted(self): + """inverted(transformation_double_precision self) -> transformation_double_precision""" + return _ifcopenshell_wrapper.transformation_double_precision_inverted(self) + + + def multiplied(self, other): + """multiplied(transformation_double_precision self, transformation_double_precision other) -> transformation_double_precision""" + return _ifcopenshell_wrapper.transformation_double_precision_multiplied(self, other) + + + # Hide the getters with read-only property implementations + matrix = property(matrix) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_transformation_double_precision + __del__ = lambda self: None +transformation_double_precision_swigregister = _ifcopenshell_wrapper.transformation_double_precision_swigregister +transformation_double_precision_swigregister(transformation_double_precision) + +class matrix_double_precision(_object): + """Proxy of C++ IfcGeom::Matrix<(double)> class.""" + + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, matrix_double_precision, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, matrix_double_precision, name) + __repr__ = _swig_repr + + def __init__(self, settings, trsf): + """__init__(IfcGeom::Matrix<(double)> self, ElementSettings settings, gp_Trsf const & trsf) -> matrix_double_precision""" + this = _ifcopenshell_wrapper.new_matrix_double_precision(settings, trsf) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + + def data(self): + """data(matrix_double_precision self) -> std::vector< double > const &""" + return _ifcopenshell_wrapper.matrix_double_precision_data(self) + + + # Hide the getters with read-only property implementations + data = property(data) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_matrix_double_precision + __del__ = lambda self: None +matrix_double_precision_swigregister = _ifcopenshell_wrapper.matrix_double_precision_swigregister +matrix_double_precision_swigregister(matrix_double_precision) + +class triangulation_double_precision(Representation): + """Proxy of C++ IfcGeom::Representation::Triangulation<(double)> class.""" + + __swig_setmethods__ = {} + for _s in [Representation]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, triangulation_double_precision, name, value) + __swig_getmethods__ = {} + for _s in [Representation]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, triangulation_double_precision, name) + __repr__ = _swig_repr + + def id(self): + """id(triangulation_double_precision self) -> std::string const &""" + return _ifcopenshell_wrapper.triangulation_double_precision_id(self) + + + def verts(self): + """verts(triangulation_double_precision self) -> std::vector< double > const &""" + return _ifcopenshell_wrapper.triangulation_double_precision_verts(self) + + + def faces(self): + """faces(triangulation_double_precision self) -> std::vector< int > const &""" + return _ifcopenshell_wrapper.triangulation_double_precision_faces(self) + + + def edges(self): + """edges(triangulation_double_precision self) -> std::vector< int > const &""" + return _ifcopenshell_wrapper.triangulation_double_precision_edges(self) + + + def normals(self): + """normals(triangulation_double_precision self) -> std::vector< double > const &""" + return _ifcopenshell_wrapper.triangulation_double_precision_normals(self) + + + def uvs(self): + """uvs(triangulation_double_precision self) -> std::vector< double > const &""" + return _ifcopenshell_wrapper.triangulation_double_precision_uvs(self) + + + def material_ids(self): + """material_ids(triangulation_double_precision self) -> std::vector< int > const &""" + return _ifcopenshell_wrapper.triangulation_double_precision_material_ids(self) + + + def materials(self): + """materials(triangulation_double_precision self) -> std::vector< IfcGeom::Material > const &""" + return _ifcopenshell_wrapper.triangulation_double_precision_materials(self) + + + def __init__(self, shape_model): + """__init__(IfcGeom::Representation::Triangulation<(double)> self, BRep shape_model) -> triangulation_double_precision""" + this = _ifcopenshell_wrapper.new_triangulation_double_precision(shape_model) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _ifcopenshell_wrapper.delete_triangulation_double_precision + __del__ = lambda self: None + + def box_project_uvs(vertices, normals): + """box_project_uvs(std::vector< double > const & vertices, std::vector< double > const & normals) -> std::vector< double >""" + return _ifcopenshell_wrapper.triangulation_double_precision_box_project_uvs(vertices, normals) + + box_project_uvs = staticmethod(box_project_uvs) + + # Hide the getters with read-only property implementations + id = property(id) + faces = property(faces) + edges = property(edges) + material_ids = property(material_ids) + materials = property(materials) + + + # Hide the getters with read-only property implementations + verts = property(verts) + normals = property(normals) + +triangulation_double_precision_swigregister = _ifcopenshell_wrapper.triangulation_double_precision_swigregister +triangulation_double_precision_swigregister(triangulation_double_precision) + +def triangulation_double_precision_box_project_uvs(vertices, normals): + """triangulation_double_precision_box_project_uvs(std::vector< double > const & vertices, std::vector< double > const & normals) -> std::vector< double >""" + return _ifcopenshell_wrapper.triangulation_double_precision_box_project_uvs(vertices, normals) + +class IfcEntityInstanceData(_object): + """Proxy of C++ IfcEntityInstanceData class.""" + + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, IfcEntityInstanceData, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, IfcEntityInstanceData, name) + + def __init__(self, *args, **kwargs): + raise AttributeError("No constructor defined") + __repr__ = _swig_repr + __swig_destroy__ = _ifcopenshell_wrapper.delete_IfcEntityInstanceData + __del__ = lambda self: None +IfcEntityInstanceData_swigregister = _ifcopenshell_wrapper.IfcEntityInstanceData_swigregister +IfcEntityInstanceData_swigregister(IfcEntityInstanceData) + +class HeaderEntity(IfcEntityInstanceData): + """Proxy of C++ IfcParse::HeaderEntity class.""" + + __swig_setmethods__ = {} + for _s in [IfcEntityInstanceData]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, HeaderEntity, name, value) + __swig_getmethods__ = {} + for _s in [IfcEntityInstanceData]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, HeaderEntity, name) + + def __init__(self, *args, **kwargs): + raise AttributeError("No constructor defined") + __repr__ = _swig_repr + + def getArgumentCount(self): + """getArgumentCount(HeaderEntity self) -> unsigned int""" + return _ifcopenshell_wrapper.HeaderEntity_getArgumentCount(self) + + + def toString(self, upper=False): + """ + toString(HeaderEntity self, bool upper=False) -> std::string + toString(HeaderEntity self) -> std::string + """ + return _ifcopenshell_wrapper.HeaderEntity_toString(self, upper) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_HeaderEntity + __del__ = lambda self: None +HeaderEntity_swigregister = _ifcopenshell_wrapper.HeaderEntity_swigregister +HeaderEntity_swigregister(HeaderEntity) + +class FileDescription(HeaderEntity): + """Proxy of C++ IfcParse::FileDescription class.""" + + __swig_setmethods__ = {} + for _s in [HeaderEntity]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, FileDescription, name, value) + __swig_getmethods__ = {} + for _s in [HeaderEntity]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, FileDescription, name) + + def __init__(self, *args, **kwargs): + raise AttributeError("No constructor defined") + __repr__ = _swig_repr + + def description(self, *args): + """ + description(FileDescription self) -> std::vector< std::string > + description(FileDescription self, std::vector< std::string > const & value) + """ + return _ifcopenshell_wrapper.FileDescription_description(self, *args) + + + def implementation_level(self, *args): + """ + implementation_level(FileDescription self) -> std::string + implementation_level(FileDescription self, std::string const & value) + """ + return _ifcopenshell_wrapper.FileDescription_implementation_level(self, *args) + + + # Hide the getters with read-write property implementations + description = property(description, description) + implementation_level = property(implementation_level, implementation_level) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_FileDescription + __del__ = lambda self: None +FileDescription_swigregister = _ifcopenshell_wrapper.FileDescription_swigregister +FileDescription_swigregister(FileDescription) + +class FileName(HeaderEntity): + """Proxy of C++ IfcParse::FileName class.""" + + __swig_setmethods__ = {} + for _s in [HeaderEntity]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, FileName, name, value) + __swig_getmethods__ = {} + for _s in [HeaderEntity]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, FileName, name) + + def __init__(self, *args, **kwargs): + raise AttributeError("No constructor defined") + __repr__ = _swig_repr + + def name(self, *args): + """ + name(FileName self) -> std::string + name(FileName self, std::string const & value) + """ + return _ifcopenshell_wrapper.FileName_name(self, *args) + + + def time_stamp(self, *args): + """ + time_stamp(FileName self) -> std::string + time_stamp(FileName self, std::string const & value) + """ + return _ifcopenshell_wrapper.FileName_time_stamp(self, *args) + + + def author(self, *args): + """ + author(FileName self) -> std::vector< std::string > + author(FileName self, std::vector< std::string > const & value) + """ + return _ifcopenshell_wrapper.FileName_author(self, *args) + + + def organization(self, *args): + """ + organization(FileName self) -> std::vector< std::string > + organization(FileName self, std::vector< std::string > const & value) + """ + return _ifcopenshell_wrapper.FileName_organization(self, *args) + + + def preprocessor_version(self, *args): + """ + preprocessor_version(FileName self) -> std::string + preprocessor_version(FileName self, std::string const & value) + """ + return _ifcopenshell_wrapper.FileName_preprocessor_version(self, *args) + + + def originating_system(self, *args): + """ + originating_system(FileName self) -> std::string + originating_system(FileName self, std::string const & value) + """ + return _ifcopenshell_wrapper.FileName_originating_system(self, *args) + + + def authorization(self, *args): + """ + authorization(FileName self) -> std::string + authorization(FileName self, std::string const & value) + """ + return _ifcopenshell_wrapper.FileName_authorization(self, *args) + + + name = property(name, name) + time_stamp = property(time_stamp, time_stamp) + author = property(author, author) + organization = property(organization, organization) + preprocessor_version = property(preprocessor_version, preprocessor_version) + originating_system = property(originating_system, originating_system) + authorization = property(authorization, authorization) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_FileName + __del__ = lambda self: None +FileName_swigregister = _ifcopenshell_wrapper.FileName_swigregister +FileName_swigregister(FileName) + +class FileSchema(HeaderEntity): + """Proxy of C++ IfcParse::FileSchema class.""" + + __swig_setmethods__ = {} + for _s in [HeaderEntity]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, FileSchema, name, value) + __swig_getmethods__ = {} + for _s in [HeaderEntity]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, FileSchema, name) + + def __init__(self, *args, **kwargs): + raise AttributeError("No constructor defined") + __repr__ = _swig_repr + + def schema_identifiers(self, *args): + """ + schema_identifiers(FileSchema self) -> std::vector< std::string > + schema_identifiers(FileSchema self, std::vector< std::string > const & value) + """ + return _ifcopenshell_wrapper.FileSchema_schema_identifiers(self, *args) + + + # Hide the getters with read-write property implementations + schema_identifiers = property(schema_identifiers, schema_identifiers) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_FileSchema + __del__ = lambda self: None +FileSchema_swigregister = _ifcopenshell_wrapper.FileSchema_swigregister +FileSchema_swigregister(FileSchema) + +class IfcSpfHeader(_object): + """Proxy of C++ IfcParse::IfcSpfHeader class.""" + + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, IfcSpfHeader, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, IfcSpfHeader, name) + __repr__ = _swig_repr + + def __init__(self, file=None): + """ + __init__(IfcParse::IfcSpfHeader self, file file=None) -> IfcSpfHeader + __init__(IfcParse::IfcSpfHeader self) -> IfcSpfHeader + """ + this = _ifcopenshell_wrapper.new_IfcSpfHeader(file) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _ifcopenshell_wrapper.delete_IfcSpfHeader + __del__ = lambda self: None + + def file(self, *args): + """ + file(IfcSpfHeader self) -> file + file(IfcSpfHeader self, file file) + """ + return _ifcopenshell_wrapper.IfcSpfHeader_file(self, *args) + + + def read(self): + """read(IfcSpfHeader self)""" + return _ifcopenshell_wrapper.IfcSpfHeader_read(self) + + + def tryRead(self): + """tryRead(IfcSpfHeader self) -> bool""" + return _ifcopenshell_wrapper.IfcSpfHeader_tryRead(self) + + + def write(self, os): + """write(IfcSpfHeader self, std::ostream & os)""" + return _ifcopenshell_wrapper.IfcSpfHeader_write(self, os) + + + def file_description(self, *args): + """ + file_description(IfcSpfHeader self) -> FileDescription + file_description(IfcSpfHeader self) -> FileDescription + """ + return _ifcopenshell_wrapper.IfcSpfHeader_file_description(self, *args) + + + def file_name(self, *args): + """ + file_name(IfcSpfHeader self) -> FileName + file_name(IfcSpfHeader self) -> FileName + """ + return _ifcopenshell_wrapper.IfcSpfHeader_file_name(self, *args) + + + def file_schema(self, *args): + """ + file_schema(IfcSpfHeader self) -> FileSchema + file_schema(IfcSpfHeader self) -> FileSchema + """ + return _ifcopenshell_wrapper.IfcSpfHeader_file_schema(self, *args) + + + # Hide the getters with read-only property implementations + file_description = property(file_description) + file_name = property(file_name) + file_schema = property(file_schema) + +IfcSpfHeader_swigregister = _ifcopenshell_wrapper.IfcSpfHeader_swigregister +IfcSpfHeader_swigregister(IfcSpfHeader) + +class file(_object): + """Proxy of C++ IfcParse::IfcFile class.""" + + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, file, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, file, name) + __repr__ = _swig_repr + __swig_setmethods__["stream"] = _ifcopenshell_wrapper.file_stream_set + __swig_getmethods__["stream"] = _ifcopenshell_wrapper.file_stream_get + if _newclass: + stream = _swig_property(_ifcopenshell_wrapper.file_stream_get, _ifcopenshell_wrapper.file_stream_set) + + def __init__(self, *args): + """ + __init__(IfcParse::IfcFile self, std::string const & fn) -> file + __init__(IfcParse::IfcFile self, std::istream & fn, int len) -> file + __init__(IfcParse::IfcFile self, void * data, int len) -> file + __init__(IfcParse::IfcFile self, IfcParse::IfcSpfStream * f) -> file + __init__(IfcParse::IfcFile self, schema_definition schema) -> file + __init__(IfcParse::IfcFile self) -> file + """ + this = _ifcopenshell_wrapper.new_file(*args) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _ifcopenshell_wrapper.delete_file + __del__ = lambda self: None + + def good(self): + """good(file self) -> bool""" + return _ifcopenshell_wrapper.file_good(self) + + + def types_begin(self): + """types_begin(file self) -> IfcParse::IfcFile::type_iterator""" + return _ifcopenshell_wrapper.file_types_begin(self) + + + def types_end(self): + """types_end(file self) -> IfcParse::IfcFile::type_iterator""" + return _ifcopenshell_wrapper.file_types_end(self) + + + def types_incl_super_begin(self): + """types_incl_super_begin(file self) -> IfcParse::IfcFile::type_iterator""" + return _ifcopenshell_wrapper.file_types_incl_super_begin(self) + + + def types_incl_super_end(self): + """types_incl_super_end(file self) -> IfcParse::IfcFile::type_iterator""" + return _ifcopenshell_wrapper.file_types_incl_super_end(self) + + + def instances_by_type_excl_subtypes(self, arg2): + """instances_by_type_excl_subtypes(file self, declaration arg2) -> IfcEntityList::ptr""" + return _ifcopenshell_wrapper.file_instances_by_type_excl_subtypes(self, arg2) + + + def by_type(self, *args): + """ + by_type(file self, declaration arg2) -> IfcEntityList::ptr + by_type(file self, std::string const & t) -> IfcEntityList::ptr + """ + return _ifcopenshell_wrapper.file_by_type(self, *args) + + + def instances_by_reference(self, id): + """instances_by_reference(file self, int id) -> IfcEntityList::ptr""" + return _ifcopenshell_wrapper.file_instances_by_reference(self, id) + + + def by_id(self, id): + """by_id(file self, int id) -> entity_instance""" + return _ifcopenshell_wrapper.file_by_id(self, id) + + + def instance_by_guid(self, guid): + """instance_by_guid(file self, std::string const & guid) -> entity_instance""" + return _ifcopenshell_wrapper.file_instance_by_guid(self, guid) + + + def traverse(self, instance, max_level=-1): + """ + traverse(file self, entity_instance instance, int max_level=-1) -> IfcEntityList::ptr + traverse(file self, entity_instance instance) -> IfcEntityList::ptr + """ + return _ifcopenshell_wrapper.file_traverse(self, instance, max_level) + + + def getInverse(self, instance_id, type, attribute_index): + """getInverse(file self, int instance_id, declaration type, int attribute_index) -> IfcEntityList::ptr""" + return _ifcopenshell_wrapper.file_getInverse(self, instance_id, type, attribute_index) + + + def mark_entity_as_modified(self, id): + """mark_entity_as_modified(file self, int id)""" + return _ifcopenshell_wrapper.file_mark_entity_as_modified(self, id) + + + def FreshId(self): + """FreshId(file self) -> unsigned int""" + return _ifcopenshell_wrapper.file_FreshId(self) + + + def add(self, entity): + """add(file self, entity_instance entity) -> entity_instance""" + return _ifcopenshell_wrapper.file_add(self, entity) + + + def addEntities(self, es): + """addEntities(file self, IfcEntityList::ptr es)""" + return _ifcopenshell_wrapper.file_addEntities(self, es) + + + def remove(self, entity): + """remove(file self, entity_instance entity)""" + return _ifcopenshell_wrapper.file_remove(self, entity) + + + def header(self, *args): + """ + header(file self) -> IfcSpfHeader + header(file self) -> IfcSpfHeader + """ + return _ifcopenshell_wrapper.file_header(self, *args) + + + def createTimestamp(self): + """createTimestamp(file self) -> std::string""" + return _ifcopenshell_wrapper.file_createTimestamp(self) + + + def load(self, entity_instance_name, attributes, num_attributes): + """load(file self, unsigned int entity_instance_name, Argument **& attributes, size_t num_attributes) -> size_t""" + return _ifcopenshell_wrapper.file_load(self, entity_instance_name, attributes, num_attributes) + + + def seek_to(self, data): + """seek_to(file self, IfcEntityInstanceData data)""" + return _ifcopenshell_wrapper.file_seek_to(self, data) + + + def try_read_semicolon(self): + """try_read_semicolon(file self)""" + return _ifcopenshell_wrapper.file_try_read_semicolon(self) + + + def getUnit(self, unit_type): + """getUnit(file self, std::string const & unit_type) -> std::pair< IfcUtil::IfcBaseClass *,double >""" + return _ifcopenshell_wrapper.file_getUnit(self, unit_type) + + + def parsing_complete(self, *args): + """ + parsing_complete(file self) -> bool + parsing_complete(file self) -> bool & + """ + return _ifcopenshell_wrapper.file_parsing_complete(self, *args) + + + def build_inverses(self): + """build_inverses(file self)""" + return _ifcopenshell_wrapper.file_build_inverses(self) + + + def by_guid(self, guid): + """by_guid(file self, std::string const & guid) -> entity_instance""" + return _ifcopenshell_wrapper.file_by_guid(self, guid) + + + def get_inverse(self, e): + """get_inverse(file self, entity_instance e) -> IfcEntityList::ptr""" + return _ifcopenshell_wrapper.file_get_inverse(self, e) + + + def write(self, fn): + """write(file self, std::string const & fn)""" + return _ifcopenshell_wrapper.file_write(self, fn) + + + def to_string(self): + """to_string(file self) -> std::string""" + return _ifcopenshell_wrapper.file_to_string(self) + + + def entity_names(self): + """entity_names(file self) -> std::vector< unsigned int >""" + return _ifcopenshell_wrapper.file_entity_names(self) + + + def types(self): + """types(file self) -> std::vector< std::string >""" + return _ifcopenshell_wrapper.file_types(self) + + + def types_with_super(self): + """types_with_super(file self) -> std::vector< std::string >""" + return _ifcopenshell_wrapper.file_types_with_super(self) + + + def schema_name(self): + """schema_name(file self) -> std::string""" + return _ifcopenshell_wrapper.file_schema_name(self) + + + # Hide the getters with read-only property implementations + header = property(header) + schema = property(schema_name) + +file_swigregister = _ifcopenshell_wrapper.file_swigregister +file_swigregister(file) + +class entity_instance(_object): + """Proxy of C++ IfcUtil::IfcBaseClass class.""" + + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, entity_instance, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, entity_instance, name) + + def __init__(self, *args, **kwargs): + raise AttributeError("No constructor defined - class is abstract") + __swig_destroy__ = _ifcopenshell_wrapper.delete_entity_instance + __del__ = lambda self: None + + def data(self, *args): + """ + data(entity_instance self) -> IfcEntityInstanceData + data(entity_instance self) -> IfcEntityInstanceData + data(entity_instance self, IfcEntityInstanceData d) + """ + return _ifcopenshell_wrapper.entity_instance_data(self, *args) + + + def declaration(self): + """declaration(entity_instance self) -> declaration""" + return _ifcopenshell_wrapper.entity_instance_declaration(self) + + + def get_attribute_category(self, name): + """get_attribute_category(entity_instance self, std::string const & name) -> int""" + return _ifcopenshell_wrapper.entity_instance_get_attribute_category(self, name) + + + def id(self): + """id(entity_instance self) -> int""" + return _ifcopenshell_wrapper.entity_instance_id(self) + + + def __len__(self): + """__len__(entity_instance self) -> int""" + return _ifcopenshell_wrapper.entity_instance___len__(self) + + + def get_attribute_names(self): + """get_attribute_names(entity_instance self) -> std::vector< std::string >""" + return _ifcopenshell_wrapper.entity_instance_get_attribute_names(self) + + + def get_inverse_attribute_names(self): + """get_inverse_attribute_names(entity_instance self) -> std::vector< std::string >""" + return _ifcopenshell_wrapper.entity_instance_get_inverse_attribute_names(self) + + + def is_a(self, *args): + """ + is_a(entity_instance self, std::string const & s) -> bool + is_a(entity_instance self) -> std::string + """ + return _ifcopenshell_wrapper.entity_instance_is_a(self, *args) + + + def get_argument(self, *args): + """ + get_argument(entity_instance self, unsigned int i) -> std::pair< IfcUtil::ArgumentType,Argument * > + get_argument(entity_instance self, std::string const & a) -> std::pair< IfcUtil::ArgumentType,Argument * > + """ + return _ifcopenshell_wrapper.entity_instance_get_argument(self, *args) + + + def __eq__(self, other): + """__eq__(entity_instance self, entity_instance other) -> bool""" + return _ifcopenshell_wrapper.entity_instance___eq__(self, other) + + + def __repr__(self): + """__repr__(entity_instance self) -> std::string""" + return _ifcopenshell_wrapper.entity_instance___repr__(self) + + + def file_pointer(self): + """file_pointer(entity_instance self) -> size_t""" + return _ifcopenshell_wrapper.entity_instance_file_pointer(self) + + + def get_argument_index(self, a): + """get_argument_index(entity_instance self, std::string const & a) -> unsigned int""" + return _ifcopenshell_wrapper.entity_instance_get_argument_index(self, a) + + + def get_inverse(self, a): + """get_inverse(entity_instance self, std::string const & a) -> IfcEntityList::ptr""" + return _ifcopenshell_wrapper.entity_instance_get_inverse(self, a) + + + def get_argument_type(self, i): + """get_argument_type(entity_instance self, unsigned int i) -> char const *const""" + return _ifcopenshell_wrapper.entity_instance_get_argument_type(self, i) + + + def get_argument_name(self, i): + """get_argument_name(entity_instance self, unsigned int i) -> std::string const &""" + return _ifcopenshell_wrapper.entity_instance_get_argument_name(self, i) + + + def setArgumentAsNull(self, i): + """setArgumentAsNull(entity_instance self, unsigned int i)""" + return _ifcopenshell_wrapper.entity_instance_setArgumentAsNull(self, i) + + + def setArgumentAsInt(self, i, v): + """setArgumentAsInt(entity_instance self, unsigned int i, int v)""" + return _ifcopenshell_wrapper.entity_instance_setArgumentAsInt(self, i, v) + + + def setArgumentAsBool(self, i, v): + """setArgumentAsBool(entity_instance self, unsigned int i, bool v)""" + return _ifcopenshell_wrapper.entity_instance_setArgumentAsBool(self, i, v) + + + def setArgumentAsDouble(self, i, v): + """setArgumentAsDouble(entity_instance self, unsigned int i, double v)""" + return _ifcopenshell_wrapper.entity_instance_setArgumentAsDouble(self, i, v) + + + def setArgumentAsString(self, i, a): + """setArgumentAsString(entity_instance self, unsigned int i, std::string const & a)""" + return _ifcopenshell_wrapper.entity_instance_setArgumentAsString(self, i, a) + + + def setArgumentAsAggregateOfInt(self, i, v): + """setArgumentAsAggregateOfInt(entity_instance self, unsigned int i, std::vector< int > const & v)""" + return _ifcopenshell_wrapper.entity_instance_setArgumentAsAggregateOfInt(self, i, v) + + + def setArgumentAsAggregateOfDouble(self, i, v): + """setArgumentAsAggregateOfDouble(entity_instance self, unsigned int i, std::vector< double > const & v)""" + return _ifcopenshell_wrapper.entity_instance_setArgumentAsAggregateOfDouble(self, i, v) + + + def setArgumentAsAggregateOfString(self, i, v): + """setArgumentAsAggregateOfString(entity_instance self, unsigned int i, std::vector< std::string > const & v)""" + return _ifcopenshell_wrapper.entity_instance_setArgumentAsAggregateOfString(self, i, v) + + + def setArgumentAsEntityInstance(self, i, v): + """setArgumentAsEntityInstance(entity_instance self, unsigned int i, entity_instance v)""" + return _ifcopenshell_wrapper.entity_instance_setArgumentAsEntityInstance(self, i, v) + + + def setArgumentAsAggregateOfEntityInstance(self, i, v): + """setArgumentAsAggregateOfEntityInstance(entity_instance self, unsigned int i, IfcEntityList::ptr v)""" + return _ifcopenshell_wrapper.entity_instance_setArgumentAsAggregateOfEntityInstance(self, i, v) + + + def setArgumentAsAggregateOfAggregateOfInt(self, i, v): + """setArgumentAsAggregateOfAggregateOfInt(entity_instance self, unsigned int i, std::vector< std::vector< int > > const & v)""" + return _ifcopenshell_wrapper.entity_instance_setArgumentAsAggregateOfAggregateOfInt(self, i, v) + + + def setArgumentAsAggregateOfAggregateOfDouble(self, i, v): + """setArgumentAsAggregateOfAggregateOfDouble(entity_instance self, unsigned int i, std::vector< std::vector< double > > const & v)""" + return _ifcopenshell_wrapper.entity_instance_setArgumentAsAggregateOfAggregateOfDouble(self, i, v) + + + def setArgumentAsAggregateOfAggregateOfEntityInstance(self, i, v): + """setArgumentAsAggregateOfAggregateOfEntityInstance(entity_instance self, unsigned int i, IfcEntityListList::ptr v)""" + return _ifcopenshell_wrapper.entity_instance_setArgumentAsAggregateOfAggregateOfEntityInstance(self, i, v) + +entity_instance_swigregister = _ifcopenshell_wrapper.entity_instance_swigregister +entity_instance_swigregister(entity_instance) + +class IfcBaseEntity(entity_instance): + """Proxy of C++ IfcUtil::IfcBaseEntity class.""" + + __swig_setmethods__ = {} + for _s in [entity_instance]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, IfcBaseEntity, name, value) + __swig_getmethods__ = {} + for _s in [entity_instance]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, IfcBaseEntity, name) + + def __init__(self, *args, **kwargs): + raise AttributeError("No constructor defined - class is abstract") + __repr__ = _swig_repr + + def declaration(self): + """declaration(IfcBaseEntity self) -> entity""" + return _ifcopenshell_wrapper.IfcBaseEntity_declaration(self) + + + def get(self, name): + """get(IfcBaseEntity self, std::string const & name) -> Argument *""" + return _ifcopenshell_wrapper.IfcBaseEntity_get(self, name) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_IfcBaseEntity + __del__ = lambda self: None +IfcBaseEntity_swigregister = _ifcopenshell_wrapper.IfcBaseEntity_swigregister +IfcBaseEntity_swigregister(IfcBaseEntity) + +class IfcBaseType(entity_instance): + """Proxy of C++ IfcUtil::IfcBaseType class.""" + + __swig_setmethods__ = {} + for _s in [entity_instance]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, IfcBaseType, name, value) + __swig_getmethods__ = {} + for _s in [entity_instance]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, IfcBaseType, name) + + def __init__(self, *args, **kwargs): + raise AttributeError("No constructor defined - class is abstract") + __repr__ = _swig_repr + + def declaration(self): + """declaration(IfcBaseType self) -> type_declaration""" + return _ifcopenshell_wrapper.IfcBaseType_declaration(self) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_IfcBaseType + __del__ = lambda self: None +IfcBaseType_swigregister = _ifcopenshell_wrapper.IfcBaseType_swigregister +IfcBaseType_swigregister(IfcBaseType) + +class parameter_type(_object): + """Proxy of C++ IfcParse::parameter_type class.""" + + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, parameter_type, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, parameter_type, name) + __repr__ = _swig_repr + + def as_named_type(self): + """as_named_type(parameter_type self) -> named_type""" + return _ifcopenshell_wrapper.parameter_type_as_named_type(self) + + + def as_simple_type(self): + """as_simple_type(parameter_type self) -> simple_type""" + return _ifcopenshell_wrapper.parameter_type_as_simple_type(self) + + + def as_aggregation_type(self): + """as_aggregation_type(parameter_type self) -> aggregation_type""" + return _ifcopenshell_wrapper.parameter_type_as_aggregation_type(self) + + + def _is(self, *args): + """ + _is(parameter_type self, std::string const & arg2) -> bool + _is(parameter_type self, declaration arg2) -> bool + """ + return _ifcopenshell_wrapper.parameter_type__is(self, *args) + + + def __init__(self): + """__init__(IfcParse::parameter_type self) -> parameter_type""" + this = _ifcopenshell_wrapper.new_parameter_type() + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _ifcopenshell_wrapper.delete_parameter_type + __del__ = lambda self: None +parameter_type_swigregister = _ifcopenshell_wrapper.parameter_type_swigregister +parameter_type_swigregister(parameter_type) + +class named_type(parameter_type): + """Proxy of C++ IfcParse::named_type class.""" + + __swig_setmethods__ = {} + for _s in [parameter_type]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, named_type, name, value) + __swig_getmethods__ = {} + for _s in [parameter_type]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, named_type, name) + __repr__ = _swig_repr + + def __init__(self, declared_type): + """__init__(IfcParse::named_type self, declaration declared_type) -> named_type""" + this = _ifcopenshell_wrapper.new_named_type(declared_type) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + + def declared_type(self): + """declared_type(named_type self) -> declaration""" + return _ifcopenshell_wrapper.named_type_declared_type(self) + + + def as_named_type(self): + """as_named_type(named_type self) -> named_type""" + return _ifcopenshell_wrapper.named_type_as_named_type(self) + + + def _is(self, *args): + """ + _is(named_type self, std::string const & name) -> bool + _is(named_type self, declaration decl) -> bool + """ + return _ifcopenshell_wrapper.named_type__is(self, *args) + + + def __repr__(self): + return repr(self.declared_type()) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_named_type + __del__ = lambda self: None +named_type_swigregister = _ifcopenshell_wrapper.named_type_swigregister +named_type_swigregister(named_type) + +class simple_type(parameter_type): + """Proxy of C++ IfcParse::simple_type class.""" + + __swig_setmethods__ = {} + for _s in [parameter_type]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, simple_type, name, value) + __swig_getmethods__ = {} + for _s in [parameter_type]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, simple_type, name) + __repr__ = _swig_repr + binary_type = _ifcopenshell_wrapper.simple_type_binary_type + boolean_type = _ifcopenshell_wrapper.simple_type_boolean_type + integer_type = _ifcopenshell_wrapper.simple_type_integer_type + logical_type = _ifcopenshell_wrapper.simple_type_logical_type + number_type = _ifcopenshell_wrapper.simple_type_number_type + real_type = _ifcopenshell_wrapper.simple_type_real_type + string_type = _ifcopenshell_wrapper.simple_type_string_type + datatype_COUNT = _ifcopenshell_wrapper.simple_type_datatype_COUNT + + def __init__(self, declared_type): + """__init__(IfcParse::simple_type self, IfcParse::simple_type::data_type declared_type) -> simple_type""" + this = _ifcopenshell_wrapper.new_simple_type(declared_type) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + + def declared_type(self): + """declared_type(simple_type self) -> IfcParse::simple_type::data_type""" + return _ifcopenshell_wrapper.simple_type_declared_type(self) + + + def as_simple_type(self): + """as_simple_type(simple_type self) -> simple_type""" + return _ifcopenshell_wrapper.simple_type_as_simple_type(self) + + + def __repr__(self): + return "<%s>" % self.declared_type() + + __swig_destroy__ = _ifcopenshell_wrapper.delete_simple_type + __del__ = lambda self: None +simple_type_swigregister = _ifcopenshell_wrapper.simple_type_swigregister +simple_type_swigregister(simple_type) + +class aggregation_type(parameter_type): + """Proxy of C++ IfcParse::aggregation_type class.""" + + __swig_setmethods__ = {} + for _s in [parameter_type]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, aggregation_type, name, value) + __swig_getmethods__ = {} + for _s in [parameter_type]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, aggregation_type, name) + __repr__ = _swig_repr + array_type = _ifcopenshell_wrapper.aggregation_type_array_type + bag_type = _ifcopenshell_wrapper.aggregation_type_bag_type + list_type = _ifcopenshell_wrapper.aggregation_type_list_type + set_type = _ifcopenshell_wrapper.aggregation_type_set_type + + def __init__(self, type_of_aggregation, bound1, bound2, type_of_element): + """__init__(IfcParse::aggregation_type self, IfcParse::aggregation_type::aggregate_type type_of_aggregation, int bound1, int bound2, parameter_type type_of_element) -> aggregation_type""" + this = _ifcopenshell_wrapper.new_aggregation_type(type_of_aggregation, bound1, bound2, type_of_element) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + + def type_of_aggregation(self): + """type_of_aggregation(aggregation_type self) -> IfcParse::aggregation_type::aggregate_type""" + return _ifcopenshell_wrapper.aggregation_type_type_of_aggregation(self) + + + def bound1(self): + """bound1(aggregation_type self) -> int""" + return _ifcopenshell_wrapper.aggregation_type_bound1(self) + + + def bound2(self): + """bound2(aggregation_type self) -> int""" + return _ifcopenshell_wrapper.aggregation_type_bound2(self) + + + def type_of_element(self): + """type_of_element(aggregation_type self) -> parameter_type""" + return _ifcopenshell_wrapper.aggregation_type_type_of_element(self) + + + def as_aggregation_type(self): + """as_aggregation_type(aggregation_type self) -> aggregation_type""" + return _ifcopenshell_wrapper.aggregation_type_as_aggregation_type(self) + + + def type_of_aggregation_string(self): + """type_of_aggregation_string(aggregation_type self) -> std::string""" + return _ifcopenshell_wrapper.aggregation_type_type_of_aggregation_string(self) + + + def __repr__(self): + format_bound = lambda i: "?" if i == -1 else str(i) + return "<%s [%s:%s] of %r>" % ( + self.type_of_aggregation_string(), + format_bound(self.bound1()), + format_bound(self.bound2()), + self.type_of_element() + ) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_aggregation_type + __del__ = lambda self: None +aggregation_type_swigregister = _ifcopenshell_wrapper.aggregation_type_swigregister +aggregation_type_swigregister(aggregation_type) + +class declaration(_object): + """Proxy of C++ IfcParse::declaration class.""" + + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, declaration, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, declaration, name) + __repr__ = _swig_repr + + def __init__(self, name, index_in_schema): + """__init__(IfcParse::declaration self, std::string const & name, int index_in_schema) -> declaration""" + this = _ifcopenshell_wrapper.new_declaration(name, index_in_schema) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _ifcopenshell_wrapper.delete_declaration + __del__ = lambda self: None + + def name(self): + """name(declaration self) -> std::string const &""" + return _ifcopenshell_wrapper.declaration_name(self) + + + def name_lc(self): + """name_lc(declaration self) -> std::string const &""" + return _ifcopenshell_wrapper.declaration_name_lc(self) + + + def as_type_declaration(self): + """as_type_declaration(declaration self) -> type_declaration""" + return _ifcopenshell_wrapper.declaration_as_type_declaration(self) + + + def as_select_type(self): + """as_select_type(declaration self) -> select_type""" + return _ifcopenshell_wrapper.declaration_as_select_type(self) + + + def as_enumeration_type(self): + """as_enumeration_type(declaration self) -> enumeration_type""" + return _ifcopenshell_wrapper.declaration_as_enumeration_type(self) + + + def as_entity(self): + """as_entity(declaration self) -> entity""" + return _ifcopenshell_wrapper.declaration_as_entity(self) + + + def _is(self, *args): + """ + _is(declaration self, std::string const & name) -> bool + _is(declaration self, declaration decl) -> bool + """ + return _ifcopenshell_wrapper.declaration__is(self, *args) + + + def index_in_schema(self): + """index_in_schema(declaration self) -> int""" + return _ifcopenshell_wrapper.declaration_index_in_schema(self) + + + def type(self): + """type(declaration self) -> int""" + return _ifcopenshell_wrapper.declaration_type(self) + + + def schema(self): + """schema(declaration self) -> schema_definition""" + return _ifcopenshell_wrapper.declaration_schema(self) + +declaration_swigregister = _ifcopenshell_wrapper.declaration_swigregister +declaration_swigregister(declaration) + +class type_declaration(declaration): + """Proxy of C++ IfcParse::type_declaration class.""" + + __swig_setmethods__ = {} + for _s in [declaration]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, type_declaration, name, value) + __swig_getmethods__ = {} + for _s in [declaration]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, type_declaration, name) + __repr__ = _swig_repr + + def __init__(self, name, index_in_schema, declared_type): + """__init__(IfcParse::type_declaration self, std::string const & name, int index_in_schema, parameter_type declared_type) -> type_declaration""" + this = _ifcopenshell_wrapper.new_type_declaration(name, index_in_schema, declared_type) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + + def declared_type(self): + """declared_type(type_declaration self) -> parameter_type""" + return _ifcopenshell_wrapper.type_declaration_declared_type(self) + + + def as_type_declaration(self): + """as_type_declaration(type_declaration self) -> type_declaration""" + return _ifcopenshell_wrapper.type_declaration_as_type_declaration(self) + + + def __repr__(self): + return "" % (self.name(), self.declared_type()) + + __swig_destroy__ = _ifcopenshell_wrapper.delete_type_declaration + __del__ = lambda self: None +type_declaration_swigregister = _ifcopenshell_wrapper.type_declaration_swigregister +type_declaration_swigregister(type_declaration) + +class select_type(declaration): + """Proxy of C++ IfcParse::select_type class.""" + + __swig_setmethods__ = {} + for _s in [declaration]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, select_type, name, value) + __swig_getmethods__ = {} + for _s in [declaration]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, select_type, name) + __repr__ = _swig_repr + + def __init__(self, name, index_in_schema, select_list): + """__init__(IfcParse::select_type self, std::string const & name, int index_in_schema, std::vector< IfcParse::declaration const * > const & select_list) -> select_type""" + this = _ifcopenshell_wrapper.new_select_type(name, index_in_schema, select_list) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + + def select_list(self): + """select_list(select_type self) -> std::vector< IfcParse::declaration const * > const &""" + return _ifcopenshell_wrapper.select_type_select_list(self) + + + def as_select_type(self): + """as_select_type(select_type self) -> select_type""" + return _ifcopenshell_wrapper.select_type_as_select_type(self) + + + def __repr__(self): + return "