I think the problem is that CreateLine2 is using the drawing coordinates and you are giving it the view coordinates (or vice versa).
When I attempted this a while back, I ended up just building a transform from view sketch to drawing sketch coordinates because I couldn't figure out which API-provided transforms to use.
Thanks your tips.
Question is using the drawing coordinates and you are giving it the view coordinates?
Just follow these steps and you shall get the correct results: -
- Get Point from vertex (as you are currently doing).
- Use ModelToViewTransform to transform this point to the view space. (Multiple vertex point with ModelToViewTransform)
- Get the Sketch of the view (using view::GetSketch()).
- Get ModelToSketchTransform for this Sketch.
- Use ModelToSketchTransform to transform point (generated in step 2) to the sketch space. (Multiply point generated in step 2 with ModelToSketchTransform).
- Activate the sheet.
- Activate the view.
- create your spline.