Jump to content
Developer Wiki and Function Reference Links ×

Conzeptual question on how to deal with the insertion point


VvierA

Recommended Posts

Hello,

let's say I'd like to make a simple rectangle as a plugin object.

I'd use rect(0,0,10,-5) to draw it.

The insertion point would be automatically the origin of the plugin object (i.e. 0,0).

The question ist:

How can I change the insertion point of the plugin object.

Let's say, I want the insertion point to be in the center of the rectangle.

Do I have to change the command to rect(-5,2.5,5,-2.5)

or

Is it possible to 'move' the insertion point independently, so that I do not have change the position of the rectangle on the internal coordinate system of the plugin object?

The aim in the end is certainly to be able to change the insertion point of the plugin object via the object info palette and to have a code as simple as possible to draw the rectangle.

VvierA

Link to comment

I tried this, but it doesn't work.

I do not now how to move the newly generated group.

Thank you

VvierA

---

procedure door;

VAR

ObjectH : HANDLE;

BEGIN

BEGINGROUP;

LINE (0.04,0);

ARCBYCENTER (0.04,0,0.805,0,90);

MOVE (0.805,0);

LINE (0.04,0);

ENDGROUP;

MOVE3D(2,2,0);

END;

RUN (door);

Link to comment

A few things.

If you have a rectangular PIO, there is a clear origin, but identifying the insertion point is less straightforwards, at least to the user. If you do offset the object from its origin, you lose the ability to resize the object via its corners and edges in a logical way.

If you have a point PIO, then the insertion origin is more clear. The cleanest way to code this is to define an offsetX and offsetY variable, and add them to every coordinate that you use to draw. Eg. offsetY could be -height/2, 0, or height/2 depending on a top, center, or bottom alignment setting.

You should have your script commands work with handles rather than on selected objects. Move() will move selected objects. HMove() will move objects with the specified handle. As PIO code functions on objects within a container, you should use the handle versions of any commands.

HTH,

Josh

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...