fixed addin grid

close #1217, close #1215
This commit is contained in:
QwiglyDee
2020-12-29 02:04:08 +07:00
parent c0381588f3
commit 7f49ebea55
@@ -5525,9 +5525,18 @@ class CopyGrid(bpy.types.Operator):
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())
existing = [obj for obj in collection.objects if obj.name.startswith('IfcGridAxis')]
for obj in existing:
collection.objects.unlink(obj)
source = [obj
for coll in bpy.data.collections
if coll.name.startswith('IfcGrid')
for obj in coll.all_objects
if obj.type == 'MESH']
for obj in source:
dstobj = obj.copy()
dstobj.data = dstobj.data.copy()
collection.objects.link(dstobj)
return {"FINISHED"}