SelectionMgr:: GetSelectedObject6 returns null

Hi All!

I was trying to get/hold of a pre-created SketchPoint in a 3D sketch, but my code keeps on returning null.

Can somebody tell me what am I missing here please?

Here`s my code snippet....

ModelDoc2 modelDoc = (ModelDoc2)swApp.ActivateDoc2(comp.GetPathName(), true, ref error); // Open part doc

modelDoc.Extension.SelectByID2("SkechCLine", "SKETCH", 0, 0, 0, false, 0, null, 0);
modelDoc.EditSketch();

modelDoc.Extension.SelectByID2("Point31", "SKETCHPOINT", 0, 0, 0, false, 0, null, 0); // This code works, the point was selected in SW
SelectionMgr selMngr = (SelectionMgr)modelDoc.SelectionManager;
SketchPoint sktPoint = (SketchPoint)selMngr.GetSelectedObject6((int)swSelectType_e.swSelSKETCHPOINTS, -1);

Output:

sktPoint = null

Please help!

Thanks in advance.

Best Regards,
Joecel

SolidworksApi macros