Jump to content
Gonda

Global coordinates in a PIO

Recommended Posts

Hey All,

 

So, I'm in the process of developing a custom PIO that has two parts.  The first part acts as a standard object in terms of XYZ as well as movement, rotation, etc.

The trick is that I'm also looking to have a second part to it that always displays information in the same place regardless of the XYZ of the point object.

Example:

 

Object is located at 5',-15'.  In the OIP, there is an XY field to define where the secondary info appears, say 50',50'.  Right now, all of the functions I've seen in the Function Reference seem to relate to the objects origin as opposed to the drawings origin.  Is there a way to reference the drawings origin from within a PIO instead of the objects origin?

 

Cheers,

-gonda

Share this post


Link to post

Hi Gonda,

test coord.vso.zip

 

Event based Plug-In displaying the position of the PIO related to the User Origin.

You may find some Var that are not used, they are left overs from the original plug-in that I dismantled to its core.

 

Have fun.

Edited by Gerard Jonker

Share this post


Link to post
6 hours ago, Gonda said:

Hey All,

 

So, I'm in the process of developing a custom PIO that has two parts.  The first part acts as a standard object in terms of XYZ as well as movement, rotation, etc.

The trick is that I'm also looking to have a second part to it that always displays information in the same place regardless of the XYZ of the point object.

 

 

Your object origin is always 0,0 towards your object insertionpoint.

Knowing that, for your object to show something at an absolute position in the drawing, all you need to do is substract the object position from the relative position of the part within the object.

 

Say you want something shown absolute at A(50,50), your object is placed at B(25,25) => The inner component of your object should be placed at A-B.

Keep in mind that this does not take in rotation, you should apply the transformationmatrix of the object instead for this to work.

 

Share this post


Link to post

Just to expand on what @Hippocode says, you can use the GetCustomObjectInfo to get a handle to the current object. From there you can use GetSymLoc3D to get the insertion point of the PIO. From there just do the math to calculate the necessary offset to get the second parts in the absolute position you want.

 

Be careful with this, as you may end up with very big objects and have a problem with them selecting when you try to select other objects that happen to overlap the very large bounding box.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

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