Jump to content
Sign in to follow this  
MaxStudio

VectorScript Editor vs. VectorScript Plug-in Editor

Recommended Posts

ok so normally i create all my scripts via the Resource Browser. I've recently tried creating a script via the VectorScript Plug-in Editor.

I create a new plugin. I then select "script" and paste my scipt. I click "compile" and it compiles successfully. I then click "Done".

Next I goto the Workspace Editor and find my new plugin tool. I select the new tool and place it in the 2D Tools of my workspace. Then I click "OK". The icon for the tool shows up in the 2D Tool palette. When I hover over the icon it gives me the name of my tool.

The problem is when I click on the tool.... nothing happens. I've run this script through the resource browser and I know it works. What am I doing wrong?

Thanks

*contemplating pulling my last hair out*

Share this post


Link to post

If you created it as a tool, it will not run until you click in the drawing. If you want it to run from the menu, you need to create a Command instead of a tool.

Share this post


Link to post

so whats the difference between a tool and a command?

I wrote the script in a text editor and then pasted it into the VectorScript Editor via the Resource Browser. It compiled fine and the script worked.

Basically the script create a Modern Dialog Box with input fields and then uses the input values to create an object.

Is this considered a tool or a command? Is there anyway for me to easily convert one to the other?

I would really like to be able to utilize the code I have all ready developed.

Thanks

Edited by MaxStudio

Share this post


Link to post

A tool exists in a tool palette. To use it, you click (or multiple click) in the drawing. The script inside the tool then draws (or modifies) the object, often using the data retrieved from the click(s) to define the object.

A command exists in a menu. Typically commands are used to modify an existing object or to change some setting in the drawing rather than to create new objects, but there is no absolute rule that requires that.

You define the PIO (Plug-In Object) as either a Tool or Command when you create it. There is no way to convert one type to the other. If you need to do that you would have to edit and copy the script of the one and then create a new PIO of the other type and paste the script in.

If this is something that you originally had running as a Script (rather than a plug-in), you probably want to make it a Command.

Share this post


Link to post

ok so thats exaclty what I want to do. so how do i go about creating the command to access my vectorscript?

where do I find my vectorscript listed in the workspace editor?

Share this post


Link to post

Go into the Vectorscript Plug-in Editor. Click the New Button and select Command.

I often start the name of the command with one or more exclaimation points (!) so that they sort to the top of the list.

You probably have to restart VW to get new commands to show up in the Workspace Editor.

Share this post


Link to post

where do I find my vectorscript listed in the workspace editor?

Command plugins will be under the Menus tab while the tool and object plugins will be under the Tools tab

Share this post


Link to post
ok so thats exaclty what I want to do. so how do i go about creating the command to access my vectorscript?

where do I find my vectorscript listed in the workspace editor?

The answers to these questions, and many more, are contained in the Vectorscript manual (located in the Additional Documentation folder inside the VW Help folder in the VW Application folder).

You can also find information on and examples of scripts in these locations:

- Customisation section of NNA website: http://www.nemetschek.net/support/custom/index.php

- Developer secton of the VectorWiki website: http://www.vectorwiki.org/index.php?title=Developer_Resources

Share this post


Link to post

ok i got it to work as a command. I created a new menu within that menu is my command. when I the command is selected it runs my script.

I would really love to make it tool rather than a command. Is the process that much more difficult?

at the moment I'm also trying to figure out how to have one script access another using {&INCLUDE}: i want to make updating these scripts on everyone's computers a lot easier.

Share this post


Link to post

The interface is not really designed to open dialogs when you use a tool, so you might need to rethink how your script works to make it flow smoothly.

Tell us more about what you are really trying to do and maybe we can make more suggestions.

As for using Include files, make sure that you give the entire path of the included file starting with the root hard disk so that it will be able find it. If you want to be able to use it across multiple machines, make sure that the folder is always going to be present on the file server as it will need to find it every time VW is started.

Share this post


Link to post

Basically the script create a Modern Dialog Box with input fields and then uses the input values to create an object.

Basically, this is exactly the definition of a VectorScriptObject aka .VSO, the third type of plug-in.

If there's no interaction in the drawing window to create the object other than clicking to place it, and if all the data that's needed to create the object is either in the script or derived from the Dialog, then this is likely the best route to take.

You have the advantage of an automatically updating editing interface through the Object Info Palette, you get the dialog for 'free', and it operates from a tool palette.

Also, I find it easier to expand the abilities of a parametric object (another name for this critter) down the road than it is to rework a dialog based object.

The input fields in your dialog are the parameters for the VSO. If you read the relevant section of the Vectorscript Language Guide you'll find the steps to transform your palette script into a Plug-In Object like the ones that come with the program.

These are the objects which you control thru the Object Info Palette, and are placed by selecting a tool. I don't know what sort of object you are creating. Is this the kind of behavior you're looking for?

Share this post


Link to post

Exactly Charles. the tools i've been working on create windows and doors (2d only) that are specific to our office's needs. I'll definitely take a closer look into the vso

thanks

Share this post


Link to post

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...