We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

Automation: Recurring execution of publishing

Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi fellow developers!

I started 2 new hobby open source projects at github: The python scripts and the Add-On both works with Archicad 25 (build 2450) or later.

Python scripts for Archicad

Currently it contains one script, recurring_publish.py.
The script can schedule recurring publishing.
Archicad will be shut down after each publishing and it will be restarted before each publishing, the project will be reloaded automatically. User can choose Publisher Sets to publish.
Works for Teamwork (BIMcloud) projects also. A receive command is executed before each publishing.

Demo video: https://ttprivatenew.s3.amazonaws.com/pulse/lorantfyt/attachments/16911630/archicad_recurring_publis...
Short demo GIF:


Additional JSON/Python Commands Add-On for Archicad

This Add-On extends the JSON interface of Archicad by implementing new JSON commands.
These JSON commands are callable via Python.
The Add-On is required by the python scripts in archicad-python-scripts github repo.

Currently implemented Commands
  •  
  • Publish
  •  
  • GetProjectInfo
  •  
  • TeamworkReceive
  •  
  • GetArchicadLocation
  •  
  • Quit
All the contributions are welcome Feel free to copy or modify the code (MIT license), you can make pull requests
13 REPLIES 13
poco2013
Mentor
Source Code will not compile - I tried vs 2017 tool set 141 and vs2019 tool set 142
on 2019 I get error among others of newOwned not defined. on 2017 I get general errors of GS namespace not defined. Windows 10 used cmaketext.txt in source

A compile video would be helpful???

EDIT: do we need the 25 SDK? -- When will that be released?
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
poco2013 wrote:
do we need the 25 SDK? -- When will that be released?
Thanks for the feedback, Poco!
Yes, it requires the 25 SDK. The Béta 25 SDK is already available for those who are registered at the Béta Site, but it will go public soon.

I will record a video, how to compile. Using Visual Studio Code it's easy, that handles CMake and the building if VS2019 toolset is installed.
poco2013
Mentor
Thanks Tibor:

i had a chance to look at the code for the new Python command feature and it looks very compact and straight forward to use-- as usual, excellent work. However, I have some concerns as to how this will function. For example, you use classes to define the Python interface commands which appear to have a standard set of functions defined. There is no explanation as to how these classes are called, their order,or their internal functions.
The python code simply calls commands by a internal name returned from 'getname' but there is no direct call that i can see. I assume this is all done magically behind the scenes, but in what order and what are the needed parameters. if any.

Since I do not have access to the 25 SDK beta, it is very confusing and,because of that, somewhat unusable without a explanation.

Could I suggest a 'blog'(s) to explain the nuances, perhaps on the developer's site? You program does work well as per your video but I am unsure as how to apply to other add-ons without knowing the order and functions of the classes and their internal methods. The explanations within the SDK - to come- can be a little cryptic.

BTW - i did encounter a exception if i aborted the process. Don't know why since I don't understand the process.The C++ part functions are mostly just from the SDK ,but how are they called from Python?

Hoping for a Blog soon. Thanks again and looking forward to more of the same good work?
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
Podolsky
Ace
Would be interesting feature, if ArchiCAD can publish drawings without starting UI - working on the background, as many programs can work via terminal only.
poco2013
Mentor
I see no reason why it could not. The reason that Tibor requires initial start of the program is that he picks up from the program itself - the exe location, file location ,program title and available publish sets. If you knew these things before hand-- which you should.- and filled them into the tkinter dialog, it could automatically start and schedule a publish as it does do on repeated starts.
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
Podolsky
Ace
Okey, maybe say it different: does ArchiCAD have possibility to start and work without starting User Interface?
If I open terminal and type command there:
(this is just for example, there is no specific commands or language)

-ArchiCAD -publish -/user/alex/projects/1304myproject/1304myproejct.PLN -/user/alex/projects/1304myproject/drawings -publishing set name[drawngs issue] etc...

So I hit the return button and nothing really happens on the screen apart of notification in terminal about progress and when task is completed. Why it's important? because UI loading usually takes additional memory and for automated task absolutely not needed.
poco2013
Mentor
Podolsky wrote:
Okey, maybe say it different: does ArchiCAD have possibility to start and work without starting User Interface?
memory and for automated task absolutely not needed.
No Archicad does not have this capability. But the Windows Task Scheduler does and I assume so does the MAC. Python has access to the Windows system through one of its many modules and therefore could schedule it outside of memory. The actual publishing and any new features can not be done by Python. And it appears to be the case in the future. You would still have to write a C++ addon to do the actual task once Archicad is activated. The Python program would just call the functions of the new C++ addon or, in effect, the new Json commands embedded within the new Addon.

Tibor's program ,upon restart, activates Archicad through the operating system then communicates through Json to his Json Addon. You could schedule, through the task manager, either programmatically or manually a start of the Python program then, Archicad. We will, however, have to wait until the release of the 25 SDK for details. I believe that's a couple of months out?
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
runxel
Legend
Headless Archicad would definitively be a dream of mine.
Hopefully we can achieve this one day.
Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
Anonymous
Not applicable
Hi runxel,

What is Headless ArchiCAD's mean?

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!