I don't think this will work, except maybe under extraordinary-coincidence
circumstances. I am assuming "cen" means the center point of the circle and
"rad" is its radius. I am also assuming that jbrant4 wants to find where
the hypothetical line would intersect the CURVE of the hypothetical circle
(like INT osnap).
(inters) takes four points and finds where the "first" hypothetical line
(between the 1st & 2nd points) would intersect the "second" line (between
the 3rd and 4th). [Of course no actual lines need to be involved, just as
jbryant4's line and circle are not entities in the drawing.] David's
routine makes that "second" line a radius of the circle, whose direction is
perpendicular to the "first" line. But that radius line won't intersect the
"first" line where the "first" line intersects the circle itself, unless it
happens to hit at exactly the right spot at the outside end of that radius.
Simple example: p1 is at 0,0, p2 is at 4,0, the center of the circle is at
1,0, and its radius is 2. The line is horizontal, and happens to pass
through the center of the circle for simplicity of visualization. The line
and circle intersect at 3,0. This routine will look for the intersection
point between four points: 0,0 4,0 1,0 1,2 (the end of the radius at 90
degrees from the direction of the line). That will return 1,0, which
happens to be the center of the circle, and one end of that "second" line,
but not where the line and circle intersect.
If the line happened to be horizontal along the 2 level in the y direction,
it would happen to give the right answer.
I don't see a way to do what I think jbryant4 wants, except maybe to convert
the line and circle into equations representing them, and solve the
simultaneous equations for an intersection. I don't know if you can do that
in any of the languages available for AutoCAD customization, but I assume
something like that is what (inters) does, so maybe someone out there has an
idea. It's just a lot more complicated with the circle involved, but I
guess INT and APPINT osnap must do it somehow.