SelChain is a command, see (about halfway down the page). While running GetObject this can be called using
RhinoApp.RunScript, as it is a transparent command.
What you can do from code to emulate this is different whether it is curves or surface edges that are being selected. For curves, you could do the following pseudo code:
GetObject go = new GetObject()
crv = go.Object().Curve()
Point3d start = crv.PointAtStart;
Point3d end = crv.PointAtEnd;
List<Curve> allCurves = GetAllCurvesFromDocument(); // todo: implement this
allCurves.Remove(crv); // you may need to test object id's
List<Curve> adjacent = GetAllAdjacentCurves(allCurves, start, end, doc.ModelAbsoluteTolerance); // todo: implement this, it should return curves from the all-curves list that have their start or end point at the given 'start' or 'end' point
while(adjacent.Count > 0 && allCurves.Count > 0)
crv = JoinCurves(crv, adjacent, doc.ModelAbsolutTolerance); // todo: implement this, or call Intersection.JoinCurves directly
if (null == crv) break; // failed to join
start = crv.PointAtStart;
end = crv.PointAtEnd;
adjacent = GetAllAdjacentCurves(alLCurves, start, end, doc.ModelAbsoluteTolerance);
// crv is now a (possibly) circular poly-curve.
// in principle, for G0 continuity, this last bit is not necessary, but for G1+ continuity it is.
double t0 = crv.Domain.T0;
double t1 = crv.Domain.T1;
while(crv.GetNextDiscontinuity(Continuity.C0_continuous, t0, t1, out t))
t0 = t;
Curve c0_continuous = crv.ToNurbsCurve(new Domain(crv.Domain.T0, t0));
This code probably contains some errors; I haven’t tested the code, but the idea should be clear.
For surface edges, you can walk the BRep object model using edges and vertices. See http://developer.rhino3d.com/guides/cpp/brep-data-structure/ for more information.