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 1st February 2018, 09:14 AM   #7
SpitForty
Junior Member
Member
 
Join Date: Jan 2018
Posts: 24
Default Re: Understanding Scripts

Andy,

I'm back again. Not becoming a nuisance I hope

I managed to use boolean knife and cut away to take some mesh out of the larger mesh. Now I'm trying to apply a texture to it. I've loaded the texture using "search_and_set_texture <object> <texturepath> <texturename>" fine, but when I try to adjust the mapping of the object to the texture it doesn't behave as normal. I get this cross bottom left I can't adjust. Any ideas?



Now that isn't really a scripting question but the follow on is. I've worked out I can do Texture ReMap Top to bring it back to life, but I can't work out the TCL for that. I've found that "remap_textures <int window>" with a 0 does a remap "front" but can't work out what argument relates to remap top, if indeed I'm understanding this correctly.

Is there a similar file to the tclmenu file that reveals what TCL related to buttons in the texture panel i.e. these?



Thanks
Phil
SpitForty is offline   Reply With Quote
Old 1st February 2018, 06:06 PM   #8
SpitForty
Junior Member
Member
 
Join Date: Jan 2018
Posts: 24
Default Re: Understanding Scripts

OK, I found it. ac3duvedit.tcl

In it I found a bunch more AC3D commands that look very useful such as:

ac3d uv_remap 0 "map selected surfaces from front"
ac3d uv_snap_to_side top "move the selection to the top side"

ac3d uv_move_to $prefs_uv_move_x $prefs_uv_move_y "move (center of) selection to this point"

What I'm finding though is that AC3D is a little unreliable with these. I;ve had it crashing or beeping that it doesn't recognise the command. Sometimes it succeeds only after I've stopped TCL execution and started a secondary TCL script.

Any advice?
SpitForty is offline   Reply With Quote
Old 1st February 2018, 06:22 PM   #9
SpitForty
Junior Member
Member
 
Join Date: Jan 2018
Posts: 24
Default Re: Understanding Scripts

All is well if I launch the texture editor before I do these commands
SpitForty is offline   Reply With Quote
Old 5th February 2018, 04:09 AM   #10
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,382
Default Re: Understanding Scripts

Yes that's it. When you start the TCE, those commands are added.

The only thing I can think of is for you to call menu_uveditor from your script, which will pop up the TCE and add those commands.
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:14 PM.


AC3D Forum
(C) Inivis Limited 2020