I am trying to draw an EllipticArc (or any other Segment for that matter) in my Dynamic Layer using the ArcObjects C++ API. For something that seems like it should be straightforward, I am having a very hard time figuring it out. So far I have taken these steps:

  1. Create the EllipticArc itself. I have confirmed that I have created one and that its geometry is correct.
  2. Cast the EllipticArc to a PointCollection so it may be drawn by DynamicDislay.

The problem seems to be that the PointCollection I create contains 0 points, and I am not sure how to solve this problem.

Here is what I have so far:

PointCollection4Ptr  finalform(CLSID_Polyline);
IConstructEllipticArcPtr arcCon(CLSID_EllipticArc);

/*Code to construct arc omitted, it was rather lengthy.
  I have confirmed that the arc was correctly constructed 
  and that the object exists*/

IEllipticArcPtr arc = arcCon;   

//Cast to a PointCollection so we can draw it
IPointCollection4Ptr    pointcol = arc;     


std::cout<<"before pointcount\n";
long pc;
std::cout<<"after pointcount\n";


The code outputs that the pointcount is 0.

Am I completely missing something here? I feel like this should be straightforward, but I have had no luck drawing any Segment on my Dynamic Layer. How is this supposed to be done? Can it be done? Is there a solution for drawing Segments on non-dynamic layers that I will have to use? (I hope not...)

Any input is appreciated!


Your problem is that the EllipticArc class is not an IPointCollection4 (or any type of point collection...). You can see the list of interfaces that an EllipticArc is here.


IConstructEllipticArcPtr arcCon(CLSID_EllipticArc);

This instantiates arcCon as an EllipticArc.

IEllipticArcPtr arc = arcCon;

Casts arcCon to an IEllipticArcPtr but arc is still an EllipticArc object.

IPointCollection4Ptr pointcol = arc;

I bet if you printed out the point count of pointcol here you would get 0 since arc can't really be cast to a IPointCollection4.


You should cast your EllipticArc to an ISegment, create a segment collection polyline, and draw the segment collection:

ISegmentPtr seg = arcCon;

ISegmentCollectionPtr segCol(CLSID_Polyline);


Not guaranteed to be free of syntax errors, but this is the path you should go down.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.