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

Programing language and Archicad

agroni
Booster
I will post this general question here as I was wondering for the future, what would you prefer to learn as a programing languange and implement it in the Archicad environment?

There are currently many languages such as python, c#, c++,... but to what extent one can apply these to the closed environment of Archicad. It all depends also what the user wants to implement with those scripts. Is it just attribute definitions or geometrical definitions. So in the end is it worth it learning a python language or implementing grasshopper workflows is enough.

I have seen tutorials both in grasshoper and python, where IDs of spaces are automatically defined. Different approaches with different levels of difficulty to achieve the same reault.

What is your opinion about this? Anyone can help me to clear this subject?
The BIMster @ AllesWirdGut
Currently: Archicad 26
User since Archicad 6.5 (2001)
8 REPLIES 8
Nader Belal
Mentor
@Agroni,

Here is my 2cents, Python

Python is very easy to learn and to implement, and is already (or mostly) available in multiple programs other than ArchiCAD, so as a skill it's transversal to many others programs, and different algorithms can be imported/rewritten to suit ArchiCAD.

And since you have mentioned Grasshopper, I would like to give you a glimps:
There are two main implementations of Python, the standard one is called Python or CPython, which is written in C, and the one that is treated as the reference for all others.

Then you have IronPython, developed by Microsoft on .Net technologies, it's very similar to CPython, but of few key differences. Microsoft have made a new Python with another name that I can't remember.

Python provides many ready to use libraries for the different use cases, but what suits CPython does not necessarily suit that of IronPython.

Grasshopper is made on top of .NET technologies, that is why you see their are VB.net, C#, and Python components iin it.

and being a generalist,
go with Python, and for reasons other than that I have mentioned before, and script development in Python, is easier and quicker to implement than that of the other languages that you have mentioned.
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.
Ralph Wessel
Mentor
agroni wrote:
I will post this general question here as I was wondering for the future, what would you prefer to learn as a programing languange and implement it in the Archicad environment?
It depends. Programming languages are designed for different purposes, and even their implementation may have specific purposes in mind. Python is considered 'easy' because you can get almost instant results for minor problems, but it doesn't make hard problems easy – it only moves the core of the problem somewhere else, which can ultimately make it much harder to solve. I wrote a GDL object some years back – Modular Joinery – that would have been vastly easier in C++ than GDL. The simplicity of GDL means that it is only appropriate for simple problems, and in fact that is precisely what GS has designed it for. Roughly 80% of our bugs come from GDL for the same reason. It's acceptance of almost anything is a double-edged sword. I've seen very large firms dig themselves into terrible IT problems by the application of inappropriate solutions, e.g. trying to use GDL as a tool or a spreadsheet as a database. The same is true for most 'simple' scripting languages. So consider – what kind of problem do you intend to solve? GDL for 2D/3D illustration, python for external batch processing, C++ for tight integration or larger-scale applications/add-ons. If you want the best toolkit, learn and use all of them to their best advantage.

Also, programming is a specific skill which requires the same effort and learning that any professional role demands. Your question could be reframed as, "I would like to integrate structural engineering into my architectural practice and would like to know which software I should learn". The first problem isn't the software – it's having a an appropriate understanding of structural engineering. If you don't, the software is more likely to harm your business than help it. Anyone with a shallow understanding of structure can solve simple structural problems, but if you want to solve anything non-trivial, seek out an expert. Attempting to solve it yourself without a serious investment of time and money to learn can only end badly. This is also true for programming. There is a reason that students spend years learning algorithms and computer science principles at uni, just as you might choose to learn architecture or engineering. I regularly see companies waste huge amounts of time and money producing awful IT solutions when they could have bought a far superior product off the shelf for less.

In summary, make sure you understand what kind of problem you intend to solve before you invest too much. Different programming languages exist for a reason, i.e. with a specific type of problem domain in mind, and they are not necessarily interchangeable. Ideally you should learn several. And make sure you really want to invest your time and money in adding programming to your professional skill set - this should not be taken lightly.
Ralph Wessel BArch
agroni
Booster
Thanx guys for your detailed answers
To be honest I am a tabula rasa in programing, but seeking new horizons to improve quality and efficiency in our office.
I can observe some repeating routines that my friends are practicing in our office that I believe could be more automated and save tons of working ours and reduce mistakes. We already have many things in Archicad implemented but we have reached the limit of the programe itself, hence it is time to expand the implementation field.
I am talking about defining alphanumerical values for spaces or even components. One good example (which I belive was made in Python) is from the office Aidea about automatically generating layouts and placing drawings on them.

Doing such things in grasshoper a team might need a supet user that masters GS and can implement such efficient workflows. On the other hand, a written add-on in all your above mentioned languages could allow any user implement these scripts, due to its simplicity of the UI.

I have also found some pythin examples on github, but don't know exactly what they do...
The BIMster @ AllesWirdGut
Currently: Archicad 26
User since Archicad 6.5 (2001)
jl_lt
Ace
agroni wrote:
Thanx guys for your detailed answers
To be honest I am a tabula rasa in programing, but seeking new horizons to improve quality and efficiency in our office.
I can observe some repeating routines that my friends are practicing in our office that I believe could be more automated and save tons of working ours and reduce mistakes. We already have many things in Archicad implemented but we have reached the limit of the programe itself, hence it is time to expand the implementation field.
I am talking about defining alphanumerical values for spaces or even components. One good example (which I belive was made in Python) is from the office Aidea about automatically generating layouts and placing drawings on them.

Hi Mr. Agroni, could You expand on the limits of the software (archicad) that You have reached? What it is that you want to do that it can't do? (Other than truly automatic dimensions, of course, which should be a thing by now)

Also, for anyone with this kind of experience here, at what project size would it be recomended to try to implement this kind of automation?

This brings again a question we have been discussing before: Why should i, as an architect, learn to code in C or python? (i know Mr. Moonlight, as a very advancer user, is a big advocate of this). I mean, im totally into having better processes and stuff, but why can't i just pay for this add ons if i ever need them instead of putting years in learning to code? At what point is it better to do it in house?  

We have survived so far without it, why now? what is the conceptual justification for this (other than the typical  "everyone, eventhough i dont know who, is doing it and the ones that dont hop into the train or will be left behind")?. Some of the offices that advocate for this "automation" churn out generic boxes that they want to sell as architecture. Im not sure if we should go down that path that easily.

agroni
Booster
jl_lt wrote:

Why should i, as an architect, learn to code in C or python? (i know Mr. Moonlight, as a very advancer user, is a big advocate of this). I mean, im totally into having better processes and stuff, but why can't i just pay for this add ons if i ever need them instead of putting years in learning to code?

We have survived so far without it, why now? what is the conceptual justification for this (other than everyone is doing it and the ones that dont hop into the train will be left behind)?. Some of the offices that advocate for this "automation" churn out generic boxes that they want to pass as architecture. Im not sure if we should go down that path.
This is a general question today of how the profession of an architect is shaping. Thirty years ago we drew on paper, today we have digitized those lines... So is programing zhe next step in this profession? It's to early to tell... Maybe... Who knows...
Or maybe architects need to hire programmers to develop those promising scripts. This way the architect has no need to learn programing.

Why is this all happening? Graphisoft will not be looking into these small wishes and will look more into the market was is trendy and what is going to make a big boom. So developing these smaller tasks is starting to land on the user side. Also Graphisoft is not obliged to develop specific office workflows.

What these workflows are? It all depends how you deliver specific requirements, at what stage and eapecially how you model.
The BIMster @ AllesWirdGut
Currently: Archicad 26
User since Archicad 6.5 (2001)
Ady84a
Booster
In my opinion, if you are going to start learning programming then definitely you should start with Python. This will help you to understand concepts of programming. You won't spend much time learning syntax, you will be learning how to solve the actual problem.

Why should an Architect learn a programming language?
To automat boring stuff, to ensure quality standards are met and to make things faster.

Which programming language to choose for Archicad?
- GDL is very useful when you need 2D and 3D parametric objects. I personally don't think that it was made for exchanging information with databases.
- Python is powerful, but in Archicad it is very limited to custom and built-in properties, in addition to some documentation stuff.
If GRAPHISOFT would provide python with the same functionality of the C++ API, then Python would be the way to go. But at the moment there is no road map to know how GS is developing the Python connection with AC.

- If you are an experienced programmer, then C++ would be the best choice right now, because the API ist very powerful. But this is not for Architects, this is for programmers. You can build your own addons and tools.
jl_lt
Ace
Thanks for your responses Mr. Agroni and Mr. Ady84a. Maybe im still in my infatuation phase with Archicad, so just being able to extract so many info from the model and coordinate all views and sections and info semi automatically seems already amazing to me. Also i have ZERO experience in programming, so please take that into account if i begin to sound too redundant with my questions.

Having said that, i would ask and add the following:

-to what boring stuff you might refer? Dimensioning, automatically placing and editing layouts, labeling, editing zone numbers? I think what this office Aidea promotes in their website are things that Archicad should be doing by now without the need of external scripts, but i would certainly pay if they or anyone ever put theirs scripting on the market, specially for automatic dimesioning .

-What other problems and applications can be achieved through scripting? could you guys offer some examples?

-GDL is always mentioned as the tool to go for doing parametric objects. My guess is everything we model in Archicad is a graphical representation of GDL code. Personally we dont care too much about parametric objects (like, not at all, at least now). What would really interest me is the parametric manipulation of the nodes of all the builing elements and the conection with each other (that is, a parametric building instead of a parametric object). Would i need programming for that or would it be wiser to explore the Grasshopper connection?

-Same for iterative design. Since my school days i have always wanted to be able to draw and model something and then generate iterations of this model by changing some parameters. Of course, we have always done this, either by hand or in computer 3d models, but never in an automatic, parameter controlled ways. The late architect, Enric Miralles, once described his process like this: he drew something and then made hundreds of variations of the same thing, by hand, before passing his idea to someone else to put it in the computer.
Nader Belal
Mentor
Here are my two cents:

Why should an Architect learn a programming language?
1. Just as Ady84a said
"To automate boring stuff, to ensure quality standards are met and to make things faster."

2. To create custom made tools.
Not all companies can respond as well to all clients' requirements and use cases, especially when local regulations do require to implement a custom made procedure that isn't internationally recognised, for instance, in Spain, although EcoDesigner is a valuable tool, justification for these calculations must be done differently.

3. Avoid programs short comings.
Eaxmple:
ArchiCAD is a well designed BIM program, but sometimes I needed to extract data from GIS files, the difficulties that I faced were
3.01. I didn't know how to use a GIS program.
3.02. I didn't see the use to learn a GIS program especially when I knew I will use it sporadically (less than 5 minutes use per year), and knowing that this data should have and can be available in normal CAD files (or any other file).
So I was able to create an algorithm that would extract the data from a type of GIS data file, and export it to ArchiCAD.
https://twitter.com/nbBIM/status/908861182966161408/photo/1

Which programming language to choose for Archicad?
Just as I said before, go with Python, it's used across the broad of AEC programs (+ few others), and although ArchiCAD's pythons API is still under development, Graphisoft is somewhat showing signs that it's interested in it ... beside, it's the easiest to learn.

C++, I wouldn't advise you to start learning it, for one simple reason, IT professionals describe it as hard to learn, and you apparently are a novice.
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.