PDA

View Full Version : coffee problem GetActiveTool


shiroi
04-17-2006, 12:01 PM
Hello!
I tried to write my first coffee plugin. I want to read and switch the "select only visible" option from the selectiontool. But now I am stuck. Please help.

I am able to print out the ID of the active tool. So i am able to compare if its the right tool active. The SDK tells that it is also possible to access the parameters of the active tool. But I dont understand how.

The SDK says:

[BaseList2D] GetActiveTool(); Returns the currently active tool. You can use this to access tool parameters, like doc->GetActiveTool()#MDATA_MAGNET_RESTRICT_X. You can also find out which tool is active with doc->GetActiveTool()->GetType()==ID_MODELING_MAGNET_TOOL.


Using "doc->GetActiveTool()->GetType()" I got the ID. But how do I access the parameters?

Can you please give me a little bit of coffecode as an example?

Thanks for your help

JDP
04-18-2006, 04:24 AM
An example of toggling "select only visible".

var tool = doc->GetActiveTool();
if(tool->GetType() == ID_MODELING_LIVESELECTION)
tool#MDATA_SELECTLIVE_VISIBLE = !tool#MDATA_SELECTLIVE_VISIBLE;

If you just wanted to uncheck or check "select only visible" then use,
tool#MDATA_SELECTLIVE_VISIBLE = 0
or
tool#MDATA_SELECTLIVE_VISIBLE = 1
To find the IDs of parameters, open up the console window, select the tool you're interested in and drag the parameter you want from the attributes manager to the command line at the bottom of the console window.

HTH
JDP

shiroi
05-03-2006, 07:05 PM
Thx for the help!
A few things came up and they left no time for coffee but ill try to try this this weekend.

CGTalk Moderation
05-03-2006, 07:05 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.