Jump to content

Global coordinates in a PIO


Gonda

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

Link to comment
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.

 

Link to comment

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.

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