mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 02:47:48 +00:00
Add dumb slab feature
This commit is contained in:
@@ -14,6 +14,7 @@ if bpy is not None:
|
||||
from .module.model import wall as model_wall
|
||||
from .module.model import stair as model_stair
|
||||
from .module.model import door as model_door
|
||||
from .module.model import slab as model_slab
|
||||
|
||||
classes = (
|
||||
operator.AssignClass,
|
||||
@@ -273,6 +274,7 @@ if bpy is not None:
|
||||
model_wall.BIM_OT_add_object,
|
||||
model_stair.BIM_OT_add_object,
|
||||
model_door.BIM_OT_add_object,
|
||||
model_slab.BIM_OT_add_object,
|
||||
)
|
||||
|
||||
def menu_func_export(self, context):
|
||||
@@ -311,6 +313,7 @@ if bpy is not None:
|
||||
bpy.types.VIEW3D_MT_mesh_add.append(model_wall.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.append(model_stair.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.append(model_door.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.append(model_slab.add_object_button)
|
||||
|
||||
def unregister():
|
||||
for cls in reversed(classes):
|
||||
@@ -333,3 +336,4 @@ if bpy is not None:
|
||||
bpy.types.VIEW3D_MT_mesh_add.remove(model_wall.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.remove(model_stair.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.remove(model_door.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.remove(model_slab.add_object_button)
|
||||
|
||||
@@ -17,7 +17,7 @@ def add_object(self, context):
|
||||
]
|
||||
edges = []
|
||||
faces = [[0, 1, 2, 3, 4, 5]]
|
||||
mesh = bpy.data.meshes.new(name="New Dumb Door Profile")
|
||||
mesh = bpy.data.meshes.new(name="Dumb Door Profile")
|
||||
mesh.from_pydata(verts, edges, faces)
|
||||
obj = object_data_add(context, mesh, operator=self)
|
||||
bpy.ops.object.convert(target='CURVE')
|
||||
@@ -31,7 +31,7 @@ def add_object(self, context):
|
||||
]
|
||||
edges = [[0, 1], [1, 2], [2, 3]]
|
||||
faces = []
|
||||
mesh = bpy.data.meshes.new(name="New Dumb Door")
|
||||
mesh = bpy.data.meshes.new(name="IfcDoor/Dumb Door")
|
||||
mesh.from_pydata(verts, edges, faces)
|
||||
obj2 = object_data_add(context, mesh, operator=self)
|
||||
bpy.ops.object.convert(target='CURVE')
|
||||
@@ -53,7 +53,7 @@ def add_object(self, context):
|
||||
]
|
||||
edges = []
|
||||
faces = [[0, 1, 2, 3]]
|
||||
mesh = bpy.data.meshes.new(name="New Dumb Door Panel")
|
||||
mesh = bpy.data.meshes.new(name="Dumb Door Panel")
|
||||
mesh.from_pydata(verts, edges, faces)
|
||||
obj3 = object_data_add(context, mesh, operator=self)
|
||||
modifier = obj3.modifiers.new('Panel Height', 'SOLIDIFY')
|
||||
@@ -75,7 +75,7 @@ def add_object(self, context):
|
||||
]
|
||||
edges = []
|
||||
faces = [[0, 1, 2, 3]]
|
||||
mesh = bpy.data.meshes.new(name="New Dumb Door Opening")
|
||||
mesh = bpy.data.meshes.new(name="Dumb Door Opening")
|
||||
mesh.from_pydata(verts, edges, faces)
|
||||
obj4 = object_data_add(context, mesh, operator=self)
|
||||
modifier = obj4.modifiers.new('Panel Height', 'SOLIDIFY')
|
||||
@@ -85,6 +85,14 @@ def add_object(self, context):
|
||||
obj4.display_type = 'WIRE'
|
||||
obj4.parent = obj2
|
||||
obj4.matrix_parent_inverse = obj2.matrix_world.inverted()
|
||||
obj4.name = 'IfcOpeningElement/Dumb Door Opening'
|
||||
attribute = obj4.BIMObjectProperties.attributes.add()
|
||||
attribute.name = 'PredefinedType'
|
||||
attribute.string_value = 'OPENING'
|
||||
|
||||
attribute = obj2.BIMObjectProperties.attributes.add()
|
||||
attribute.name = 'PredefinedType'
|
||||
attribute.string_value = 'DOOR'
|
||||
|
||||
|
||||
class BIM_OT_add_object(Operator, AddObjectHelper):
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import bpy
|
||||
from bpy.types import Operator
|
||||
from bpy.props import FloatVectorProperty, FloatProperty, IntProperty
|
||||
from bpy_extras.object_utils import AddObjectHelper, object_data_add
|
||||
from mathutils import Vector
|
||||
|
||||
def add_object(self, context):
|
||||
verts = [
|
||||
Vector((0, 0, 0)),
|
||||
Vector((0, self.width, 0)),
|
||||
Vector((self.length, self.width, 0)),
|
||||
Vector((self.length, 0, 0)),
|
||||
]
|
||||
edges = []
|
||||
faces = [[0, 1, 2, 3]]
|
||||
|
||||
mesh = bpy.data.meshes.new(name="Dumb Slab")
|
||||
mesh.from_pydata(verts, edges, faces)
|
||||
obj = object_data_add(context, mesh, operator=self)
|
||||
modifier = obj.modifiers.new('Slab Depth', 'SOLIDIFY')
|
||||
modifier.use_even_offset = True
|
||||
modifier.offset = 1
|
||||
modifier.thickness = self.depth
|
||||
obj.name = 'IfcSlab/Dumb Slab'
|
||||
attribute = obj.BIMObjectProperties.attributes.add()
|
||||
attribute.name = 'PredefinedType'
|
||||
attribute.string_value = 'FLOOR'
|
||||
|
||||
|
||||
class BIM_OT_add_object(Operator, AddObjectHelper):
|
||||
bl_idname = "mesh.add_slab"
|
||||
bl_label = "Dumb Slab"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
length: FloatProperty(name='Length', default=2)
|
||||
width: FloatProperty(name='Width', default=2)
|
||||
depth: FloatProperty(name='Depth', default=.2)
|
||||
|
||||
def execute(self, context):
|
||||
add_object(self, context)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def add_object_button(self, context):
|
||||
self.layout.operator(
|
||||
BIM_OT_add_object.bl_idname,
|
||||
icon='PLUGIN')
|
||||
@@ -16,7 +16,7 @@ def add_object(self, context):
|
||||
edges = []
|
||||
faces = [[0, 1, 2, 3]]
|
||||
|
||||
mesh = bpy.data.meshes.new(name="New Dumb Stair")
|
||||
mesh = bpy.data.meshes.new(name="Dumb Stair")
|
||||
mesh.from_pydata(verts, edges, faces)
|
||||
obj = object_data_add(context, mesh, operator=self)
|
||||
modifier = obj.modifiers.new('Stair Width', 'SOLIDIFY')
|
||||
@@ -31,6 +31,10 @@ def add_object(self, context):
|
||||
modifier.count = self.number_of_treads
|
||||
self.riser_height = self.height / self.number_of_treads
|
||||
self.length = self.number_of_treads * self.tread_length
|
||||
obj.name = 'IfcStairFlight/Dumb Stair'
|
||||
attribute = obj.BIMObjectProperties.attributes.add()
|
||||
attribute.name = 'PredefinedType'
|
||||
attribute.string_value = 'STRAIGHT'
|
||||
|
||||
|
||||
class BIM_OT_add_object(Operator, AddObjectHelper):
|
||||
|
||||
@@ -14,12 +14,16 @@ def add_object(self, context):
|
||||
edges = []
|
||||
faces = [[0, 1, 2, 3]]
|
||||
|
||||
mesh = bpy.data.meshes.new(name="New Dumb Wall")
|
||||
mesh = bpy.data.meshes.new(name="Dumb Wall")
|
||||
mesh.from_pydata(verts, edges, faces)
|
||||
obj = object_data_add(context, mesh, operator=self)
|
||||
modifier = obj.modifiers.new('Wall Width', 'SOLIDIFY')
|
||||
modifier.use_even_offset = True
|
||||
modifier.thickness = self.width
|
||||
obj.name = 'IfcWall/Dumb Wall'
|
||||
attribute = obj.BIMObjectProperties.attributes.add()
|
||||
attribute.name = 'PredefinedType'
|
||||
attribute.string_value = 'STANDARD'
|
||||
|
||||
|
||||
class BIM_OT_add_object(Operator, AddObjectHelper):
|
||||
|
||||
Reference in New Issue
Block a user