MaxStudio Posted January 27, 2012 Share Posted January 27, 2012 Hello, I've created a Plugin Object that creates a rectangle with another rectangle offset on the inside. The Object Info Pallette has the following variables: Width Height Offset of Inner Rectangle At the moment I can only edit the dimensions of the rectangles by changing the dimensions of the variables via the Object Info Pallette. I would like to be able to select the Plugin Object, click the handle, and drag the handle to modify the rectangles dimensions. Basically, I just want the ability to manipulate the plugin object like a normal rectangle. Is this possible? Thanks in advance. Quote Link to comment
Vectorworks, Inc Employee klinzey Posted January 27, 2012 Vectorworks, Inc Employee Share Posted January 27, 2012 You need to create a rectangular plug-in object. In the Plug-in editor when you click NEW select "Rectangular Object" rather than Point Object. You will get 2 default parameters LineLength and BoxWidth which will control the length and with. You can access them just like any other parameter. Unfortunately you can not change a Point Object to a Rectangular Object Plug-in. Quote Link to comment
MaxStudio Posted January 27, 2012 Author Share Posted January 27, 2012 Ok so I can't change a point object to a rectangular object, but can I use the same vectorscript? What type of problems might i run into if I just copy and paste the script from the Point Object to the Rectangular Object? I'm going to attempt it now. Thanks Quote Link to comment
MaxStudio Posted January 27, 2012 Author Share Posted January 27, 2012 Do I need to keep the parameters LineLength and BoxWidth? or can I change those to simply width and height? Quote Link to comment
Vectorworks, Inc Employee klinzey Posted January 27, 2012 Vectorworks, Inc Employee Share Posted January 27, 2012 You can change the "Alternative Name" (aka display name) but the actual parameter names can not be changed. Quote Link to comment
MaxStudio Posted January 27, 2012 Author Share Posted January 27, 2012 ok, i created a simple example that seems to work. Unfortunately, I'm a little confused by the starting location for the x and y parameters. The x seems to be the bottom left corner while the y seems to be centered on the object causing me to subtract or add half the height. It is not a big problem, but does anyone have any idea why this is?: **If anyone can see any errors in my code or ways to improve my code your comments are always appreciated** PROCEDURE plugin; VAR x, y, w, h, LineLength, BoxWidth, Offset : REAL; result : BOOLEAN; objname : STRING; oh,rh,wh : HANDLE; BEGIN { retrieve custom object information } result:= GetCustomObjectInfo(objname,oh,rh,wh); { if object information was successfully retrieved } IF result THEN BEGIN { retrieve parameters } LineLength := PLINELENGTH; BoxWidth := PBOXWIDTH; Offset := POFFSET; w:=LineLength; h:=BoxWidth; PenSize(4); Rect(x,y-(h/2),x+w,y+(h/2)); PenSize(2); Rect(x+Offset,y-(h/2)+Offset,x+w-Offset,y+(h/2)-Offset); END; END; Run(plugin); Quote Link to comment
Pat Stanford Posted January 27, 2012 Share Posted January 27, 2012 I don't know why Rectangle PIOs work that way, just that they do. Depending on what you are doing, perhaps it would be better to use a Linear PIO to get the opposite corners instead of the two edges. 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.