Hi guys,
I use the following codes to retrieve the edges:
m_face_ptr->IGetFirstLoop(&loop_ptr);
loop_ptr->GetEdgeCount(&pEdgeCount);
CComPtr
loop_ptr->IGetEdges((IEdge **) pEdgeList);
then for each edge,:
// get curve parameter
CComPtr
edge_ptr->IGetCurve(&crv_ptr);
double start_param = 0, end_param = 0;
double param_arr[32];
edge_ptr->IGetCurveParams2(param_arr);
start_param = param_arr[6];
end_param = param_arr[7];
PackedData packed_data;
packed_data.doubleValue = param_arr[10];
int sense = packed_data.intValues[1];
if(sense == 0)
{
double tmp = start_param * (-1.0);
start_param = end_param * (-1.0);
end_param = tmp;
}
double delta = end_param - start_param;
delta *= 0.01;
for( int i = 0; i <= 100; i++)
{
double t = start_param + delta * i;
double arr[14];
crv_ptr->IEvaluate2( t, 0, arr);
*** print arr[0], arr[1], arr[2] (local codes) *****
}
Now the problem:
I print all the data:arr[0], arr[1], arr[2] returned from crv_ptr->IEvaluate2(t, 0, arr);
The printed loop doesn't match to the face edge. Only the first edge is matched to the edge of the face,
all other edges are not correct.
My guess that the start and end parameters for the curve of the edge are not correct, but review my own hundred times,
I didnt' find anything wrong.
I know the codes are long, but it is quite simple and quite straightforwad.
Could the anyone or board moderator help me?
thank you very much.
john
SolidworksApi macros
I think I have found the problem.
the following code:
CComPtr crv_ptr = NULL;
edge_ptr->IGetCurve(&crv_ptr);
here the crv_ptr is a trimmed curve, I should read the base curve from crv_ptr (crv_ptr->GetBaseCurve). It is strange as the curve returned from edge_ptr->IGetCurve doesn't ovelap with the edge. I don't know whether anyone can give a explanation.
There is very little documents about the edge, curve, base curve.
john