Archicad Python API
About automating tasks in Archicad using the Python API.
SOLVED!

Getting project name using python

noriksaroyan
Booster

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! 

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
poco2013
Mentor

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.

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

View solution in original post

3 REPLIES 3
Solution
poco2013
Mentor

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.

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
scottjm
Expert

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!)

Scott J. Moore | Fulton Trotter Architects | BIM Manager, Associate, Architect
Since AC13 | Current versions AC23.7000 & AC26.5002 | BIMCloud Basic | Python, GDL, VBA, PHP, SQL, CSS
Certified Graphisoft BIM Manger (2022)
Win 10, i9-9900K, 32GB, Quadro P2200, 500GB NVMe

Thank you!