ifcopenshell.geom.main#

Module Contents#

ifcopenshell.geom.main.T#
ifcopenshell.geom.main.serialise#
ifcopenshell.geom.main.tesselate#
class ifcopenshell.geom.main.iterator(settings: iterator.__init__.settings, file_or_filename: Union[ifcopenshell.file.file, str], num_threads: int = 1, include: Optional[list[ifcopenshell.entity_instance.entity_instance]] = None, exclude: Optional[list[ifcopenshell.entity_instance.entity_instance]] = 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: Optional[tree.__init__.file] = None, settings: Optional[tree.__init__.settings] = None)#

Bases: ifcopenshell.ifcopenshell_wrapper.tree

add_file(self, file: tree.add_file.file, settings: tree.add_file.settings) None#
add_iterator(self, iterator: tree.add_iterator.iterator) None#
clash_clearance_many(self, set_a, set_b, clearance=0.05, check_all=False)#
clash_collision_many(self, set_a, set_b, allow_touching=False)#
clash_intersection_many(self, set_a, set_b, tolerance=0.002, check_all=True)#
select(self, value: Union[ifcopenshell.entity_instance.entity_instance, ifcopenshell.ifcopenshell_wrapper.BRepElement, tuple[float, float, float], OCC.Core.TopoDS.TopoDS_Shape], **kwargs) list[ifcopenshell.entity_instance.entity_instance]#
select_box(self, value, **kwargs) list[ifcopenshell.entity_instance.entity_instance]#
ifcopenshell.geom.main.consume_iterator(it, with_progress=False)#
ifcopenshell.geom.main.create_shape(settings: create_shape.settings, inst: ifcopenshell.entity_instance.entity_instance, repr: Optional[ifcopenshell.entity_instance.entity_instance] = None) ifcopenshell.ifcopenshell_wrapper.TriangulationElement#

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)#