Archicad C++ API
About Archicad add-on development using the C++ API.

[Wish] Scripting in AC

Karl Ottenstein
Moderator
stefan wrote:
--> side thought: I have a very small example running into our internal CAD-tool (still very much pre-alpha) but believe that this is achievable in Archicad as well, as long as I learn how to step through the 3D-geometry and the materials.
--> I don't even know if it'll work through a Rendering-plugin or more as a direct export-plugin.
--> This is actually the kind of things that other applications can perform using scripting.
How do others feel about the advantages of being able to script AC rather than have only the heavy-iron API solution?

For some time, I've thought of writing an add-on that provided scripting facilities for all AC users. As you know, the power of such an add-on would be limited to the functionality exposed by the current API. (Let's make API functionality extension a separate group of wish-topics.)

An alternative (or addition) that I have wished for is a fully exposed server interface to AC so that AC could be scripted from external tools such as Visual Basic, which are more friendly to more users.

A few of the advantages I see to a scripting solution include:

- makes customization more accessible to a wide range of users, not just C++ programmers

- lets the same source-level script be shared on both Mac and Windows platforms, no need to have both a Mac and PC, Codwarrier and Visual Studio ($$ and knowledge) to compile two versions of an add-on

- is safer for the end-user. An add-on can do anything, including erasing the user's disk - by mistake or intentionally. Scripting can be easily controled - limiting the types of operations that can be performed, and user-enabled warning dialogs could be displayed before changes or deletions to the model are made.

Other thoughts?

Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
17 REPLIES 17
Oleg
Expert
Karl wrote:
How do others feel about the advantages of being able to script AC rather than have only the heavy-iron API solution?

Other thoughts?
It is good idea certainly, but I think completely it can by implemented by Graphisoft only.

However, I did worked experiments with JavaScript embedding. And I assume to use it for specialized task ( basically not for end user scripting ).
Karl Ottenstein
Moderator
Oleg wrote:
It is good idea certainly, but I think completely it can by implemented by Graphisoft only.

However, I did worked experiments with JavaScript embedding. And I assume to use it for specialized task ( basically not for end user scripting ).
Indeed, Javascript is what I thought should be the scripting language, as something common to both platforms. (But, part of me would like to see VBA licensed from Microsoft for the Windows platform since Visual Basic is known by so many people and is so easy to work with. It would defeat the idea of having scripts sharable between platforms though, unless RealBasic is source-compatible on the Mac.)

I agree that GS should be the one delivering a scripting solution - particularly if it is an automation one. But, don't you think, Oleg, that if the API exposed all AC functionality, then a 3rd party could produce the scripter? (The limited functionality of the current API should be a separate thread...) Or, do you see deeper issues that I'm not seeing?

Thanks,
Karl

PS I'm glad you changed your avatar to a photo: good to finally 'see' you after all these years!
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Geoff Briggs
Mentor
Yes. I worked with VectorScript prior to my move to ArchiCAD and miss the ability to easily control the entire application. Make sure to include PlotMaker while we’re at it.
Regards,
Geoff Briggs
I & I Design, Seattle, USA
AC7-27, M1 Mac, OS 14.x
Aussie John
Newcomer
Being a scriptable application for Applescript would be a good start.
Cheers John
John Hyland : ARINA : www.arina.biz
User ver 4 to 12 - Jumped to v22 - so many options and settings!!!
OSX 10.15.6 [Catalina] : Archicad 22 : 15" MacBook Pro 2019
[/size]
Oleg
Expert
Karl wrote:
But, part of me would like to see VBA licensed from Microsoft for the Windows platform since Visual Basic is known by so many people and is so easy to work with.
If to speak about Win specific solutions, it is possible to use VBScript, JScript (not VBA) without any licensing. I tried it too.
Besides I am interested by MS .NET technology. But it will work only on Windows.
Karl wrote:
But, don't you think, Oleg, that if the API exposed all AC functionality, then a 3rd party could produce the scripter? (The limited functionality of the current API should be a separate thread...) Or, do you see deeper issues that I'm not seeing?
My English so poor to discuss it in more detail. I think, theoretically and technically to make full API exposed for scripting is feasible, but practically hardly.
I dont see deeper, just IMHO.
My opinion, that the first huge difficulty is how to expose API functionality. To design the coordinated and convenient interfaces and functions exposed in a scripting language is a very complicated task. I do not think, that, to show API function directly is a good approach. The current API design in my opinion is not so good and does not approach for directly exposing it in a dynamic typed, garbage collected scripting language.

The second difficulty is complexity of implementation. It is required thousand and tens thousand functions (actually most fields of the big API structures should be accessible through function / property). Huge time and expenses. I think it can not be made by small group of enthusiasts.

However, customization of some complex AddOns or to expose the limited interface/functions set for the specialized tasks seems a good approach.
Karl Ottenstein
Moderator
Oleg wrote:
Karl wrote:
But, part of me would like to see VBA licensed from Microsoft for the Windows platform since Visual Basic is known by so many people and is so easy to work with.
If to speak about Win specific solutions, it is possible to use VBScript, JScript (not VBA) without any licensing. I tried it too.
Yes, there is a license fee for adding VBA to a program:
http://msdn.microsoft.com/vba/partner/benefits.asp
but a few years ago, MS was so eager to have people do this, that I don't think they wanted that much money.

The cool thing, as you know, about VBA is the visual dialog editor and easy programming of all interaction, plus autofill coding (intellisense), debugging tools, etc. GS would have to provide ActiveX controls that correspond to pens, fills, linetypes, etc resources, but just think about how easy it could be to build something useful with an attractive interface. Plus, it is familiar to anyone using any MS Office application, AutoCAD, Corel, etc. (MS claims VBA ships with over 100 3rd party applications). Even if it cost GS $50 per user for the license, it would be worthwhile IMHO if only there was a way of providing equivalent support for Mac users. (Of course, the huge expense for GS would be providing the necessary object model for VBA to access AC features.)

Are there visual dialog creation tools available for VBScript, JScript or standard javascript?

Thanks for your other comments explaining your reservations. Your English is fine!

Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
How about VBA for Windows and Xcode for Mac? It sure would beat having to shell out for Code Warrior.
Karl Ottenstein
Moderator
Matthew wrote:
How about VBA for Windows and Xcode for Mac? It sure would beat having to shell out for Code Warrior.
Just browsed over to
http://developer.apple.com/tools/macosxtools.html
to read about Xcode since I'm reasonably Mac-ignorant.

It appears that Xcode is an alternative to CodeWarrior for C++ application development.... looks powerful and free! But, it is a development environment for skilled programmers, not a scripting environment. Has anyone in this forum tried Xcode? Or are there features in the API SDK that tie it to CodeWarrior?

VBA is a RAD (Rapid Application Development) tool... and is designed for the more average person to quickly build a solution. I don't know what would offer a similar power with a visual dialog editor on the Mac, being Mac-ignorant.

Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
I realize that VBA and Xcode are very different beasts. I was just thinking out loud about some things that would be nice for extending the reach of ArchiCAD.

The free alternative to VBA on the Mac is Applescript but AFAIK it is not a true RAD as it is primarily for system automation and application interaction (there is no corollary that I know of in Windows). Applescript support in AC & PM would be tremendous for Mac users but might make Windows people a bit jealous.

Revolution is a RAD tool which I believe is cross platform but I don't know too much about it.

One of my favorite RAD tools (which is also cross platform) is 4D (4th Dimension) which isn't really a RAD tool but a database that can build standalone apps. I actually built a wood framing add-on demo for AC with it about 12 years ago.

What is the coolest stuff on the Windows side these days? The last Windows only programming I did was for speedikon with Microstation, a text editor and a DOS based compiler (for a UNIX core app. - go figure).