I'm trying to create a new sketch in the same place as an existing sketch.
I load my part file that has the existing sketch. When I steer the UI manually and record a macro, I get a new sketch. Great. The macro code is:
boolstatus = swDoc.Extension.SelectByID2("", "FACE", -0.033904711444620261, 0.0099999999998772182, 0.022619867741582311, false, 0, null, 0);
If I put that exact code into my C# Addin, starting from the same part file as before, triggered from my UserPMPage, SolidWorks does not create a new sketch. Instead, it puts me into editing the sketch that is already there. How can I make it behave the same as the macro code?
I have tried many things: AddToDB true vs. false, arg to InsertSketch true vs false, shifting the AddIn code all over with respect to the event (OnButtonPress(), OnClose(), AfterClose(), etc.) The AddIn never gives me a new sketch like I want.
For now, the only thing I've found is to create the new sketch in some other place, then move it to the same face as the existing sketch. When I try this, I run into problems with different behavior whether or not my PropertyManagerPage is created with swPropertyManagerOptions_LockedPage. Without that, I can move the sketch but my PMPage closes on its own for some reason I cannot discover. If I use _LockedPage, then I get a failure in the selection call that I need to do in order to move the sketch.
Thanks for any help