2023-03-20 12:16 AM - last edited on 2024-09-26 12:20 PM by Doreena Deng
Hi everyone!
I was wondering if there is a way to get current project name via python. I've looked up in documentation and, unfortunately for me, I didn't find anything.
Thanks in advance!
Solved! Go to Solution.
2023-03-20 04:11 AM
The short answer is NO. Python scripts do not have access to the project information, at this time.
There are two workaround:
One: you could create a string expression and just input the Project Name from the Project Details tab. Then address the custom property in your script.
Two: This information is available in the C++ API, so you could reach it with a AddOn. Then, with in your script ,use the Python API function -- Command Handler -- to communicate with the AddOn and return the info. I have created such a AddOn and have attached it here and a script to retrieve the info. Note that all project attributes are in caps, Also if you recently watched the video, note that the class has been changed from 'Utilities' to 'Dialog' -- see the script.
BTW - The best approach would be to request that Graphisoft add this info to the Python API although I am not optimistic about that.
2023-03-20 04:11 AM
The short answer is NO. Python scripts do not have access to the project information, at this time.
There are two workaround:
One: you could create a string expression and just input the Project Name from the Project Details tab. Then address the custom property in your script.
Two: This information is available in the C++ API, so you could reach it with a AddOn. Then, with in your script ,use the Python API function -- Command Handler -- to communicate with the AddOn and return the info. I have created such a AddOn and have attached it here and a script to retrieve the info. Note that all project attributes are in caps, Also if you recently watched the video, note that the class has been changed from 'Utilities' to 'Dialog' -- see the script.
BTW - The best approach would be to request that Graphisoft add this info to the Python API although I am not optimistic about that.
2023-03-21 08:26 AM
this addon has a python property for project info, which you can extract the filename from.
https://github.com/tlorantfy/archicad-additional-json-commands#getprojectinfo
they really just need to cut to the chase and just implement all of the methods Tibor created in this addon into the standard archicad python addon methods. (them an about another 500 other useful methods and properties!)
2023-03-21 03:10 PM
Thank you!