SketchConstraintsDel not working

Hi!

I'm using ModelDoc2::SketchConstraintsDel to delete a 'sgATINTERSECT' of a CenterPoint.

Here is my code snippet:

    

     currCntrPt.Select2(false, -1);

     modelDoc.SketchConstraintsDel(0, "sgATINTERSECT");

My code is able to select the currCntrPt in Solidworks, but the constraint was not deleted after the 2nd line was executed.

Weird thing is, when I try to re-execute the code during the debug-mode, it will work properly on the 2nd time.

There is also an entity which the deletion is not working for the 1st and 2nd execution but will work for the 3rd time.

What is the possible cause of this problem?

I'm thinking of refreshing the sketch first before the selection of currCntrPt, but is there a way to refresh it w/o exiting the Sketch?

Hoping someone could help.

Thanks in advance!

Best Regards,

J.Torres

SolidworksApi macros