Jump to content
Developer Wiki and Function Reference Links ×

controlpoints in vs


Recommended Posts

  • Vectorworks, Inc Employee

You can use control points (2D) in VS but you must create them as parameters within the Plug-in editor.

With the SDK you can create control points dynamically as you need them.

Link to comment
  • 1 month later...

Hi,

I've got an issue with my CP.

A PIO that has one CP, standard coord on (0,0) resets them when they are (0,0) for the first time to match the center of a path object.

With HCenter, the coordinates are correct and the CP is in the middle of my object.

The issue starts when I move the object, as the CP doesn't change in coordinates (x,y) yet it follows the new position of the object. Visually this is correct, but the coordinates are wrong. From this point I can move the CP, and the distance is added/substracted from the coordinates, but the basis is still wrong as mentioned earilier.

As another script needs the chosen "point", it misses the distance if the object was moved, which makes duplicating this object also impossible due to wrong CP data..

I was thinking of looking for the "move" event, calculating the change in X/Y and manually adding that to each coordinate, but that looks a hassle to me + I'm not so sure it will be visually correct as it is now. Just the data.... hmppf

Edited by hippothamus
Link to comment

A control point is always relative to the plugin center point. So it works like designed. If you want a point to be set in the drawing and want these coordinates, you need to use other methods:

One would be that you save the coordinates in some field and adjust the control point when the plugin is moved/updated.

Another one would be that you work with another object which you reference.

There are other solutions to....

Link to comment
A control point is always relative to the plugin center point. So it works like designed.

If the CP coordinates where relative as in (object centerpoint + CPposition) then the CP would change on moving the object? That's what I don't get.

When its drawn at first, and when only the CP is moved, the CP coordinates match the drawing coordinates at the bottom, so I'd think the CP position is absolute. But on objectmove the coordinates don't get any update, while the CP does move with the object ?

Link to comment

Control points are indeed relative to the origin of the PIO. A CP 12" above the insertion point, for example, should have the coordinates (12, 0). They are also on a grid rotated with the PIO, so by "above," I mean with respect to the PIO's rotation.

When you interact with a CP, you can get accurate cursor coordinates, but those values are not the same as those stored in the OIP.

There are some issues with a user-moved origin causing incorrect CP values in the OIP. You may want to check that your origin is reset for initial testing.

A CP is really just an extra reshape handle. I think what you are describing for your needs is actually a locus representing the centerpoint and x-center, y-center parameters for the OIP. You would need to calculate the center of the object with respect to the PIO origin, then add that to the insertion point of the PIO, which you can get with GetSymLoc. Don't forget to account for the PIO's rotation -- vectors can be your friend.

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