Rick Martin Posted May 14, 2008 Share Posted May 14, 2008 Is it possible to select a tool via a contextual menu? Would I need to write a script in order to do this? Quote Link to comment
Pat Stanford Posted May 14, 2008 Share Posted May 14, 2008 I haven't done it, but it should be possible. Yes, you will have to write a script, a VSM Vectorscript Menu item to be exact. You would use the VectorScript Plug-In Editor under Scripts in the Tools menu. OK, I take that back. I have done it now. Go into the VS PIug-In Editor and create a new Command (top radio button). Click the Script Button and enter the following script SetTool(-205); Click OK twice. Edit you workspace to include the command in the contextual menu. The -205 is the number for the oval tool. All the other tool numbers are listed in the VectorScript Appendix. Go into the VectorWorks Help. Select the VectorScript Function Reference. Click on the link in the right hand pane to open the function reference. In the upper left pane, click on Additional Resources. In the lower left pane, click on the VectorScript Appendix. Bookmark this page so you can get back to it. Under Appendix E, click on the SetTool-CallTool Selectors. If you are going to do many of these, I recommend that you make a category so you can find them more easily in the Workspace editor. Also, you might want to start the names with a space or an exclaimation mark so they sort to the top of the list. Pat Quote Link to comment
Rick Martin Posted May 14, 2008 Author Share Posted May 14, 2008 That's perfect! Do you know where the list of CallTool Selectors for other tool sets? I also wanted to use some from the Spotlight set. Quote Link to comment
Pat Stanford Posted May 14, 2008 Share Posted May 14, 2008 It looks like there is another command SetToolByName('2D Selection Tool'); That will give you all of the tools that don't have numbers. There is also a similar CallToolByName that just activates the tool for one use (like Call Tool) These "hidden" functions are listed on the on-line function reference Pat Quote Link to comment
Rick Martin Posted May 14, 2008 Author Share Posted May 14, 2008 Thanks Thanks thanks Pat! This works: PROCEDURE 2DTool; BEGIN Message(SetToolByName('2D Selection Tool')); END; RUN(2DTool); Last question: is there a different command that I can use instead of message so that the vectorscript window is not called up? It doesn't work without it though. Quote Link to comment
Pat Stanford Posted May 14, 2008 Share Posted May 14, 2008 I will never figure out why they make some of these things functions instead of procedures. Functions return a value, procedures don't. Try this instead. It includes a variable to assign the return value of the function to. Procedure Test; Var B1:Boolean; Begin B1:=SetToolByName('Spiral'); end; Run(Test); Also, note that this seems to only work for items that don't have standard SetTool IDs. You will probably need two versions depending on what tools you want to access. Pat Quote Link to comment
Rick Martin Posted May 14, 2008 Author Share Posted May 14, 2008 Fantastic. Thanks again, Rick Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.