copying grid.

close #1210
This commit is contained in:
QwiglyDee
2020-12-26 23:25:39 +07:00
parent 3c2c591d6d
commit abaae7f06d
3 changed files with 23 additions and 0 deletions
@@ -1,3 +1,4 @@
from itertools import chain
import os
import bpy
import bcf
@@ -5198,3 +5199,22 @@ class SnapSpacesTogether(bpy.types.Operator):
for v in polygon.vertices:
obj.data.vertices[v].co += offset
return {"FINISHED"}
class CopyGrid(bpy.types.Operator):
bl_idname = "bim.add_grid"
bl_label = "Add Grid"
def execute(self, context):
props = context.scene.DocProperties
if props.active_drawing_index is None or len(props.drawings) == 0:
return {"CANCELED"}
drawing = props.drawings[props.active_drawing_index]
collection = bpy.data.collections.get("IfcGroup/" + drawing.name)
for coll in bpy.data.collections:
if coll.name.startswith('IfcGrid'):
for obj in coll.all_objects:
if obj.type == 'MESH':
collection.objects.link(obj.copy())
return {"FINISHED"}