Autodesk Fabrication Scripting – Did You Know?
In the list of COD Scripting updates I just posted, there’s a couple undocumented functions that have been on my list to explore for more than a few years. I’ve finally gotten to them and figured out what they do.
I won’t comment on how long it took me to actually explore what I had listed in my “To Research” list for years other than to say, Procrastination is a Virtue for those with no Patience.
So without further delay…here you go….
This first one is the OUTPUT function. You can call it a couple different ways, with and without parenthesis just like the DEBUG function. It doesn’t really seem to matter. It’s really kind of a worthless function in my opinion.
Not only does it only work in CAMduct and ESTmep (not CADmep) it really isn’t that helpful. It just outputs a message to the Console window. I was initially hopeful it would allow me to “script” some of the secret Console command but no such luck. It’s just a message.
You can see in the COD Code editor the below with both syntax examples…
When you run the script, it’ll call up the Console and display the text you specified. You can see from the following example, it doesn’t even space the text when you call it multiple times. Even tried embedding a Carriage Return in the string and still no luck automating via the Console.
The other command is much more helpful and something most folks don’t know about. I have run into a couple now who knew but most it’s not known. I wish I knew years ago…it’s actually a small step closer to what you’d expect in a modern IDE (Integrated Development Environment).
The Breakpoint function calls up the panel on the right. It displays the values of all your variables. You can see how the value of the “z” variable is displayed. When you hit a Breakpoint, code execution stops until you hit the green arc’d arrow. Code execution then continues until you get to the next Breakpoint if any.
You can access the COD Script editor in CAMduct or ESTmep using the FILE pulldown menu. You can also use the editor in CADmep but unfortunately, there’s no way to display it without writing intentionally wrong code to cause your program to fail and display it. You can then use the editor like you do in ESTmep or CAMduct.
One thing to note, BREAKPOINT only appears to work when you execute code from the Script Editor. If you call it from AutoLISP using (executescript “myscript.cod”) or the EXECUTESCRIPT command in CADmep or by right clicking in your Takeoff items in ESTmep or CAMduct, it runs without stopping your code. This means you can leave the breakpoints in your code and edit/debug via the script editor but not have to remove them when executing them un a production setting.