PDA

View Full Version : Script for right-click menu


bdb
29th January 2007, 01:53 PM
Hi,

Is it possible to show a menu after right clicking in a view? Can this be done with a script?

Thanks,
Bart


From within tcl, ac3d commands are generally called like this:

ac3d select_all

If a command returns a value:

set numselobs [ac3d selection_get_num_objects ]

For a list of available commands, send AC3D a 'list' comand e.g.

ac3d list

Some tips

Rather than using 'toplevel' to create a new window, we recommend you use 'new_toplevel <windowpath> <title>'. This is a multi-platform friendly function. Using this means that the script will run on any platform. If you do not use this, the new window can easily get lost behind others.

Under Windows, set File->Settings->Advanced->show-windows-console on. Any puts output will be shown in the console window that will stay visible after AC3D starts.

This message is under construction...

Andy
29th January 2007, 07:00 PM
Try this:


#make a popup menu
menu .rightmenu -tearoff false
.rightmenu add command -label "Select All" -command "ac3d select_all"

# bind a right click (button 3) to view 0 (top left view window)
bind $ToglWinName(0) <3> { tk_popup .rightmenu %X %Y}

bdb
2nd February 2007, 08:40 AM
Thanks for the tip!

Regards,
Bart
Try this:


#make a popup menu
menu .rightmenu -tearoff false
.rightmenu add command -label "Select All" -command "ac3d select_all"

# bind a right click (button 3) to view 0 (top left view window)
bind $ToglWinName(0) <3> { tk_popup .rightmenu %X %Y}

Clear
18th March 2008, 08:57 PM
what is tcl? how do i do this? do i need a separate program?

MrSteve
18th April 2008, 09:05 PM
no TCL is in the folder that AC3D is installed on on your computer, you can use notepad to right these is your clever enough

Klyde
19th April 2008, 01:10 AM
Oh but Tcl/Tk (pronounced 'Tickle Tick') is a language all on its own my friend. Have got a book in storage; (Big, Black, Thick one), will dig it out tomarrow. It has an old version of it included. But yes you are correct you can use a text-editor to write the scripts.

MrSteve
19th April 2008, 01:44 PM
is that what it is call Tickle Tick or is is just pronouced that way?

Klyde
19th April 2008, 02:06 PM
Just pronounced that way I 'spose.

Klyde
22nd April 2008, 09:34 PM
Went to storage and retrieved that book. "Graphical Applications with Tcl & Tk 2nd edition. -- Eric Foster-Johnson (ISBN 1-55851-569-0) It covers ver 8.0.