Problem with views position

Hello,

Wy AddIn is using a script that automaticlly creates relative-to-model views of all the bodies in assembly or part.

For each of the bodies it selects two faces (using a loop that searches the biggest face) and creates the view.

I set the x,y position of the view to be (0,0), but somehow it's very often doesn't get to be realy (0,0).

I saw that the view's height is not only the bodies' height, so I set to view.bodies propery to be only the specific body.

This is my code:

view = draw.CreateRelativeView(model.GetPathName, 0, 0, 0, 1)

Dim BodiesIn(0) As DispatchWrapper
BodiesIn(0) = New DispatchWrapper(bodies(0))
view.Bodies = BodiesIn(0)

vPosition(0) = 0
vPosition(1) = 0
view.Position = vPosition

And the result is attached. You can see in the image that I also had automaticlly flat view from sheet metals and it looks good.

I will be thankful for anyone that will help solve it

Cheers,

Bnaya Livne

SolidworksApi macros