Tomas Tomas - 1 month ago 6x
C++ Question

Computing offset curve with Teigha 4.1.1

I am struggling with computing a parallel line to the existing line in certain distance.

I have tried:





but all of them trow a "Not implemented" exception.

Than I tried to use a
class. Constructing of this class doesn't throw exception, but any attempt to get a point of this curve does. Same exception: "Not implemented".

So, how can a get a point that lies on the
? Or is there any other way to compute an offset curve?

And what are all those
methods for? Just to throw exceptions?

PS: I do not have enough reputation to create a new Teigha tag. Please, do so and edit my question. Teigha is a core library for developing CAD applications


If i understand correctly you are trying to create a parallel line to an already existing line.

If you not specifically looking for OdGeLine2d , i have a solution for similar problem with OdDbLine. As you already know , to construct a new line if we have its end points rest is play.
So I will help you find end Points of Parallel Line with OdDbLine Class. You can try to derive from it. My code is the .Net version code and not the c++ one.

If you have and object of OdDbLine Class lets say OdDbLine line

  • a) Get its End Points

    OdGePoint3d startPoint = new OdGePoint3d(); line.getStartPoint(startPoint);
    OdGePoint3d endPoint = new OdGePoint3d(); line.getEndPoint(endPoint);

  • Get the line direction, use it to compute perpendicular direction
    OdGeVector3d lineVector = GetLineVector(line); OdGeVector3d perpendicularVec = lineVector.perpVector(); perpendicularVec.normalize(); perpendicularVec = perpendicularVec.Mul(-1);

  • OffSet the Line End Points to calculated offset end points
    Offset value is the numerical distance from your current line perpendicularVec.setToProduct(perpendicularVec, offSetValue);

  • Calculated new End Points Point at Offset Location
    OdGePoint3d newOffsetStartPt = startPoint.Add(perpendicularVec); OdGePoint3d newOffsetEndPt = endPoint.Add(perpendicularVec);

    You can use the new endpoints to construct a new Line.
  • Hope it helps !!