AlexClark

Tool to Insert Symbols?

3 posts in this topic

Hello, 

 

I'm a long time VW user, but I'm just starting to stumble my way into scripting. I've done some tinkering with C++ on Ardunio, but otherwise I'm a coding noob. 

 

I've got a good collection of symbols I've built myself and use in drawings regularly; things like drawing labels, lighting position labels, and lineset schedules. In a very basic sense, I'd like to create a tool that allows me to edit fields on these symbols from the Shape tab of the OIP, rather than having to go over to Data. But, while I'm at it, it would be cool to build it so that several variations of a symbol are available from a drop-down menu (something like the stock Center Line Tool or North Arrow Tool where different styles can be chosen). 

 

While the available resources have given me a decent understanding of the fundamentals of VS, I'm a bit lost on creating a symbol and getting something to write values to a record. I've also been playing around with Marionette (which looks super cool) and while I've made a script that will insert a symbol, I have not been able to get values to be written to the symbol's record.  I feel like this should be easier than it seems ...

Share this post


Link to post
Share on other sites

A symbol is never going to be be able to have data accessible from the Shape pane. In order to do this you are going to need to create a PlugIn Object.

 

The basic idea is that you will create a "Parameter Record" that has fields similar to the ones in your custom record that you access through the data pane. You then use these "Parameters" in your script by prefixing the field names with "P" They then act just like other variables, but can be changed by the script.

 

I have attached a very simple PIO that shows an editable text field on the Shape pane. This PIO simply inserts a locus point and labels it with the custom text and the distance from the origin.

 

Drop the .VSO file into your User folder, Plug-ins and restart VW (Not necessarily required, but a good idea.) Then edit your workspace to include the new tool.

 

You can use the Tools:Plug-ins:Plug-in Manager to modify the object. Go to the Custom Plug-ins tab and you should see the Distance from 00 plug in listed. Click the Edit Script button to see the script. Click the Edit Definition button and go to the Parameters tab to see the parameters. Parameter 1 (Controlpoint01X and ControlPoint01Y) are automatically generated based on the type of Plug-in it is. The MyText is something I have added to have it show in the OIP.

 

The PIO is intended to be used at a scale of something like 1/4". If you use it at 1:1, the label will end up about 3" away from the locus point.

 

Hopefully this gets you started. Write back if you need more help.

Distance from 00.vso

Share this post


Link to post
Share on other sites

I programmed Vectorscript for ten years before I finally delved into creating custom plugins.  I don't know why it took me so long. If you can write Vectorscript, it's pretty simple to create a custom plugin.  I've now created numerous tools for cabling, networking, racks, and others.  I did it for the same reason you are looking for: to have the info on the shape panel instead of the data panel.  And because with a plugin, you can do drop-down menus, checkboxes, enter actual dimensions, hide parameters based on others,  etc.  So much more versatile than data.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now