mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
WIP window tool progress.
This commit is contained in:
@@ -77,7 +77,7 @@ class AddElementOpening(bpy.types.Operator):
|
||||
return {"FINISHED"}
|
||||
|
||||
if filling_obj:
|
||||
opening = self.generate_opening_from_filling(filling_obj)
|
||||
opening = self.generate_opening_from_filling(filling_obj, voided_obj)
|
||||
else:
|
||||
# The opening shall be based on the smallest bounding dimension of the element
|
||||
dimension = min(voided_obj.dimensions)
|
||||
@@ -121,18 +121,42 @@ class AddElementOpening(bpy.types.Operator):
|
||||
if obj and obj.BIMObjectProperties.ifc_definition_id:
|
||||
return obj
|
||||
|
||||
def generate_opening_from_filling(self, filling_obj):
|
||||
def generate_opening_from_filling(self, filling_obj, voided_obj):
|
||||
x, y, z = filling_obj.dimensions
|
||||
verts = [
|
||||
Vector((0, 0, 0)),
|
||||
Vector((0, 0, z)),
|
||||
Vector((0, y, 0)),
|
||||
Vector((0, y, z)),
|
||||
Vector((x, 0, 0)),
|
||||
Vector((x, 0, z)),
|
||||
Vector((x, y, 0)),
|
||||
Vector((x, y, z)),
|
||||
]
|
||||
dimension = min(voided_obj.dimensions)
|
||||
if dimension == voided_obj.dimensions[0]:
|
||||
verts = [
|
||||
Vector((-0.1, 0, 0)),
|
||||
Vector((-0.1, 0, z)),
|
||||
Vector((-0.1, y, 0)),
|
||||
Vector((-0.1, y, z)),
|
||||
Vector((dimension+0.1, 0, 0)),
|
||||
Vector((dimension+0.1, 0, z)),
|
||||
Vector((dimension+0.1, y, 0)),
|
||||
Vector((dimension+0.1, y, z)),
|
||||
]
|
||||
elif dimension == voided_obj.dimensions[1]:
|
||||
verts = [
|
||||
Vector((0, -0.1, 0)),
|
||||
Vector((0, -0.1, z)),
|
||||
Vector((0, dimension+0.1, 0)),
|
||||
Vector((0, dimension+0.1, z)),
|
||||
Vector((x, -0.1, 0)),
|
||||
Vector((x, -0.1, z)),
|
||||
Vector((x, dimension+0.1, 0)),
|
||||
Vector((x, dimension+0.1, z)),
|
||||
]
|
||||
elif dimension == voided_obj.dimensions[2]:
|
||||
verts = [
|
||||
Vector((0, 0, -0.1)),
|
||||
Vector((0, 0, dimension+0.1)),
|
||||
Vector((0, y, -0.1)),
|
||||
Vector((0, y, dimension+0.1)),
|
||||
Vector((x, 0, -0.1)),
|
||||
Vector((x, 0, dimension+0.1)),
|
||||
Vector((x, y, -0.1)),
|
||||
Vector((x, y, dimension+0.1)),
|
||||
]
|
||||
edges = []
|
||||
faces = [
|
||||
[0, 1, 3, 2],
|
||||
@@ -146,6 +170,10 @@ class AddElementOpening(bpy.types.Operator):
|
||||
mesh.from_pydata(verts, edges, faces)
|
||||
obj = bpy.data.objects.new("Opening", mesh)
|
||||
obj.matrix_world = filling_obj.matrix_world
|
||||
|
||||
filling_obj.rotation_euler = voided_obj.rotation_euler
|
||||
obj.parent = filling_obj
|
||||
obj.matrix_parent_inverse = filling_obj.matrix_world.inverted()
|
||||
return obj
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user