def
listofProduct_shapes(ifc_file):
products
=
ifc_file.by_type(
"IfcProduct"
)
product_shapes
=
[]
for
product
in
products:
if
product.is_a(
"IfcOpeningElement"
)
or
product.is_a(
"IfcSite"
)
or
product.is_a(
"IfcAnnotation"
):
continue
else
:
try
:
shape
=
ifcopenshell.geom.create_shape(settings, product).geometry
product_shapes.append((product, shape))
except
:
continue
return
product_shapes
def
displayProduct_shapes(ifc_file):
products
=
ifc_file.by_type(
"IfcProduct"
)
product_shapes
=
[]
for
product
in
products:
if
product.is_a(
"IfcOpeningElement"
)
or
product.is_a(
"IfcSite"
)
or
product.is_a(
"IfcAnnotation"
):
continue
try
:
shape
=
ifcopenshell.geom.create_shape(settings, product).geometry
product_shapes.append((product, shape))
except
:
continue
ifcopenshell.geom.utils.display_shape(shape)
occ_display.FitAll()
def
boundingBox_center(ifc_file):
walls
=
ifc_file.by_type(
"IfcWall"
)
wall_shapes
=
[]
bbox
=
OCC.Bnd.Bnd_Box()
for
wall
in
walls:
shape
=
ifcopenshell.geom.create_shape(settings, wall).geometry
wall_shapes.append((wall, shape))
OCC.BRepBndLib.brepbndlib_Add(shape, bbox)
bounding_box_center
=
ifcopenshell.geom.utils.get_bounding_box_center(bbox)
return
bounding_box_center
def
boundingBox_coordinates(ifc_file):
walls
=
ifc_file.by_type(
"IfcWall"
)
wall_shapes
=
[]
bbox
=
OCC.Bnd.Bnd_Box()
for
wall
in
walls:
shape
=
ifcopenshell.geom.create_shape(settings, wall).geometry
wall_shapes.append((wall, shape))
OCC.BRepBndLib.brepbndlib_Add(shape, bbox)
return
bbox.Get()
def
calc_surfaceArea_face(wire, face):
wire_data
=
OCC.ShapeExtend.ShapeExtend_WireData(wire,
True
,
True
)
wire_data_handle
=
OCC.ShapeExtend.Handle_ShapeExtend_WireData(wire_data)
surface_area
=
abs
(OCC.ShapeAnalysis.shapeanalysis_TotCross2D(wire_data_handle, face))
return
surface_area