mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 13:46:54 +00:00
You can now have sloped slabs, good for doing roof slabs.
This commit is contained in:
@@ -143,6 +143,7 @@ class DumbSlabGenerator:
|
|||||||
tool.Ifc.get(), "Plan", "FootPrint", "SKETCH_VIEW"
|
tool.Ifc.get(), "Plan", "FootPrint", "SKETCH_VIEW"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
props = bpy.context.scene.BIMModelProperties
|
||||||
self.collection = bpy.context.view_layer.active_layer_collection.collection
|
self.collection = bpy.context.view_layer.active_layer_collection.collection
|
||||||
self.collection_obj = bpy.data.objects.get(self.collection.name)
|
self.collection_obj = bpy.data.objects.get(self.collection.name)
|
||||||
self.depth = sum(thicknesses) * unit_scale
|
self.depth = sum(thicknesses) * unit_scale
|
||||||
@@ -150,6 +151,7 @@ class DumbSlabGenerator:
|
|||||||
self.length = 3
|
self.length = 3
|
||||||
self.rotation = 0
|
self.rotation = 0
|
||||||
self.location = Vector((0, 0, 0))
|
self.location = Vector((0, 0, 0))
|
||||||
|
self.x_angle = 0 if tool.Cad.is_x(props.x_angle, 0, tolerance=0.001) else radians(props.x_angle)
|
||||||
return self.derive_from_cursor(link_to_scene=link_to_scene)
|
return self.derive_from_cursor(link_to_scene=link_to_scene)
|
||||||
|
|
||||||
def derive_from_cursor(self, link_to_scene):
|
def derive_from_cursor(self, link_to_scene):
|
||||||
@@ -188,7 +190,11 @@ class DumbSlabGenerator:
|
|||||||
|
|
||||||
blenderbim.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj)
|
blenderbim.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj)
|
||||||
representation = ifcopenshell.api.run(
|
representation = ifcopenshell.api.run(
|
||||||
"geometry.add_slab_representation", tool.Ifc.get(), context=self.body_context, depth=self.depth
|
"geometry.add_slab_representation",
|
||||||
|
tool.Ifc.get(),
|
||||||
|
context=self.body_context,
|
||||||
|
depth=self.depth,
|
||||||
|
x_angle=self.x_angle,
|
||||||
)
|
)
|
||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"geometry.assign_representation", tool.Ifc.get(), product=element, representation=representation
|
"geometry.assign_representation", tool.Ifc.get(), product=element, representation=representation
|
||||||
@@ -280,24 +286,38 @@ class DumbSlabPlaner:
|
|||||||
if extrusion:
|
if extrusion:
|
||||||
extrusion.Depth = thickness
|
extrusion.Depth = thickness
|
||||||
else:
|
else:
|
||||||
|
props = bpy.context.scene.BIMModelProperties
|
||||||
|
x_angle = 0 if tool.Cad.is_x(props.x_angle, 0, tolerance=0.001) else radians(props.x_angle)
|
||||||
new_rep = ifcopenshell.api.run(
|
new_rep = ifcopenshell.api.run(
|
||||||
"geometry.add_slab_representation", tool.Ifc.get(), context=body_context, depth=thickness
|
"geometry.add_slab_representation",
|
||||||
|
tool.Ifc.get(),
|
||||||
|
context=body_context,
|
||||||
|
depth=thickness,
|
||||||
|
x_angle=x_angle,
|
||||||
)
|
)
|
||||||
for inverse in tool.Ifc.get().get_inverse(representation):
|
for inverse in tool.Ifc.get().get_inverse(representation):
|
||||||
ifcopenshell.util.element.replace_attribute(inverse, representation, new_rep)
|
ifcopenshell.util.element.replace_attribute(inverse, representation, new_rep)
|
||||||
blenderbim.core.geometry.switch_representation(
|
blenderbim.core.geometry.switch_representation(
|
||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=new_rep,
|
representation=new_rep,
|
||||||
should_reload=True,
|
should_reload=True,
|
||||||
is_global=True,
|
is_global=True,
|
||||||
should_sync_changes_first=False,
|
should_sync_changes_first=False,
|
||||||
)
|
)
|
||||||
blenderbim.core.geometry.remove_representation(tool.Ifc, tool.Geometry, obj=obj, representation=representation)
|
blenderbim.core.geometry.remove_representation(
|
||||||
|
tool.Ifc, tool.Geometry, obj=obj, representation=representation
|
||||||
|
)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
props = bpy.context.scene.BIMModelProperties
|
||||||
|
x_angle = 0 if tool.Cad.is_x(props.x_angle, 0, tolerance=0.001) else radians(props.x_angle)
|
||||||
representation = ifcopenshell.api.run(
|
representation = ifcopenshell.api.run(
|
||||||
"geometry.add_slab_representation", tool.Ifc.get(), context=body_context, depth=thickness
|
"geometry.add_slab_representation",
|
||||||
|
tool.Ifc.get(),
|
||||||
|
context=body_context,
|
||||||
|
depth=thickness,
|
||||||
|
x_angle=x_angle,
|
||||||
)
|
)
|
||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"geometry.assign_representation", tool.Ifc.get(), product=element, representation=representation
|
"geometry.assign_representation", tool.Ifc.get(), product=element, representation=representation
|
||||||
|
|||||||
@@ -254,6 +254,7 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
wall_objs = []
|
wall_objs = []
|
||||||
|
other_objs = []
|
||||||
x_angle = radians(self.x_angle)
|
x_angle = radians(self.x_angle)
|
||||||
for obj in context.selected_objects:
|
for obj in context.selected_objects:
|
||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
@@ -268,6 +269,15 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
extrusion.ExtrudedDirection.DirectionRatios = (0.0, sin(x_angle), cos(x_angle))
|
extrusion.ExtrudedDirection.DirectionRatios = (0.0, sin(x_angle), cos(x_angle))
|
||||||
if element.is_a("IfcWall"):
|
if element.is_a("IfcWall"):
|
||||||
wall_objs.append(obj)
|
wall_objs.append(obj)
|
||||||
|
else:
|
||||||
|
blenderbim.core.geometry.switch_representation(
|
||||||
|
tool.Geometry,
|
||||||
|
obj=obj,
|
||||||
|
representation=representation,
|
||||||
|
should_reload=True,
|
||||||
|
is_global=True,
|
||||||
|
should_sync_changes_first=False,
|
||||||
|
)
|
||||||
if wall_objs:
|
if wall_objs:
|
||||||
DumbWallRecalculator().recalculate(wall_objs)
|
DumbWallRecalculator().recalculate(wall_objs)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|||||||
@@ -107,6 +107,9 @@ class BimToolUI:
|
|||||||
row = cls.layout.row(align=True)
|
row = cls.layout.row(align=True)
|
||||||
row.prop(data=cls.props, property="length", text="Length")
|
row.prop(data=cls.props, property="length", text="Length")
|
||||||
|
|
||||||
|
row = cls.layout.row(align=True)
|
||||||
|
row.prop(data=cls.props, property="x_angle", text="X Angle")
|
||||||
|
elif cls.props.ifc_class == "IfcSlabType":
|
||||||
row = cls.layout.row(align=True)
|
row = cls.layout.row(align=True)
|
||||||
row.prop(data=cls.props, property="x_angle", text="X Angle")
|
row.prop(data=cls.props, property="x_angle", text="X Angle")
|
||||||
elif cls.props.ifc_class in ("IfcColumnType", "IfcBeamType", "IfcMemberType"):
|
elif cls.props.ifc_class in ("IfcColumnType", "IfcBeamType", "IfcMemberType"):
|
||||||
@@ -180,6 +183,11 @@ class BimToolUI:
|
|||||||
row.label(text="", icon="EVENT_SHIFT")
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
row.label(text="", icon="EVENT_E")
|
row.label(text="", icon="EVENT_E")
|
||||||
row.operator("bim.hotkey", text="Edit Profile").hotkey = "S_E"
|
row.operator("bim.hotkey", text="Edit Profile").hotkey = "S_E"
|
||||||
|
|
||||||
|
row = cls.layout.row(align=True)
|
||||||
|
row.prop(data=cls.props, property="x_angle", text="X Angle")
|
||||||
|
op = row.operator("bim.change_extrusion_x_angle", icon="FILE_REFRESH", text="")
|
||||||
|
op.x_angle = cls.props.x_angle
|
||||||
elif AuthoringData.data["active_class"] in (
|
elif AuthoringData.data["active_class"] in (
|
||||||
"IfcColumn",
|
"IfcColumn",
|
||||||
"IfcColumnStandardCase",
|
"IfcColumnStandardCase",
|
||||||
|
|||||||
Reference in New Issue
Block a user