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

Exactly what can you do with Python?

Jim Allen
Advisor

One wish I have had with Archicad since I moved from Vectorworks several years ago, is the ability to rotate stuff (objects, geometry etc) 90 degrees with a single keystroke shortcut.

 

It's amazing how much time a little shortcut like this can save. Almost every time I use Archicad, I rotate things 90 degrees or more. Instead of Command-E, click to place the protractor, click to define the starting angle, and click to define the rotation angle, it could just be a single keystroke, or two for 180 degrees.

 

When I first learned about the Python connection, this is the first thing I thought might be possible to implement.

 

My son is good with Python and I thought i might ask him to see if he could do it, because it doesn't sound complicated.

 

Then reading through the posts on the subject here, it seems like it might be a lot more complicated than I thought.

 

The Python palette runs the scripts, which is fine, but it doesn't appear that they can be triggered with keystrokes, which pretty much rules out what I wanted.

 

There is quite a lot of documentation with sample scripts, and there are quite a few videos. It seems good for interrogating the model and running reports, but what else?

 

The question I didn't find an answer to, is exactly what can you use Python for? 

 

I read the Getting Started documentation, but this wasn't at all helpful, and that's being really tactful! There was no summary overview which I would have thought was an obvious thing to have.

 

What I would also have liked to have seen was some kind of centralised facility for people to share their Python scripts. That would be great! Nope - couldn't find that either. There are just 9 demo scripts on the Graphisoft site, not exactly overwhelming.

 

So just for the Edwin Starr fans, Python in Archicad, huh - what is it good for? 

 

 

Archicad 27 UKI | OS X 12.7.1 Monterey
9 REPLIES 9
BenjiDev
Enthusiast

I am not even sure you can register key strokes to run some functionality in  a C++ Addon in a simple way...  But I probably missed something in the docs.

 

EDIT: Nevermind, it is actually quite simple at least from a C++ addon. 

I even made a small addon that i think does what you want. You can rotate an element clockwise or anti-clockwise 90 degrees with custom key strokes. Not really answering your question sorry but I can share it with you if you are interseted. 

 

Just wanted to thank you for the rotation add-on - I wrote something like this for myself when I was still in AutoCAD and it saved me thousands of clicks.

 

From what I can see, the JSON / Python api is mainly capable of reading various properties from the model, setting properties, and automating the creation of layouts, views, etc. Not much help to manipulate the model itself or add construction elements. You CAN, however, call functions from an Add-In. I did find this add-in which adds several commands to the JSON/Python api, one being to move an element:

https://github.com/tlorantfy/archicad-additional-json-commands

 

It is the year 2023 AD - Archicad should be much easier to script. You only need to look at the Sketchup / Blender / Rhino / Grasshopper ecosystem to see how much creativity and work a community can contribute to any software project. I don't understand how the Archicad devs themselves have tolerated developing library objects for so many years with such a horrible GDL environment. If GS can't avail itself of the community's help, then the company is going to fall behind pretty quickly.

 

BenjiDev
Enthusiast

Glad that you like the add-on, hope it helps you out. 

I'd like to add another thing to graphisofts backlog: a centralized app-store for add-ons. 

Now you have to set up your own website which takes some time and effort (like i did for example). The total time saved will be big if each developer does not have to set up their own personal "app-store". 

Oh definitely - yes please! Sorry for the late response, must have missed the original notification.

 

[Edit: found it in your sig, but it looks like it's Windows only...]

Archicad 27 UKI | OS X 12.7.1 Monterey
BenjiDev
Enthusiast

Yeah only available to windows as I don't have access to a macbook (as far as I know you need one to develop for it). Probably will get one in the foreseeable future.

Mac Mini - really cheap now on eBay if you go for an M1, and older ones are selling for silly prices.

Archicad 27 UKI | OS X 12.7.1 Monterey

I agree with all of the above...I have learnt the GDL since 6.5 but that was a luxury afforded me...which Im thankful for.

 

Python is ideal and I use it for so much stuff...most notably doing OEM Ableton Live control surfaces...that what I love, doing stuff from muscle memory so you are really playing an instrument and creativity comes to the forefront.

 

I had so many hopes...firstly, I use model view options as a way of having verbose labels built into objects, labels etc...small but you select the model view and label and jumps you to a zoom where you can audit clearly, all relevant info

 

So I simply wanted to be able to have a momentary keyboard shortcut that, as you hold, turns on 'Draft' and on release, goes back to 'Print'...not available

I cant even get the address table for the commands for xml to shortcuts...

 

Thats something that sets programs apart..their creative freedom through pyschology

 

🙂

Mark Wesse
AC26 | Win10 | Since v6.5r
Architerion - Architectural Systems Developer
Aurasphere - Acoustics
Building Biology - Human Compatible Architecture
"--- Every time...do it better ---"

What is Python good For? -- Well, at this point, not very much!! It is mostly a means to read/write custom properties and read a small subset of builtIns. Access to attributes was added of late. Other than that you can't do much and the very unfortunate thing is that Graphisoft doesn't seem interested in expanding its capabilities. In fact, we are going backwards in capability. We used to be able to interface with the C++ API and Add labels and such. Now, I understand that the Python application locks out any commands to add to set/create things like labels while the Python script is running. i used to be able to do this through the Python interface, but was told recently -- no longer. I have complained about this three weeks ago in their paid tech support but have not even received the curtesy of  even a reply. So much for customer relations. i would not expect anything from Graphisoft other than more advertising hype.

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

Well...I was hoping for good things. They have started many good things...odbc, vb etc but all went nowhere

3d max certainly got a foot up by what was mentioned in previous posts...enough power to do most of what is needed...same with r&&&&t.

I love archicad...but this shooting itself in the foot is not good...not good at all. Feels like someone bought the business and is just wringing out the coins till it dies. Ie competition buyout...well it smells like it anyway.

 

Just my UI rave has only complaints from those (mostly) that are just tinkering else we would all be on board.

At least open up the shortcuts so I can do it myself

 

I work for larger builders with a need to eg update a couple hundred plans with new compliance...I hope it can do at least that. 

Mark Wesse
AC26 | Win10 | Since v6.5r
Architerion - Architectural Systems Developer
Aurasphere - Acoustics
Building Biology - Human Compatible Architecture
"--- Every time...do it better ---"