2022-04-08 01:59 PM - edited 2022-04-08 03:15 PM
Hello dear Graphisoft community,
I'm working on automation with Python and i wanted to write a script which replaces old classifiers with new ones. So i wrote this small script:
But when i execute the script I get for 90% of the elements the following error:
"FailedExecutionResult {'success': False, 'error': {'code': 6001, 'message': 'TeamWork permission denied'}}"
I can't seem to find the meaning of this error message and the only other reference i find is a 2 year old post from here ( https://community.Graphisoft.com/t5/Developer-forum/Python-Error-Message/m-p/263656#M5765 ).
So what does this error msg mean? What can i do to prevent it? And since this error was perceived a bug I'm wondering if it got resolved now and it's working as intended or if it is still bugged.
Also, how does acc.SetClassificationsOfElements() work exactly? I tried to change the Classificationsystem of a single Element with this function and i got "SuccessfulExecutionResult {'success': True}" as result in my terminal, but in Archicad the classificationsystem remains unchanged. Am I misunderstanding the purpose of this function?
Thanks for your help and Kind Regards
Ziyad
Solved! Go to Solution.
2022-04-11 10:22 PM
Attached is sample script which corrects the error and demos changing all object classes to "morph"
from Archicad import ACConnection
import sys
conn = ACConnection.connect()
assert conn
acc = conn.commands
act = conn.types
acu = conn.utilities
nopId = ''
elem_list = []
systems = acc.GetAllClassificationSystems()
for s in systems:
if(s.name == 'Archicad Classification'):
nopId = s.classificationSystemId
all_elem = acc.GetAllElements()
classId = acu.FindClassificationItemInSystem("Archicad Classification",
"Morph")
classId = classId.classificationItemId
for elem in all_elem:
itemId = act.ClassificationId(nopId,classId)
ec = act.ElementClassification(elem.elementId, itemId)
elem_list.append(ec)
acc.SetClassificationsOfElements(elem_list)
2022-04-08 07:26 PM
AFAIK -- Type ElementClassification uses the element classification ID (sub level) not the system classification (top level). To find the ID of a sub level class use:
classId = acu.FindClassificationItemInSystem("top level name", "sub level name")
2022-04-11 10:22 PM
Attached is sample script which corrects the error and demos changing all object classes to "morph"
from Archicad import ACConnection
import sys
conn = ACConnection.connect()
assert conn
acc = conn.commands
act = conn.types
acu = conn.utilities
nopId = ''
elem_list = []
systems = acc.GetAllClassificationSystems()
for s in systems:
if(s.name == 'Archicad Classification'):
nopId = s.classificationSystemId
all_elem = acc.GetAllElements()
classId = acu.FindClassificationItemInSystem("Archicad Classification",
"Morph")
classId = classId.classificationItemId
for elem in all_elem:
itemId = act.ClassificationId(nopId,classId)
ec = act.ElementClassification(elem.elementId, itemId)
elem_list.append(ec)
acc.SetClassificationsOfElements(elem_list)
2022-04-14 05:56 PM
Hey Gerry,
Thanks a lot for your help (again 🙂
I was today in the office and could try out the code you posted and it worked!
Well, not in every case since i still get for some elements the error msg, but when i check the project every object so far got it classification set.
I think this has something to do with hotlinks elements we use, wouldnt be the first time they cause trouble. But for now it seems like i can do what i need to do.
Thanks for your help and Kind Regards
Ziyad