automated tangent lines

I'm trying to make a macro that takes the two selected arcs and creates a line thats tangent to both, and the start and end points are coincident to the arcs.  I'm having some trouble with the getselectedobjects(n) property.

     I'm guessing it would work something like this:

          set obj1 = selmgr.getselectedobject5(1)

          set obj2 = selmgr.getselectedobject5(2)

          sksegment = createline( x1,y1,z1,x2,y2,z2 )

          clearselectedobjects

         

          seldata = createselectdata

          obj1.select4(true,seldata)

          sksegment.select4(true,seldata)

          sketchaddconstraints("sgtangent")

         

          clearselectedobjects

         

          obj2.select4(true,seldata)

          sksegment.select4(true,seldata)

          sketchaddconstraints("sgtangent")

          clearselectedobjects

         

          obj1.select4(true,seldata)

          [select start point of line]

          sketchaddconstraints("sgcoincident")

          clearselectedobjects

         

          obj2.select4(true,seldata)

          [select end point of line]

          sketchaddconstraints("sgcoincident")

         

          clearselectedobjects

          end

I can't seem to select the arcs that I saved into obj1 and obj2.  Select4 isn't working after I create the line.

SolidworksApi macros