Meshes can now be automagically converted into circular and arbitrary profile extrusions (swept solids)

This commit is contained in:
Dion Moult
2021-02-28 12:04:30 +11:00
parent 5921bcb63d
commit 36cfb0d3f5
4 changed files with 164 additions and 64 deletions
@@ -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,