Macro programming on CC3 - where to start?
I have to admit that I'm quite a lazy guy. I also am a programmer. I thought of e.g. learning how to offload things like city quartier grebling to some piece of software.
So, where would I start looking for documentation on doing this? I've searched the forum, but only found two articles on macros for FT.
So, where would I start looking for documentation on doing this? I've searched the forum, but only found two articles on macros for FT.
Comments
There are also several blog articles that discusses macros, although most of them more with macros as part of something larger rather than trying to learn macros themselves, but they are useful for the sake of example, such as this one
and Joachim has this very nice thread with some good tutorials.
I have written better macro interpreters as a kid, way over thirty years ago. And no, I'm not going to rewrite the engine, compilers and interpreters is something I have long left behind...
It seriously makes no sense to implement what I was planning in that. I might be considered crazy, but I'm not mad.
When I recover from that, I might write my ideas in something else, and just let it produce a list of autogenerated macros that do the "paint job" in CC3+.
I like to think that the FastCAD macro language has more in common with various OS shell languages from the dim past than it does with what most of us are familiar with as a "modern scripting language". It always felt more fair to me to call it "what you can do at the program's command line" rather than a deliberate "language" because that's literally what it is. The biggest insight for me was that every command is executed in near isolation from the others and communicates with them only via global variables. Jumps are commands that scan through the source file for the destination. The language is focused around user I/O and so things like walking the existing geometry list is more complicated than you might expect.
I was seriously disappointed when I saw this. I didn't expect any seriously modern programming environment, but this...
Tip of the hat to those people who get their hands bloody on dealing with that, but what I wanted to do is simply impossible this way (at least without implementing some Turing machine in script...).
What I would suggest to the FastCAD/CC3+ people is to add an API to the system, so scripting can be done with a choice of external languages and methods instead of having to maintain an internal scripting engine.
1) Write a macro. You can do most things that you can do inside CC3+, and it do have basic conditionals and loops, although not very sofisticated, and it has very few options for working with and manipulating actual data.
2) Use an external program that writes a CC3+ script for you (a script is basically the same thing as a macro but stored in a separate file, and can be called by the SCRIPT command in CC3+). This allows for the use of a richer programming language to process things, and it is simple to use in CC3+. The main vulnerability here is that the resulting script needs to be 100% correct, otherwise CC3+ will probably be throwing tons of error messages
3) Use Intercom. Intercom allows you to talk to CC3+ directly from an external program. This basically work by having the external program sending macro commands to CC3+ one command at a time.
4) Write your own XP. This gives you much greater access to CC3+'s internals, and since you program in C++, you have a proper programming language at your fingertips. The basis for this is still old, no denying that, but you are not limited to just what CC3+ gives you.
I have no idea, though, if and how I get this to work on Linux. Time and experimentation will tell.
The laziest and most likely to be successful way to do CC3+ XP development regardless of OS is to install a virtual machine image with the base version of Windows 10, install the Visual Studio 2017 community edition on the VM, install CC3+ on the VM, and install the CC3+ SDK on the VM. Everything is fully contained and your base machine doesn't have issues with any of the installs. Having CC3+ in the VM (install it to something other than Program Files to allow changing the DLLs without too much pain) lets you do quick turnarounds and performance isn't usually too bad for most maps because CC3+ is a pure software renderer.