Go Back   AC3D Forums > Resources > AC3D Scripts and Mods
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 27th January 2018, 02:16 PM   #1
SpitForty
Junior Member
Member
 
Join Date: Jan 2018
Posts: 24
Default Understanding Scripts

Hi,

I'm just starting with scripts. I've managed to select things by name, rotate, export and so on. I'm now trying to use the knife and I see a syntax I can't follow where the command is followed by "user command". How does this work please?

I tried selecting the object to use as a knife and then did "ac3d ddhknife" but that didn't work.

Also I'm struggling to work with internal object_id's. How can I obtain them? I don't see anything in the .AC file that looks like an object_id and I can't seem to list them. If I make something, say "new_cube" it doesn't return a value as an object_id.

Finally I'd rather find out the answers to these things myself than impose on others, though Andy has been very kind and helpful, so is there more documentation anywhere? I have a list of all the AC3D commands and the arguments they take but nothing more than that.

Phil
SpitForty is offline   Reply With Quote
Old 28th January 2018, 06:54 AM   #2
SpitForty
Junior Member
Member
 
Join Date: Jan 2018
Posts: 24
Default Re: Understanding Scripts

UPDATE: I discovered that ddhknife was actually working. I presumed it hadn't because after I'd run the script I opened the dialogue box expecting it to show the knife object I'd set it to, but the dialogue was blank. However I run the ddhknife_go function and all was well.

However... it doesn't cut meshes very well. I tried to cut a mesh with a block and got this.



zoomed in..



What I have found works well instead is boolean knife and cut away, however I can't work out how to run that with a script. I've tried knife-and-cut-away, knife_and_cut_away, knife+cut-away etc etc.

Anyone?
SpitForty is offline   Reply With Quote
Old 28th January 2018, 07:56 AM   #3
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,382
Default Re: Understanding Scripts

doing an "ac3d list" command via a telnet window gives the list of commands and one is:

boolean <subtract, union or intersect> "perform a boolean operation"

In a script, you'll need to select one object e.g. objectA, then another e.g. objectB and then submit the command "ac3d boolean subtract" which should perform objectA-objectB.

To find out more about how the internal commands are used, have a look in the tcl files (in the tcl subdirectory). If you look in the hierarchy tcl file, you'll see commands that work with object ids.

If you are a coder, it's relatively easy to add extra commands via a plugin. There are currently no commands to construct a object (e.g. create-object, add-vertex, add-surface etc.) but they could be added. They could be rather dangerous e.g. you could accidentally add the same vertex twice or create a bad object which could cause AC3D to crash, but if used correctly, might be useful for your needs.
Andy is offline   Reply With Quote
Old 28th January 2018, 08:11 AM   #4
SpitForty
Junior Member
Member
 
Join Date: Jan 2018
Posts: 24
Default Re: Understanding Scripts

Thanks Andy. boolean subtract doesn't work on a mesh, it says it only works on 3d objects, so what I need is boolean "knife-and-cut-away" but I can't work out what argument to use as "knife-and-cut-away" isn't recognised.

I've done the ac3d list but I only get this line:

boolean <subtract, union or intersect> "perform a boolean operation"

Does that mean boolean knife-and-cut-away isn't a scripted option? If it is an option can I find out what arguments are accepted?
SpitForty is offline   Reply With Quote
Old 28th January 2018, 08:49 AM   #5
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,382
Default Re: Understanding Scripts

Have a look in tcl/ac3dmenu.tcl - you'll see all the commands attached to the menu items.
Andy is offline   Reply With Quote
Old 28th January 2018, 08:59 AM   #6
SpitForty
Junior Member
Member
 
Join Date: Jan 2018
Posts: 24
Default Re: Understanding Scripts

Fantastic ! This is great documentation. For anyone else its "knifecut" as per

$menubar.object.menu add cascade -label "Boolean" -menu $menubar.object.menu.boolean
menu $menubar.object.menu.boolean -tearoff 0
$menubar.object.menu.boolean add command -label "Subtract" -command "ac3d boolean subtract"
$menubar.object.menu.boolean add command -label "Intersect" -command "ac3d boolean intersect"
$menubar.object.menu.boolean add command -label "Union" -command "ac3d boolean union"
$menubar.object.menu.boolean add command -label "Cut Away" -command "ac3d boolean cut"
$menubar.object.menu.boolean add separator
$menubar.object.menu.boolean add command -label "Knife" -command "ac3d boolean knife"
$menubar.object.menu.boolean add command -label "Knife and Cut Away" -command "ac3d boolean knifecut"
SpitForty is offline   Reply With Quote
Old 16th March 2018, 10:27 PM   #7
coffeecup
Junior Member
Junior member
 
Join Date: Mar 2018
Posts: 2
Default Re: Understanding Scripts

Hi Andy,
I'm going to hijack Spitforty's thread a bit, cause we are kind of looking at the same thing over at the Aerofly/IPACS forum. I've been reading a bit about the scripts on this sub forum, and I keep seeing references to telnet and shell sessions:

Quote:
Originally Posted by Andy View Post
doing an "ac3d list" command via a telnet window gives the list of commands and one is:

boolean <subtract, union or intersect> "perform a boolean operation"
Can I run the commands interactively, instead of adding them to the menus and reload AC3D each time I want to do something? Is this part of the SDK?

Also, is there a bit more detailed doco on each tcl function, maybe part of the SDK? I have a list of commands, but I'm a little bit unsure what arguments they take.

Thanks in advance,
coffeecup
coffeecup is offline   Reply With Quote
Old 19th March 2018, 03:34 PM   #8
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,382
Default Re: Understanding Scripts

Sorry, the commands are self-documenting .

The best way to find out what the parameters mean is to look at the tcl code that calls AC3D - mostly in the menu code in tcl/ac3dmenu.tcl.

If you can't work something out - let me know.

It's easy enough to make a script which pops up a window which say a list of button in it. Pressing the buttons can run one or more command. There may be some examples on here...
Andy is offline   Reply With Quote
Old 19th March 2018, 03:39 PM   #9
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,382
Default Re: Understanding Scripts

Here's a an example, which you might also find quite handy for the Aerofly stuff:

https://www.inivis.com/supercoldmilk...quickgrid.html
Andy is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 05:12 PM.


AC3D Forum
(C) Inivis Limited 2020