mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-28 19:27:10 +00:00
Purge old dumb wall. Bye bye!
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import bpy
|
import bpy
|
||||||
from . import operator, ui, grid, wall, stair, door, window, slab, opening, pie
|
from . import operator, ui, grid, stair, door, window, slab, opening, pie
|
||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
operator.AddTypeInstance,
|
operator.AddTypeInstance,
|
||||||
@@ -9,7 +9,6 @@ classes = (
|
|||||||
ui.BIM_PT_authoring_architectural,
|
ui.BIM_PT_authoring_architectural,
|
||||||
ui.BIM_PT_misc_utilities,
|
ui.BIM_PT_misc_utilities,
|
||||||
grid.BIM_OT_add_object,
|
grid.BIM_OT_add_object,
|
||||||
wall.BIM_OT_add_object,
|
|
||||||
stair.BIM_OT_add_object,
|
stair.BIM_OT_add_object,
|
||||||
door.BIM_OT_add_object,
|
door.BIM_OT_add_object,
|
||||||
window.BIM_OT_add_object,
|
window.BIM_OT_add_object,
|
||||||
@@ -34,7 +33,6 @@ addon_keymaps = []
|
|||||||
|
|
||||||
def register():
|
def register():
|
||||||
bpy.types.VIEW3D_MT_mesh_add.append(grid.add_object_button)
|
bpy.types.VIEW3D_MT_mesh_add.append(grid.add_object_button)
|
||||||
bpy.types.VIEW3D_MT_mesh_add.append(wall.add_object_button)
|
|
||||||
bpy.types.VIEW3D_MT_mesh_add.append(stair.add_object_button)
|
bpy.types.VIEW3D_MT_mesh_add.append(stair.add_object_button)
|
||||||
bpy.types.VIEW3D_MT_mesh_add.append(door.add_object_button)
|
bpy.types.VIEW3D_MT_mesh_add.append(door.add_object_button)
|
||||||
bpy.types.VIEW3D_MT_mesh_add.append(window.add_object_button)
|
bpy.types.VIEW3D_MT_mesh_add.append(window.add_object_button)
|
||||||
@@ -50,7 +48,6 @@ def register():
|
|||||||
|
|
||||||
def unregister():
|
def unregister():
|
||||||
bpy.types.VIEW3D_MT_mesh_add.remove(grid.add_object_button)
|
bpy.types.VIEW3D_MT_mesh_add.remove(grid.add_object_button)
|
||||||
bpy.types.VIEW3D_MT_mesh_add.remove(wall.add_object_button)
|
|
||||||
bpy.types.VIEW3D_MT_mesh_add.remove(stair.add_object_button)
|
bpy.types.VIEW3D_MT_mesh_add.remove(stair.add_object_button)
|
||||||
bpy.types.VIEW3D_MT_mesh_add.remove(door.add_object_button)
|
bpy.types.VIEW3D_MT_mesh_add.remove(door.add_object_button)
|
||||||
bpy.types.VIEW3D_MT_mesh_add.remove(window.add_object_button)
|
bpy.types.VIEW3D_MT_mesh_add.remove(window.add_object_button)
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
import bpy
|
|
||||||
from bpy.types import Operator
|
|
||||||
from bpy.props import FloatProperty, BoolProperty
|
|
||||||
from mathutils import Vector
|
|
||||||
from blenderbim.bim.ifc import IfcStore
|
|
||||||
|
|
||||||
|
|
||||||
def add_object(self, context):
|
|
||||||
if self.use_plane:
|
|
||||||
verts = [
|
|
||||||
Vector((0, 0, 0)),
|
|
||||||
Vector((0, 0, self.height)),
|
|
||||||
Vector((self.length, 0, self.height)),
|
|
||||||
Vector((self.length, 0, 0)),
|
|
||||||
]
|
|
||||||
edges = []
|
|
||||||
faces = [[0, 1, 2, 3]]
|
|
||||||
else:
|
|
||||||
verts = [
|
|
||||||
Vector((0, 0, 0)),
|
|
||||||
Vector((self.length, 0, 0)),
|
|
||||||
]
|
|
||||||
edges = [[0, 1]]
|
|
||||||
faces = []
|
|
||||||
|
|
||||||
mesh = bpy.data.meshes.new(name="Dumb Wall")
|
|
||||||
mesh.from_pydata(verts, edges, faces)
|
|
||||||
obj = bpy.data.objects.new("Wall", mesh)
|
|
||||||
context.view_layer.active_layer_collection.collection.objects.link(obj)
|
|
||||||
if not self.use_plane:
|
|
||||||
modifier = obj.modifiers.new("Wall Height", "SCREW")
|
|
||||||
modifier.angle = 0
|
|
||||||
modifier.screw_offset = self.height
|
|
||||||
modifier.use_smooth_shade = False
|
|
||||||
modifier.use_normal_calculate = True
|
|
||||||
modifier.use_normal_flip = True
|
|
||||||
modifier.steps = 1
|
|
||||||
modifier.render_steps = 1
|
|
||||||
modifier = obj.modifiers.new("Wall Width", "SOLIDIFY")
|
|
||||||
modifier.use_even_offset = True
|
|
||||||
modifier.thickness = self.width
|
|
||||||
obj.name = "Wall"
|
|
||||||
if IfcStore.get_file():
|
|
||||||
bpy.ops.bim.assign_class(obj=obj.name, ifc_class="IfcWall")
|
|
||||||
obj.location = context.scene.cursor.location
|
|
||||||
return obj
|
|
||||||
|
|
||||||
|
|
||||||
class BIM_OT_add_object(Operator):
|
|
||||||
bl_idname = "mesh.add_wall"
|
|
||||||
bl_label = "Dumb Wall"
|
|
||||||
|
|
||||||
height: FloatProperty(name="Height", default=3)
|
|
||||||
length: FloatProperty(name="Length", default=1)
|
|
||||||
width: FloatProperty(name="Width", default=0.2)
|
|
||||||
use_plane: BoolProperty(name="Use Plane", default=False)
|
|
||||||
|
|
||||||
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")
|
|
||||||
Reference in New Issue
Block a user