Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- Creo Parametric
- Customization
- Zoom with respect to rotation using toolkit

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

May 16, 2019
07:31 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

May 16, 2019
07:31 AM

Zoom with respect to rotation using toolkit

Hello

We need to zoom to specific edge of model. For this, we are using API ProWindowPanZoomMatrixSet(). This is also there in example code. It works perfectly fine to zoom when edge is visible.

How to identify whether it is required to rotate model to make edge visible?

Any thought would be of great help.

Thanks in advance...! Feel free to ask for any clarification.

Regards

Ketan

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

May 21, 2019
08:06 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

May 21, 2019
08:06 AM

@Ketan_Lalcheta wrote:

Hello

We need to zoom to specific edge of model. For this, we are using API ProWindowPanZoomMatrixSet(). This is also there in example code. It works perfectly fine to zoom when edge is visible.

How to identify whether it is required to rotate model to make edge visible?

Any thought would be of great help.

Thanks in advance...! Feel free to ask for any clarification.

Regards

Ketan

Ketan,

Don't bother with the edge visibility - this is GLUT related problem and Pro/Toolkit has no API's for it...

You should create a view matrix where you know the edge will be visible and set this view before pan/zoom operation.

To construct a view matrix: from the edge to adjacent surfaces and UV's of the surfaces, having UV's get surface normals at the edge vicinity. Make a matrix from the edge midpoint and one of the normals. you may need to rotate matrix 180 to change view direction.

Apply pan/zoom as before...

HIH.

FV.

7 REPLIES 7

May 17, 2019
05:49 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

May 17, 2019
05:49 AM

Maybe, function **ProSolidRayIntersectionCompute** will help to determine if a edge is blanked by other geometry.

May 17, 2019
06:06 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

May 17, 2019
06:06 AM

thank you for responding on this.... This is something I am looking since so long...

You mean to say try to use **ProSolidRayIntersectionCompute() **to check for all other edges and check whether intersection result is considered edge or not? Is my understanding correct?

Additionally AFIK, **ProSolidRayIntersectionCompute()** doesnot take care of visibility in default or considered view. It just gives result if intersection is found with other geometry by ray traversal in said direction irrespective of visibility.

May 17, 2019
06:20 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

May 17, 2019
06:20 AM

The function finds intersections in both directions from the start point of the ray,

and assigns each intersection a depth—the distance from the ray start point in the

direction defined (intersections in the reverse direction have a negative depth).

You can extract the depth of each intersection using the functionProSelectionDepthGet(). The intersections are ordered from the most

negative depth to the most positive.

I think it is possible to find the depth of target edge selection. If the edge is deeper then other geometry (surfaces of solid body), then the edge not visible and model must be rotated.

May 17, 2019
07:11 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

May 17, 2019
07:11 AM

sounds good. Let me give it a try. Could you please help me with more details?

I mean what could be done for ray definition for an edge to be visible or not? Consider a rectangle part having l, b and H dimensions. I need to verify that one specific edge (for example edge having ID 12) out of 12 total edges is visible in current view of model or not?

May 21, 2019
08:06 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

May 21, 2019
08:06 AM

@Ketan_Lalcheta wrote:

Hello

We need to zoom to specific edge of model. For this, we are using API ProWindowPanZoomMatrixSet(). This is also there in example code. It works perfectly fine to zoom when edge is visible.

How to identify whether it is required to rotate model to make edge visible?

Any thought would be of great help.

Thanks in advance...! Feel free to ask for any clarification.

Regards

Ketan

Ketan,

Don't bother with the edge visibility - this is GLUT related problem and Pro/Toolkit has no API's for it...

You should create a view matrix where you know the edge will be visible and set this view before pan/zoom operation.

To construct a view matrix: from the edge to adjacent surfaces and UV's of the surfaces, having UV's get surface normals at the edge vicinity. Make a matrix from the edge midpoint and one of the normals. you may need to rotate matrix 180 to change view direction.

Apply pan/zoom as before...

HIH.

FV.

May 22, 2019
07:02 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

May 22, 2019
07:02 AM

Thanks FV for this.

It worked. However I could not get "having UV's get surface normals at the edge vicinity."

I did following:

-> Get Edge data and find mid point

-> Get edge neighbors and find surface data for **first** surface

-> Transfer mid point of edge using ProPntTrfEval for ProAsmcomppathTrfGet matrix and ProViewMatrixGet matrix

-> Transfer surface data's e1,e2 and e3 (data.p_surface_data->srf_shape.plane.e3) using vector transfer for above two matrix

-> Initiate matrix from above details

-> Set view matrix and repaint window

Thank you very much for this information. It works fine for few cases I checked. however I would like to understand what you wanted to convey by "having UV's get surface normals at the edge vicinity."

Thanks and Regards

Ketan

May 22, 2019
09:39 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

May 22, 2019
09:39 AM

@Ketan_Lalcheta wrote:

Thanks FV for this.

It worked. However I could not get "having UV's get surface normals at the edge vicinity."

I did following:

-> Get Edge data and find mid point

-> Get edge neighbors and find surface data for

firstsurface-> Transfer mid point of edge using ProPntTrfEval for ProAsmcomppathTrfGet matrix and ProViewMatrixGet matrix

-> Transfer surface data's e1,e2 and e3 (data.p_surface_data->srf_shape.plane.e3) using vector transfer for above two matrix

-> Initiate matrix from above details

-> Set view matrix and repaint window

Thank you very much for this information. It works fine for few cases I checked. however I would like to understand what you wanted to convey by "having UV's get surface normals at the edge vicinity."

Thanks and Regards

Ketan

an edge midpoint is 0.5 parameter, use ProEdgeXyzdataEval to get xyz_point, having xyz_point use ProSurfaceParamEval to get uv_point, modify uv_point (+/-5% for example) to 'move' it from being on-edge position and use it as an input to ProSurfaceXyzdataEval to get normal. apply assembly transformations and view transformations as needed.