Jump to content
Developer Wiki and Function Reference Links ×

Modifying the Object to manipulate the variable?


MaxStudio

Recommended Posts

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.

Link to comment
  • Vectorworks, Inc Employee

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.

Link to comment

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);

Link to comment

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.

×
×
  • Create New...