I am having a problem that should be a simple task but not sure what I am doing wrong, working in .NET C#. All I am trying to do is create a line and constrain it to the origin, I can select the origin alright but I can't seem to get the end point of the line to select.
ModelDoc2 modelDoc = (ModelDoc2)sldWorks.ActiveDoc;
SketchManager skMgr = modelDoc.SketchManager;
SketchSegment originLine = skMgr.CreateLine(0, 0, 0, 20, 0, 0);
originLine.ConstructionGeometry = true;
SketchPoint orginStPnt = (SketchPoint)(originLine as SketchLine).GetStartPoint2();
bool resultStPnt = orginStPnt.Select4(true, null);
bool resultOrigin = modelDocEx.SelectByID2("Point1@Origin", "EXTSKETCHPOINT", 0, 0, 0, true, 0, null, 0);
But the resultStPnt is always false, not sure what is going on. I have used the SketchPoint.Select4 in various other functions like with a spline and the select seems to work but for some reason this is not. Is there a better way of doing this?
*** Update ***
I decided to check if this was a .NET issue and looks like it may be unless I need to do something else in the code. I wrote a quick VBA Macro with the same functions as above and things seem to work fine.
Dim resultStPnt As Boolean
Dim pntStart As SketchPoint
Dim originLine As SketchSegment
Set originLine = Part.SketchManager.CreateLine(0, 0, 0, 20, 0, 0)
resultStPnt = pntStart.Select4(False, Nothing)
resultStPnt is true now, any ideas what's going on?