-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAttributes_Audit-Name_Layers_v1.py
84 lines (68 loc) · 4 KB
/
Attributes_Audit-Name_Layers_v1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
######################################### General Info #########################################
# Written by: Jessica Wood w/ Meghan Beckmann, for KAA Design Group #
# Date Created: 09/2022 #
# #
# Description: #
# This script checks the naming convention of all layers in a project. It will iterate #
# over all layers in a project and check if the naming convention complies to KAA #
# standards. #
################################################################################################
############ Archicad Connection #############
from archicad import ACConnection
from typing import List, Tuple, Iterable
from itertools import cycle
import copy
import math
conn = ACConnection.connect()
assert conn
acc = conn.commands
act = conn.types
acu = conn.utilities
##############################################
################################################################################## BEGIN LOGIC ##################################################################################
# Print Info begin Auditing
print("Begin Auditing for Layer Names.")
# Keep track of whether there is an error
hasError = False
# Get Layers and names
layerAttributes = acc.GetAttributesByType("Layer")
layAttr = acc.GetLayerAttributes(layerAttributes)
# iterate the layers and check the names
for layer in layAttr:
if (layer.layerAttribute.name == "Archicad Layer"):
continue
if (layer.layerAttribute.name[0] == "A" and layer.layerAttribute.name[1] == "-"):
continue
elif (layer.layerAttribute.name[0] == "L" and layer.layerAttribute.name[1] == "-"):
continue
elif (layer.layerAttribute.name[0] == "G" and layer.layerAttribute.name[1] == "-"):
continue
elif (layer.layerAttribute.name[0] == "M" and layer.layerAttribute.name[1] == "-"):
continue
elif (layer.layerAttribute.name[0] == "P" and layer.layerAttribute.name[1] == "-"):
continue
elif (layer.layerAttribute.name[0] == "E" and layer.layerAttribute.name[1] == "-"):
continue
elif (layer.layerAttribute.name[0] == "S" and layer.layerAttribute.name[1] == "-"):
continue
elif ((layer.layerAttribute.name[0] == "S" or layer.layerAttribute.name[0] == "Z") and layer.layerAttribute.name[1] == "9"):
continue
elif (layer.layerAttribute.name[0] == "9" and layer.layerAttribute.name[1] == " " and layer.layerAttribute.name[2] == "|"):
continue
elif (layer.layerAttribute.name[0] == "L" and layer.layerAttribute.name[1] == "T" and layer.layerAttribute.name[2] == "-"):
continue
elif (layer.layerAttribute.name[0] == "O" and layer.layerAttribute.name[1] == "P" and layer.layerAttribute.name[2] == "T" and layer.layerAttribute.name[3] == "I" and layer.layerAttribute.name[4] == "O" and layer.layerAttribute.name[5] == "N" and layer.layerAttribute.name[6] == "-"):
continue
elif (layer.layerAttribute.name[0] == "N" and layer.layerAttribute.name[1] == "P" and layer.layerAttribute.name[2] == "L" and layer.layerAttribute.name[3] == "T"):
continue
elif ((layer.layerAttribute.name[0] == "X" or layer.layerAttribute.name[0] == "Z") and layer.layerAttribute.name[1] == "-"):
continue
else:
hasError = True
print(f"Layer: {layer.layerAttribute.name} does not match the naming convention!\n")
# Print End message
if (hasError):
print("Audit finished - please fix these names that don't match our standards!")
else:
print("Audit finished - no errors found, hooray! Nice layer management.")
#########################################################################################################################################################################################