Kevin McAllister Posted September 22, 2009 Share Posted September 22, 2009 I have been trying to create a custom tool script which addresses the Drawing Label tool using the Custom Tool/Attribute menu command. The resulting script does not address the correct tool in either VW 2009 or VW2010. I looked in the Appendix of the VectorScript Language Guide but the Drawing Label tool is not assigned a tool number in the basic list. Is there a more complete list of tool numbers somewhere? Thanks, Kevin Quote Link to comment
Pat Stanford Posted September 22, 2009 Share Posted September 22, 2009 Try the CallToolByName command. It is not in the regular function reference, but is in the online version. http://developer.vectorworks.net/index.php?title=VS:CallToolByName Plugin tools do not have a tool number and must be called by name. Quote Link to comment
Kevin McAllister Posted September 22, 2009 Author Share Posted September 22, 2009 Thanks Pat. I appreciate your assistance. I tried replacing CallTool with CallToolByName in the script that the Custom Tool/Attribute generates and I get: { Error: Cannot use a FUNCTION name here. } I see that one is a Function(CallToolByName) and one is a Procedure (CallTool). I guess there is a lot more to it than that. I must admit I am disappointed by the whole experience. The Custom Tool/Attribute menu command should just work for Nemetzchek included "tools". As a long time user I always imagined it as a hidden treasure trove. But upon experimented unfortunately its not. I actually considered submitting a Bugsubmit although I knew something deeper was going on. Even though there are various types of tools and plug ins, the documentation clearly differentiates anything in a tool palette as a "tool" and there are no exceptions noted in the documentation for Custom Tool/Attribute. I may get further into it to figure out how to make it work. I'm sure its probably mentioned in the archives somewhere. Thanks again, Kevin Quote Link to comment
Pat Stanford Posted September 22, 2009 Share Posted September 22, 2009 CallToolByName is a newer routine. It returns a boolean value to tell you if the call was successful or not. comparatively you would use them as follows: CallTool(23); **** Var B1:Boolean; Begin B1:=CallToolByName("Window"); ... End; **** You just need an extra boolean variable to assign the result of the function to and it should work just like the procedure. Quote Link to comment
JBenghiat Posted September 23, 2009 Share Posted September 23, 2009 Kevin, Looking through your posts, I'm realizing you're trying to work with the tool that creates the Drawing Label object. You are correct that Plug-In Objects lead a double life in the workspace -- eery PIO has a siamese twin tool that you can place in a tool palette. From a user interface standpoint, it looks like a regular tool, but from a VS standpoint, it's an object. You do have options. If you want to continue on the VS route, instead of using CallTool, use GetPt to get the objects insertion point. Use CreateCustomObject to place your Drawing Label at the point. CreateCustomObjectN gives you the option of having the object's preference dialog appear. You can set the object's parameters with SetRField -- you should be able to find more on this in the archives. If you just want to change the defaults for the Drawing Label object, go into the VectorScript Plug-In editor and find the object. Click on Parameters, and you can change any of the defaults. The final option is to create a "Red symbol". Set the parameters of a Drawing Label in the document, make it a symbol, and check the Convert to Plug-In option. You'll now have an object with preset attributes in your Resource browser. Search the help docs for "Red Symbol" for more info. HTH, Josh Quote Link to comment
Kevin McAllister Posted September 23, 2009 Author Share Posted September 23, 2009 Thanks to both of you for your further advice. I will work through the various options and see where it gets me. Kevin 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.