The BIM Tool now provides similar slab-like editing tools for ramps and roofs

This commit is contained in:
Dion Moult
2022-10-20 20:51:32 +11:00
parent 8fa944d2a8
commit 45087e8822
3 changed files with 13 additions and 5 deletions
@@ -109,7 +109,7 @@ class BimToolUI:
row = cls.layout.row(align=True)
row.prop(data=cls.props, property="x_angle", text="X Angle")
elif cls.props.ifc_class == "IfcSlabType":
elif cls.props.ifc_class in ("IfcSlabType", "IfcRampType", "IfcRoofType"):
row = cls.layout.row(align=True)
row.prop(data=cls.props, property="x_angle", text="X Angle")
elif cls.props.ifc_class in ("IfcColumnType", "IfcBeamType", "IfcMemberType"):
@@ -177,7 +177,7 @@ class BimToolUI:
row.label(text="", icon="EVENT_G")
row.operator("bim.hotkey", text="Regen").hotkey = "S_G"
row.operator("bim.join_wall", icon="X", text="").join_type = ""
elif AuthoringData.data["active_class"] in ("IfcSlab", "IfcSlabStandardCase"):
elif AuthoringData.data["active_class"] in ("IfcSlab", "IfcSlabStandardCase", "IfcRamp", "IfcRoof"):
if context.active_object.mode == "OBJECT":
row = cls.layout.row(align=True)
row.label(text="", icon="EVENT_SHIFT")
@@ -414,7 +414,7 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
def hotkey_S_E(self):
if self.active_class in ("IfcWall", "IfcWallStandardCase"):
bpy.ops.bim.join_wall(join_type="T")
elif self.active_class in ("IfcSlab", "IfcSlabStandardCase"):
elif self.active_class in ("IfcSlab", "IfcSlabStandardCase", "IfcRamp", "IfcRoof"):
if not bpy.context.active_object:
pass
elif bpy.context.active_object.mode == "OBJECT":
@@ -17,6 +17,7 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell.util.unit
from math import sin, cos
class Usecase:
@@ -25,6 +26,7 @@ class Usecase:
self.settings = {
"context": None, # IfcGeometricRepresentationContext
"depth": 0.2,
"x_angle": 0, # Radians
# Planes are defined as a matrix. The XY plane is the clipping boundary and +Z is removed.
"clippings": [], # A list of planes that define clipping half space solids
}
@@ -47,10 +49,16 @@ class Usecase:
curve = self.file.createIfcPolyline([self.file.createIfcCartesianPoint(p) for p in points])
else:
curve = self.file.createIfcIndexedPolyCurve(self.file.createIfcCartesianPointList3D(points))
if self.settings["x_angle"]:
extrusion_direction = self.file.createIfcDirection(
(0.0, sin(self.settings["x_angle"]), cos(self.settings["x_angle"]))
)
else:
extrusion_direction = self.file.createIfcDirection((0.0, 0.0, 1.0))
extrusion = self.file.createIfcExtrudedAreaSolid(
self.file.createIfcArbitraryClosedProfileDef("AREA", None, curve),
None,
self.file.createIfcDirection((0.0, 0.0, 1.0)),
extrusion_direction,
self.convert_si_to_unit(self.settings["depth"]),
)
if self.settings["clippings"]:
@@ -16,8 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from math import sin, cos
import ifcopenshell.util.unit
from math import sin, cos
class Usecase: