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
@@ -245,6 +245,7 @@ if bpy is not None:
operator.CleanWireframes,
operator.LinkIfc,
operator.SnapSpacesTogether,
operator.CopyGrid,
prop.StrProperty,
prop.Attribute,
prop.MaterialLayer,
@@ -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"}
@@ -2416,6 +2416,8 @@ class BIM_PT_annotation_utilities(Panel):
row.operator("bim.clean_wireframes")
row = layout.row(align=True)
row.operator("bim.link_ifc")
row = layout.row(align=True)
row.operator("bim.add_grid")
row = layout.row(align=True)
op = row.operator("bim.add_annotation", text="Dim", icon="ARROW_LEFTRIGHT")