• Did you super modellers know that AC3D can be scripted? I'm quite fond of coding but find modelling a bit tedious - I'd rather spent 10x longer writing a program to do a job than it would take to do it manually (in the feint hope I might need to redo it slightly differently one day), so I was very excited to discover https://www.tcl.tk/

    You can easily add menu commands to AC3D that will do multiple scripted actions in one go. Here's a simple one for adding a "select all" command to the Tools menu

    Code
    .mbar.tools.menu add command -label "Select All" -command "ac3d select_all" -underline 0


    To make this work I first downloaded and installed TCL from https://www.activestate.com/activetcl/downloads then I put the above code in a file called test.tcl inside the script folder in the AC3D program folder

    Example scripts and help are found here: http://www.inivis.com/forum/forumdisplay.php?f=40

    However there aren't many, so you're likely to need to write your own if you're interested.

    I finally managed to get a list of all the commands AC3D has available - file attached

    Rodeo knows the secret project I'm working on that will make this scripting very useful... ;)

  • Spit40 ,

    I eventually reach the point in my insanity to try to create a couple of scripts to speed up some of the work I do around creating airports. Can I ask you a couple of dumb questions? I've installed the tcl shell and can do the hello world example, so at least it did not just explode, which is unusual when I first try something.

    However, to get the 'ac3d list', I see on the forum that there is references to doing it directly in the tclsh or telnet? How do I "connect" to ac3d to execute 'ac3d' commands interactivly? I assume with your airfield generator you would have to do something like that? Any help would be much appreciated!

    --coffeecup

  • Spit40 ,

    I eventually reach the point in my insanity to try to create a couple of scripts to speed up some of the work I do around creating airports. Can I ask you a couple of dumb questions? I've installed the tcl shell and can do the hello world example, so at least it did not just explode, which is unusual when I first try something.

    However, to get the 'ac3d list', I see on the forum that there is references to doing it directly in the tclsh or telnet? How do I "connect" to ac3d to execute 'ac3d' commands interactivly? I assume with your airfield generator you would have to do something like that? Any help would be much appreciated!

    --coffeecup

    Hi. I've learned a lot abot tcl since i started this thread. Send me a pm please as a reminder as i'm not at my pc and may forget by the time i'm there.

  • Did you super modellers know that AC3D can be scripted?

    That's pretty good news indeed. It must be possible to at least make a scalable simple runway with a piece of mesh around.

    You enter coordinates for the centerpoint, width and length in m, an angle for the true heading, a choice between a few base textures and there you go.

    The most difficult part might be to adapt and rescale the decals too.

    Adding more specific features like taxiways and aprons is more tedious to script, but a simple runway and a "flattening" mesh integration could be a good starting point for many users...

    Cheers

    Antoine

    Config : i7 6900K - 20MB currently set at 3.20GHz, Cooling Noctua NH-U14S, Motherboard ASUS Rampage V Extreme U3.1, RAM HyperX Savage Black Edition 16GB DDR4 3000 MHz, Graphic Card Gigabyte GeForce GTX 1080 8GB, Power supply Corsair RM Series 850W, Windows 10 64 bit.

  • It turns out its very hard to "Create" a runway using script, there is no TCL to draw boxes/meshes only create vertices. In the end I had to decompile the structure of .ac files (edit a .AC in notepad and its at least readable), build them in a separate program and then load them into AC3D for TGI export. Same for decals. You can rotate no problem.

  • Spit40 ,

    I eventually reach the point in my insanity to try to create a couple of scripts to speed up some of the work I do around creating airports. Can I ask you a couple of dumb questions? I've installed the tcl shell and can do the hello world example, so at least it did not just explode, which is unusual when I first try something.

    However, to get the 'ac3d list', I see on the forum that there is references to doing it directly in the tclsh or telnet? How do I "connect" to ac3d to execute 'ac3d' commands interactivly? I assume with your airfield generator you would have to do something like that? Any help would be much appreciated!

    --coffeecup

    Did you try the "Select All" example I posted at the start? See how prefixing the AC3D command with "AC3D" is all you need. The instruction goes inside quotes, but that's rather a limited script, so in the quotes put something like "myProc" then define a TCL procedure in your TCL file like this:

    proc myProc {} {

    ac3d select_all

    }

    Here's a script to rename an object to something else

    proc doRename {} {

    ac3d set_select_mode 1 ;# 0=group, 1=object

    ac3d select_by_name "my_obj_name"

    ac3d set_current_object_name "different_obj_name"

    }

    Now put this in your TCL file

    .mbar.tools.menu add command -label "Rename an Object" -command "doRename" -underline 0

  • IIn the end I had to decompile the structure of .ac files (edit a .AC in notepad and its at least readable), build them in a separate program and then load them into AC3D for TGI export. Same for decals. You can rotate no problem.

    Sounds good too I would say. Probably better to code some external tool to do the thing, why not working with KML/KMZ. As the case may be, no need afterwards to go through AC3D or whatever if we can directly output a TGI file... well, just thinking loud, sorry...

    Cheers, keep up the good work

    Antoine

    Config : i7 6900K - 20MB currently set at 3.20GHz, Cooling Noctua NH-U14S, Motherboard ASUS Rampage V Extreme U3.1, RAM HyperX Savage Black Edition 16GB DDR4 3000 MHz, Graphic Card Gigabyte GeForce GTX 1080 8GB, Power supply Corsair RM Series 850W, Windows 10 64 bit.

  • Spit40,

    this is good. I did succeed in getting the select_all using the .mbar.tools.menu add command working. What I'm looking for is a bit more "interactive" way of executing the commands while testing, and not having to restart ac3d each time to load a new script/command. In the forum there are references to using commands via telnet, e.g I see in one of your threads over on the Inivis forum "Andy" is referring to a telnet option "doing an "ac3d list" command via a telnet window gives the list of commands and one is"

    Also, a bit better description of the various commands would be good. e.g. in the ac3d_list output it does not say what the arguments for e.g. set_select_mode is. Did you request a copy of the SDK? I see it's not directly downloadable, but available on request for us who has bought the license.

    Thanks again,

    coffeecup

  • I have no more documentation. It was pure trial and error and asking questions on the forum which were always answered by Andy. I only use a few commands too.

    I found a way to test/develop which doesn't involve reloading ac3d. Not telnet and not interactive but pretty quick. I'll post it when i'm at my PC.

  • This is how I do it. I have this script in my AC3D folder in a TCL file in the scripts folder

    Code
    proc desktopTCL {} {
    set filename "C:/Users/PHDULTRA/Desktop/tcl.tcl"
    source $filename
    doTCL
    rename doTCL ""
    }
    add_tools_menu_item "Desktop TCL" desktopTCL "Desktop TCL"

    Whenever the procedure desktopTCL is called it loads and refreshes the script in the tcl.tcl file which sits on my desktop and then runs the script doTCL which is in it. That way I can keep tcl.tcl open in notepad, tweak the code in doTCL and just call desktopTCL using the method from before to run my latest code.

    TIP: Look at the code inside the tcl folder in AC3D - all menu function avaialble in AC3D seem to be defined there. Its how I worked out how to do some things. ac3dmenu.tcl is particularly good. AC3D navigation seems to be built in TCL.

  • Thanks Spit40 ,

    this is quite handy, I tested it out successfully today. I also figured out that what I was looking for was to go into the "Advanced Settings" and enable the TCL socket port, that will let me telnet into the program on local port 1655 (or whatever you set it to) and run the commands, which will allow me to potentially script up a number of operations. You are probably already aware of this, but of some reason it did not just come to me straight away. I'll leave a screenshot here in case someone else stumbles over the same problem.

  • coffeecup1978 - Great thanks. I stopped looking once I'd found a workaround. I haven't done much with telnet since my computer science degree ### years ago.