Sketch inside View issue - View Origin is Translated along Y axis

Hi,


I am facing an issue while drawing a sketch within a View in the drawing.

The View I have is a top view of an Assembly. My code does the following :


1. Gets the lower left and upper right corners of the assembly.

eg., V1 = -7500,-53,-7500 and V2 = 7500,13,7500  (all parts in the assembly are extruded on the top plane which means they are extruded along Y axis which is why -375 is fixed.)


2. Use these points to draw a diagonal across the top view of the assembly.

((DrawingDoc)swModel).ActivateView("Drawing View7");

SketchManager swSketchMgr = swModel.SketchManager;

SketchSegment swSketchSegment = swSketchMgr.CreateCenterLine(-7500,-7500,0, 7500, 7500, 0);

What I ve noticed while doing this is that the X co-ordinates are actually in line with the assembly boundary co-ordinates but the Y co-ordinate is slightly shifted. The shift is around 583units.

The sketch is drawn correctly if the following co-ordinates are used :

swSketchMgr.CreateCenterLine(-7500,-8083.5,0, 7500, 6916.5, 0);

The snapshots attached explain the situation better .

I ve tried using Model2ViewTransform on the view but that just translates the whole line and is not correct. I am not understanding why the origin of the view and the origin of the assembly are offset along Y by 583. If I draw a sketch at 0,0, it is still not at the center of the view.

Please advise.

Thanks,

Hersh

SolidworksApi macros