mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-03 21:38:12 +00:00
Meshes can now be automagically converted into circular and arbitrary profile extrusions (swept solids)
This commit is contained in:
@@ -21,7 +21,11 @@ class Usecase:
|
||||
"is_wireframe": False, # If the geometry is a wireframe
|
||||
"is_curve": False, # If the geometry is a Blender curve
|
||||
"is_point_cloud": False, # If the geometry is a point cloud
|
||||
"is_rectangular_extrusion": False,
|
||||
# Possible IFC representation classes:
|
||||
# IfcExtrudedAreaSolid/IfcRectangleProfileDef
|
||||
# IfcExtrudedAreaSolid/IfcCircleProfileDef
|
||||
# IfcExtrudedAreaSolid/IfcArbitraryClosedProfileDef
|
||||
"ifc_representation_class": None, # Whether to cast a mesh into a particular class
|
||||
}
|
||||
self.ifc_vertices = []
|
||||
for key, value in settings.items():
|
||||
@@ -126,8 +130,12 @@ class Usecase:
|
||||
return self.create_curve_representation()
|
||||
elif self.settings["is_point_cloud"]:
|
||||
return self.create_point_cloud_representation()
|
||||
elif self.settings["is_rectangular_extrusion"]:
|
||||
return self.create_rectangular_extrusion_representation()
|
||||
elif self.settings["ifc_representation_class"] == "IfcExtrudedAreaSolid/IfcRectangleProfileDef":
|
||||
return self.create_rectangle_extrusion_representation()
|
||||
elif self.settings["ifc_representation_class"] == "IfcExtrudedAreaSolid/IfcCircleProfileDef":
|
||||
return self.create_circle_extrusion_representation()
|
||||
elif self.settings["ifc_representation_class"] == "IfcExtrudedAreaSolid/IfcArbitraryClosedProfileDef":
|
||||
return self.create_arbitrary_extrusion_representation()
|
||||
return self.create_mesh_representation()
|
||||
|
||||
def create_curve3d_representation(self):
|
||||
@@ -219,11 +227,35 @@ class Usecase:
|
||||
results.append(self.file.createIfcPolyline(points))
|
||||
return results
|
||||
|
||||
def create_rectangular_extrusion_representation(self):
|
||||
def create_rectangle_extrusion_representation(self):
|
||||
helper = Helper(self.file)
|
||||
indices = helper.auto_detect_rectangle_profile_extruded_area_solid(self.settings["geometry"])
|
||||
profile_def = helper.create_rectangle_profile_def(self.settings["blender_object"], indices["profile"])
|
||||
item = helper.create_extruded_area_solid(self.settings["blender_object"], indices["extrusion"], profile_def)
|
||||
profile_def = helper.create_rectangle_profile_def(self.settings["geometry"], indices["profile"])
|
||||
item = helper.create_extruded_area_solid(self.settings["geometry"], indices["extrusion"], profile_def)
|
||||
return self.file.createIfcShapeRepresentation(
|
||||
self.settings["context"],
|
||||
self.settings["context"].ContextIdentifier,
|
||||
"SweptSolid",
|
||||
[item],
|
||||
)
|
||||
|
||||
def create_circle_extrusion_representation(self):
|
||||
helper = Helper(self.file)
|
||||
indices = helper.auto_detect_circle_profile_extruded_area_solid(self.settings["geometry"])
|
||||
profile_def = helper.create_circle_profile_def(self.settings["geometry"], indices["profile"])
|
||||
item = helper.create_extruded_area_solid(self.settings["geometry"], indices["extrusion"], profile_def)
|
||||
return self.file.createIfcShapeRepresentation(
|
||||
self.settings["context"],
|
||||
self.settings["context"].ContextIdentifier,
|
||||
"SweptSolid",
|
||||
[item],
|
||||
)
|
||||
|
||||
def create_arbitrary_extrusion_representation(self):
|
||||
helper = Helper(self.file)
|
||||
indices = helper.auto_detect_arbitrary_closed_profile_extruded_area_solid(self.settings["geometry"])
|
||||
profile_def = helper.create_arbitrary_closed_profile_def(self.settings["geometry"], indices["profile"])
|
||||
item = helper.create_extruded_area_solid(self.settings["geometry"], indices["extrusion"], profile_def)
|
||||
return self.file.createIfcShapeRepresentation(
|
||||
self.settings["context"],
|
||||
self.settings["context"].ContextIdentifier,
|
||||
|
||||
Reference in New Issue
Block a user