Difference between LineParams and CurveParamData

Hi guys,

when you are going to request the coordinates of a specific edge how do approach?

I know this two different ways:

  1. Request the CurveParamData from the specific edge with GetCurveParams3 and check the Start- and the Endpoint
  2. Request the Curve of the specific Edge and check the LineParams (if it is a line)

What iriitates me is that results are different when I compare both.
Does it makes sense for you?


Here’s my code:

this.edge = edge;
curve = (Curve)edge.GetCurve();

CurveParamData data = edge.GetCurveParams3();
double[] endpoint = (double[])data.EndPoint;
double[] startpoint = (double[])data.StartPoint;

 if(data.CurveType == (int)swCurveTypes_e.LINE_TYPE)
    startpointX = startpoint[0];
    startpointY = startpoint[1];
    startpointZ = startpoint[2];
    endpointX = endpoint[0];
    endpointY = endpoint[1];
    endpointZ = endpoint[2];

if (curve.IsLine())
    double[] lineParams = (double[])curve.LineParams;
    xRootpoint = lineParams[0];
    yRootpoint = lineParams[1];
    zRootpoint = lineParams[2];
    xDirection = lineParams[3];
    yDirection = lineParams[4];
    zDirection = lineParams[5];

Just tagging these people @artem @nilesh @Jacob

It took me a while to understand the printout. So you have printed the coordinates of three random edges? Can you include your full code, including the printing?

It usually helps me to use non-random numbers so you can spot patterns faster.

Are you working with an assembly or drawing perhaps? That there is a transformation in between the two methods?

Oh, I am sorry for the misunderstandings:

I am working in a drawing. I have a view where I need to filter all the visible edges of a part to find the right spot for attaching a welding symbol. To Filter and to set the attachment point for the welding symbol I’ve tried to request the coordinates of the edges. With a foreach-loop I am retrieving these coordinates of every visible edge. To get the coordinates I know the two ways which I’ve described in the text on top. I was wondering why I wasn’t able to get the edge which I wanted to.
The print out on top is - like you said - the result of the coordinates of 3 edges. I’ve requested the coordinates of the points of the edges in two different ways and that is wat irritates me - the results are different…

With the property LineParams of the Interface ICurve I requested an array of 6 doubles with the values rootPoint in X, Y, Z and Direction in X, Y, Z.
(LineParams Property (ICurve) - 2020 - SOLIDWORKS API Help)

With GetCurveParams3 and the received CurveParamData-object I’ve got the access to the property of the start- and endpoint.
(ICurveParamData Interface Members - 2020 - SOLIDWORKS API Help)

In my understanding the root point of the curve should be similar to the start- or the endpoint of that curve. Or did I miss here something?

If it’s possible. Can you put together a minimal viable example:

  • macro to replicate the issue.
  • file to run the macro on.


1 Like

Not necessarily. Your ICurve might be untrimmed (e.g. infinite), that is why you do not have end point in ILineParams so LineParams really defines a vector of the line, to find end points you need to check if ICurve::IsTrimmedCurve, if so you can ICurve::GetEndParams and ICurve::Evaluate at both ends to find the coordinates. If curve is not trimmed your end params will be -1000 and 1000 for line and it will not match the end coordinates of your edge so in this case you need to find end params from the edge (but ICurve returned from IEdge should be trimmed unlike the ICurve returned from ISketchSegment). If your curve is trimmed (should be your case) then end params will be 0 and 1 and when you evaluate at these params you should get exact same coordinates as you have in ICurveParamData

Check this example for some reference.


Hey Artem, thanks a lot for that update! :+1: :ok_hand:

1 Like