mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 18:16:20 +00:00
Add support for 3D curve / wireframe representations.
This commit is contained in:
@@ -117,19 +117,20 @@ class AddRepresentation(bpy.types.Operator):
|
|||||||
if s.material and not s.material.BIMMaterialProperties.ifc_style_id
|
if s.material and not s.material.BIMMaterialProperties.ifc_style_id
|
||||||
]
|
]
|
||||||
|
|
||||||
ifcopenshell.api.run(
|
if isinstance(obj.data, bpy.types.Mesh) and len(obj.data.polygons):
|
||||||
"style.assign_representation_styles",
|
ifcopenshell.api.run(
|
||||||
self.file,
|
"style.assign_representation_styles",
|
||||||
**{
|
self.file,
|
||||||
"shape_representation": result,
|
**{
|
||||||
"styles": [
|
"shape_representation": result,
|
||||||
self.file.by_id(s.material.BIMMaterialProperties.ifc_style_id)
|
"styles": [
|
||||||
for s in obj.material_slots
|
self.file.by_id(s.material.BIMMaterialProperties.ifc_style_id)
|
||||||
if s.material
|
for s in obj.material_slots
|
||||||
],
|
if s.material
|
||||||
"should_use_presentation_style_assignment": context.scene.BIMGeometryProperties.should_use_presentation_style_assignment,
|
],
|
||||||
},
|
"should_use_presentation_style_assignment": context.scene.BIMGeometryProperties.should_use_presentation_style_assignment,
|
||||||
)
|
},
|
||||||
|
)
|
||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"geometry.assign_representation", self.file, **{"product": product, "representation": result}
|
"geometry.assign_representation", self.file, **{"product": product, "representation": result}
|
||||||
)
|
)
|
||||||
@@ -330,19 +331,20 @@ class UpdateRepresentation(bpy.types.Operator):
|
|||||||
if s.material and not s.material.BIMMaterialProperties.ifc_style_id
|
if s.material and not s.material.BIMMaterialProperties.ifc_style_id
|
||||||
]
|
]
|
||||||
|
|
||||||
ifcopenshell.api.run(
|
if isinstance(obj.data, bpy.types.Mesh) and len(obj.data.polygons):
|
||||||
"style.assign_representation_styles",
|
ifcopenshell.api.run(
|
||||||
self.file,
|
"style.assign_representation_styles",
|
||||||
**{
|
self.file,
|
||||||
"shape_representation": new_representation,
|
**{
|
||||||
"styles": [
|
"shape_representation": new_representation,
|
||||||
self.file.by_id(s.material.BIMMaterialProperties.ifc_style_id)
|
"styles": [
|
||||||
for s in obj.material_slots
|
self.file.by_id(s.material.BIMMaterialProperties.ifc_style_id)
|
||||||
if s.material
|
for s in obj.material_slots
|
||||||
],
|
if s.material
|
||||||
"should_use_presentation_style_assignment": context.scene.BIMGeometryProperties.should_use_presentation_style_assignment,
|
],
|
||||||
},
|
"should_use_presentation_style_assignment": context.scene.BIMGeometryProperties.should_use_presentation_style_assignment,
|
||||||
)
|
},
|
||||||
|
)
|
||||||
|
|
||||||
# TODO: move this into a replace_representation usecase or something
|
# TODO: move this into a replace_representation usecase or something
|
||||||
for inverse in self.file.get_inverse(old_representation):
|
for inverse in self.file.get_inverse(old_representation):
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ class Usecase:
|
|||||||
"unit_scale": None, # A scale factor to apply for all vectors in case the unit is different
|
"unit_scale": None, # A scale factor to apply for all vectors in case the unit is different
|
||||||
"should_force_faceted_brep": False, # If we should force faceted breps for meshes
|
"should_force_faceted_brep": False, # If we should force faceted breps for meshes
|
||||||
"should_force_triangulation": False, # If we should force triangulation for meshes
|
"should_force_triangulation": False, # If we should force triangulation for meshes
|
||||||
"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_point_cloud": False, # If the geometry is a point cloud
|
||||||
# Possible IFC representation classes:
|
# Possible IFC representation classes:
|
||||||
# IfcExtrudedAreaSolid/IfcRectangleProfileDef
|
# IfcExtrudedAreaSolid/IfcRectangleProfileDef
|
||||||
@@ -204,9 +202,9 @@ class Usecase:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def create_variable_representation(self):
|
def create_variable_representation(self):
|
||||||
if self.settings["is_wireframe"]:
|
if isinstance(self.settings["geometry"], bpy.types.Curve):
|
||||||
return self.create_wireframe_representation()
|
return self.create_curve3d_representation()
|
||||||
elif self.settings["is_curve"]:
|
elif not len(self.settings["geometry"].polygons):
|
||||||
return self.create_curve3d_representation()
|
return self.create_curve3d_representation()
|
||||||
elif self.settings["is_point_cloud"]:
|
elif self.settings["is_point_cloud"]:
|
||||||
return self.create_point_cloud_representation()
|
return self.create_point_cloud_representation()
|
||||||
|
|||||||
Reference in New Issue
Block a user