I would start by having the User select the boundary Polyline. The routine can find the Circle if it's the last entity, with (entlast), and extract its center from its entity data [do you know how to do that?]. You can use (getdist) to ask for the distance, and (getangle) to ask for the direction, and you can use the Circle's center in the (getangle) function so you get a "rubber-band" line when picking the direction, though you can also just type in a direction as an angle in current Units.
Then I would start a (while) loop. Use (polar), starting from the center and using the direction and angle, to find a potential place to Copy the Circle to. Apply your is-it-inside-the-boundary function to check whether that place is inside, and if so, Copy the last object from its center to the new location. Then the (while) function would step back and try again, checking whether the next potential location, (polar)'d from the previous one, is still within the boundary, and if so, again copying the last object [not the original Circle, after the first Copy] in the same way. When the next potential location fails the test of being inside the boundary, the (while) loop will stop.
Question: The above description is in terms of Circle centers. But if a potential next location is within the boundary, but less than a Circle radius from it, then part of the Circle will extend outside the boundary. Is that acceptable? It could check whether the location at the-distance-plus-the-radius is still inside, before Copying, which would keep the last Circle fully inside the boundary if the direction is approaching the boundary perpendicularly. But with boundary edges at other angles, that test wouldn't always prevent at least some part of a Circle crossing the boundary.
Kent Cooper, AIA