CreateCornerRectangle() Method help

Good morning all,

The question I have is in regards to the CreateCornerRectangle() method in the SketchManager interface. I can successfully create the rectangle sketch, however, the rectangle created seems to ignore one of my Y coordinate values (almost seems to be snapping to the nearest face on the part in question).

The following lines of code are in questions:

' --------------------------------------

' Ensure no selections are active before selecting the Z = 0 plane (Front Plane) as a sketch plane

'---------------------------------------

swPart.ClearSelection2 True

boolstatus = swModelDocExt.SelectByID2("Front Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)

   

' ---------------------------------------

' Create a new sketch on the now selected plane

' ---------------------------------------

swSketchManager.InsertSketch True

   

' ---------------------------------------

' Create a corner rectangle using the calculated Stock Body dimensions - Function ignore Z values as we are sketching on the Z = 0 plane

' ---------------------------------------

vSkLines = swSketchManager.CreateCornerRectangle(Round(SBDimensions(0), 8), _

                                                                                        Round(SBDimensions(4), 8), _

                                                                                        0, _

                                                                                        Round(SBDimensions(3), 8), _

                                                                                        Round(SBDimensions(1), 8), _

                                                                                        0)                    

' ---------------------------------------

' Finalize sketch

' ---------------------------------------

swSketchManager.InsertSketch True

The values for the SBDimension() are as follows:

  •     : SBDimensions(0) : -0.150000005960464 : Double
  •     : SBDimensions(1) : -0.171043044798851 : Double
  •     : SBDimensions(3) : 0.150000005960464 : Double
  •     : SBDimensions(4) : 0.170000001788139 : Double
  •     I have the Z values for each point set to 0 as I am sketching on the Z = 0 plane (Front Plane)

The problem is, the created rectangle has the following values for the first and second point

Upper Left corner - (-0.15000001, 0.17000000, 0) - This is correct

Lower Right corner - (0.15000000, -0.16990000, 0) - This is incorrect (Y value should be -0.17104304 as per the function definition)

Like I mentioned above, the Y value seems to be snapping coincident to the face of the part in question (when I am trying to sketch a stock body that has an offset (0.045")  from said face) - Is this the likely problem, if so, how can I work around this?

I look forward to any outside opinions on this.

Kind Regards,

Brad

SolidworksApi macros