Community Tip - You can change your system assigned username to something more personal in your community settings. X
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.
@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.
Maybe, function ProSolidRayIntersectionCompute will help to determine if a edge is blanked by other geometry.
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.
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 function
ProSelectionDepthGet(). 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.
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?
@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.
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
@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 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
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.