ifcopenshell.geom.main#

Module Contents#

ifcopenshell.geom.main.T#
ifcopenshell.geom.main.serialise#
ifcopenshell.geom.main.tesselate#
class ifcopenshell.geom.main.iterator(settings, file_or_filename, num_threads=1, include=None, exclude=None)#

Bases: ifcopenshell.ifcopenshell_wrapper.Iterator

__iter__(self)#
class ifcopenshell.geom.main.serializers#
buffer#
obj#
svg#
xml#
class ifcopenshell.geom.main.settings#

Bases: ifcopenshell.ifcopenshell_wrapper.SerializerSettings

class ifcopenshell.geom.main.tree(file=None, settings=None)#

Bases: ifcopenshell.ifcopenshell_wrapper.tree

add_file(self, file, settings)#
add_iterator(self, iterator)#
select(self, value, **kwargs)#
select_box(self, value, **kwargs)#
ifcopenshell.geom.main.consume_iterator(it, with_progress=False)#
ifcopenshell.geom.main.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

Note that in Python, you must store a reference to the element returned by this function to prevent garbage collection when you access its children. See #1124.

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:

created_shape = geom.create_shape(settings, inst=product) shape = created_shape.geometry # see #1124 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

except:

print(“Shape creation failed”)

ifcopenshell.geom.main.iterate(settings, file_or_filename, num_threads=1, include=None, exclude=None, with_progress=False, cache=None)#
ifcopenshell.geom.main.make_shape_function(fn)#
ifcopenshell.geom.main.wrap_buffer_creation(fn: T)#

Python does not have automatic casts. The C++ serializers accept a stream_or_filename which in C++ can be automatically constructed from a filename string. In Python we have to implement this cast/construction explicitly.

ifcopenshell.geom.main.wrap_shape_creation(settings, shape)#
ifcopenshell.geom.main.wrap_shape_creation(settings, shape)#