Jump to content
Developer Wiki and Function Reference Links ×

Custom PIO object will only draw on layer plane.


Will

Recommended Posts

I am developing a PIO, but I’m encountering what seems to be a bug in the plug-in definition.

The PIO is defined like this:

[img:center]https://dl.dropboxusercontent.com/u/2804259/Files%20shared%20for%20conversations/2015.05.29/PastedGraphic-3.png[/img]

With these properties:

[img:center]https://dl.dropboxusercontent.com/u/2804259/Files%20shared%20for%20conversations/2015.05.29/PastedGraphic-2.png[/img]

Note that in the screen shot above “Requires 3D” is set, but it does not appear to be possible to draw the path which defines the PIO on any other plane apart from the layer plane and if I try to rotate to another plane after drawing I get this error:

[img:center]https://dl.dropboxusercontent.com/u/2804259/Files%20shared%20for%20conversations/2015.05.29/PastedGraphic-1.png[/img]

I have the same problem if I create the plugin as a point object. |t doesn’t seem logical that you can set "Requires 3D” but it is only possible to draw something on the layer plane. I would expect a 2D path based PIO to be able to draw on any arbitrary working plane as the normal 2d path tool can.

Thanks for any insight anyone can give on this.

Link to comment

The definition is correct. You can only draw a 2D path on a 2D plane even if the existing view is other than the top view.

The reason you are getting the error is because the 2D path can only be rotated about the axis perpendicular to the plane it is drawn. Normally, if the path is drawn on the x-y axis, then you can only rotate it about the z axis.

In order to rotate it about the other axes, you will need to convert the 2D path to a 3D curve such as a 3D polygon or NURBS curve or create a 3D solid such as extrude along path.

Link to comment

The definition is correct. You can only draw a 2D path on a 2D plane even if the existing view is other than the top view.

The reason you are getting the error is because the 2D path can only be rotated about the axis perpendicular to the plane it is drawn. Normally, if the path is drawn on the x-y axis, then you can only rotate it about the z axis.

In order to rotate it about the other axes, you will need to convert the 2D path to a 3D curve such as a 3D polygon or NURBS curve or create a 3D solid such as extrude along path.

Link to comment

Hybrid PIO's can't insert on an alternate plane (when you extrude, it becomes hybrid). You may be able to get the plane of the path and manually adjust your 3D geometry accordingly. If you are creating a true top/plan view (as opposed to a schematic for the 2D view), you also have to adjust the plan view to match the rotated plane.

-Josh

Link to comment

No, it seems I don't need a single matrix defining the transform, I need to get the matrix of the working plane of the 2d path and somehow break this down into 3d move and 3d rotate commands to get the extrusion back onto the same plane as the original poly. Any ideas?

Link to comment

You need to create the extrude in one plane and then rotate about any of the x,y, or z axes to get the orientation that you want. I usually construct in the x-y plane which would look as the object was lying on the floor and then I rotate it about the x axis to orient the object as an elevation (x-z plane).

It may be beneficial if you can construct the object manually in a blank file first. Then export the object as a script. The script is accurate most times and the best way to test for it is to import the script back into a blank sheet. If it looks like the original, then the code is correct.

Link to comment

You need to create the extrude in one plane and then rotate about any of the x,y, or z axes to get the orientation that you want. I usually construct in the x-y plane which would look as the object was lying on the floor and then I rotate it about the x axis to orient the object as an elevation (x-z plane).

It may be beneficial if you can construct the object manually in a blank file first. Then export the object as a script. The script is accurate most times and the best way to test for it is to import the script back into a blank sheet. If it looks like the original, then the code is correct.

Link to comment

OK so I'm using SetWorkingPlaneN to set the working plane. Then extruding a rectangle then a creating a path based PIO using a duplicate rectangle. The extrusion from the first rectangle is created correctly on the working plane. The extrusion from the second rectangle inside the PIO is created incorrectly on the layer plane.

Outside PIO this is the result of calling vs.GetEntityMatrix on the rectangle:

b:True offset:(-0.0, -0.0, -0.0) xAngle:-135.0 yAngle:-90.0 zAngle:0.0

This is the result of calling vs.GetEntityMatrix on the exact same rectangle used to create the PIO:

b:False offset:(0.0, 0.0, 0.0) xAngle:0.0 yAngle:-0.0 zAngle:0.0

Is there any way to get the entity matrix of the plane the PIO is drawn on?

Thanks,

Will

Link to comment

There seems to be no way to get the entity matrix of the plane that the plugin is supposed to be on. From inside the redraw event on a PIO, calling vs.GetEntityMatrix(handleToPIOinstance) never returns anything other than 0 for the xangle or y angle.

vs.GetPlanarRef(handleToPIOinstance) always returns 0 for the plane ref.

I thought of creating a dummy object outside the PIO in the onObjectInitX event and storing the offsets and angles in plugin parameters but, if the plugin is moved or rotated, then if it gets reset the entity matrix will be out of date.

....

Link to comment

There seems to be no way to get the entity matrix of the plane that the plugin is supposed to be on. From inside the redraw event on a PIO, calling vs.GetEntityMatrix(handleToPIOinstance) never returns anything other than 0 for the xangle or y angle.

vs.GetPlanarRef(handleToPIOinstance) always returns 0 for the plane ref.

I thought of creating a dummy object outside the PIO in the onObjectInitX event and storing the offsets and angles in plugin parameters but, if the plugin is moved or rotated, then if it gets reset the entity matrix will be out of date.

....

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