A way to switch 2d face parameters from one face to another

Technical discussions
Post Reply
Tyler Heath
Posts: 1
Joined: Wed Jul 07, 2021 7:38 am

A way to switch 2d face parameters from one face to another

Post by Tyler Heath »

Hello
I am starting with this software. I need to do some computing on a shell by stepping over from face to face. I have two adjacent faces and a point very close to the shared edge. I need to step over the edge and get u,v parameters of the other edge.

Can anybody point me to the right way of doing this?

Thank you

Prashant Kande
Posts: 94
Joined: Mon Apr 04, 2016 4:55 am

Re: A way to switch 2d face parameters from one face to another

Post by Prashant Kande »

Hi Tyler
It is a good question.

If you know which edge is shared you need to find parameter of the nearest point on the edge. It can be done either in 2d or 3d. This is the 2D way:
if uv is the 2d point you have,

Code: Select all

IBRepFace_DG face;
IBRepEdge_DG edge;
int side = edge.FindFace(face);
double outMinParam, outMaxParam;
ICurve2d_DG pcuve = edge.GetPCurve(side, out outMinParam, out outMaxParam)
DG2D pointNearest;
double uEdge = pcuve.GetNearestPoint(uv, out pointNearest);
// Convert it to ratio:
double rEdge = (uEdge - outMinParam)/(outMaxParam-outMinParam);	
//Or RangeDg rg = new RangeDg(outMinParam, outMaxParam); double rEdge = rg.GetRatio(val);
Get the uv for the adjacent face:

Code: Select all

IBRepFace_DG faceOher = edge.GetOtherFace(face);
DG2D usResult = faceOher.GetEdgeUV(edge, rEdge);
If you do not know the edge, it can be found by looping edges in the wire(s), getting the pointNearest in the same way as above. The edge with minimal distance uv to pointNearest will be the one you need. We will look at adding a method to make it shorter in the next version

Regards

Post Reply