The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

Discussions about using GRAPHISOFT's tools (API DevKit) for independent software developers

Moderators: Karl Ottenstein, LaszloNagy, ejrolon, Barry Kelly, gkmethy, MOREH Tamas, Akos Somorjai, Ed Brown, Mihály Palenik, Tibor Lorántfy

#286543
Hi,

Python Add-On development is still in experimental phase, we are investigating the possible solutions.
One of those is to create a Python wrapper for the existing C++ API. We have an early implementation of that, but that may not be the final solution. We'll make our choice depending on the real user requirements. So I cannot answer your question yet, but we are open to use cases, feel free to share your thoughts.
#286567
My Comments:

A Python Wrapper would certainly be the quickest and most direct approach but there are other issues to consider if this immense effort is to be useful.
My concern is the present diversion of data access in Archicad. IFC, Properties, Expressions, GDL, & API data structures all have a slice and none have total access to all data. This severely limits practical user applications and creates confusion.
Also, some consideration should be made for small, quick macros, which don't require much planning or expertise necessary to accomplish those quick data display issues.

Finally, I hope Archicad does not 'reinvent the wheel' as they just did with expressions, by introducing another language format. Hopefully, Graphisoft will take a look at their sister corp, which has managed to simplify (somewhat) the marriage of both the configuration and display of data through their python/worksheet system. Not saying that even that can't be improved on. This is certainly not something that should be rushed into and should certainly first be reviewed by a skilled, diverse user base.
#286713
My concern is the present diversion of data access in Archicad. IFC, Properties, Expressions, GDL, & API data structures all have a slice and none have total access to all data.
The API has access to all of the above. Therefore, a Python wrapper potentially could too. But as Tibor says, it depends on what would provide the most benefit. Posting potential use-cases for Python scripts would be informative.
#286724
By way of example:
Frequently a quick means of performing area analysis is required. Typically done external to Archicad using Excel, etc. By area analysis, I mean -- FARs, setbacks, permeable, impermeable, overhangs, undisturbed areas and the percent & overall of each- All in a tabulated SS. -- You get the idea. In some software, this is only a half dozen lines of code in either Python or Ruby. i.e. a macro. Generally, this requires summing selected zones and subtracting others. Certainly this can be done now with the Archicad API -- But a PETA & difficult when you need to change the formulas.

The key is a means of doing a 'quick' search, sort, selection & enumeration based on some criteria.
Also, important is the use of regular expressions to simplify discovery - RegEX. Python has this feature as a add-on -- Hopefully, it will be included?
#287407
By way of example:
Frequently a quick means of performing area analysis is required. Typically done external to Archicad using Excel, etc. By area analysis, I mean -- FARs, setbacks, permeable, impermeable, overhangs, undisturbed areas and the percent & overall of each- All in a tabulated SS. -- You get the idea. In some software, this is only a half dozen lines of code in either Python or Ruby. i.e. a macro. Generally, this requires summing selected zones and subtracting others. Certainly this can be done now with the Archicad API -- But a PETA & difficult when you need to change the formulas.

The key is a means of doing a 'quick' search, sort, selection & enumeration based on some criteria.
Also, important is the use of regular expressions to simplify discovery - RegEX. Python has this feature as a add-on -- Hopefully, it will be included?
Hi,

First, regex -- most external libraries can be used in the Python code.

Could you please post a sample Python script that achieves what you need in another software? I'm curious how much of that is available in our Python interface at the moment.

Best, Akos
#287409
Ahhhh –

I was not exactly clear in my “proposed example” What I was suggesting was a python function to return a array, dictionary or tuple to objects meeting a criteria. We can argue about the criteria but basically the standard such as ID, properties/parameters/attributes, layers etc..As of now in VW, a single parameter is returned to a single object or a sum of objects. In Chief Architect, parameters must be collected in labels and stored in Global memory before use. None of this is a major problem but is less intuitive. Easier to first obtain a array of GUID's then interrogate each or the array of GUID via a single function and/or a enumeration and then obtain back the parameters/properties/expression results of interest.

After data is collected, basically areas but sometimes conditionals/status, the calculations and display is routine and depends on the programs capabilities. Without a means of data display in layout, all of the above is fruitless. I particularly like VW's User Spreadsheets but even there could be more versatile.
#287485
I have to share same concerns as Gerry about this topic as well. Let me give a quick example of problem I had past week. I created a simple parameter for a wall which would read "override surface" information and based on that assign some predefined value. This is quite a simple programing task, as it would require one FOR loop and possible one IF statement nested inside the FOR loop. However, we currently do not have this capacity inside expressions, I only managed to use IF expressions, which seams to be mandatory of both TRUE and FALSE condition. So the sollution was to go into grasshopper, read custom expressions (which you have to do trough string) and than create a custom xml file which could be loaded inside archicad expressions. The given xml file contains a series of nested IF statements, which is quite hard to follow as such. I do believe python wrapper could access all of those informations from AC and make this task quite easy.

I am sorry if I missed some potential options which could solve this issue in a different manner.
Regards,
P