@robert06 wrote:
....
I'd like to get polyline segment radius as an argument by picking the segment of polyline or arc
....
Here's the command I've used for years:
(defun C:RAD (/ pt); report RADius of curve
; [e.g. Polyline Arc segment, whose radius does not appear in Properties box or List result]
(setq aper (getvar 'aperture))
(while
(not (setq pt (cadr (entsel "Select curve: "))))
(prompt "\nNothing selected -- ")
); end while
(setvar 'aperture (getvar 'pickbox))
(if (osnap pt "cen")
(prompt (strcat "\nRadius is " (rtos (distance (osnap pt "nea") (osnap pt "cen"))) "."))
(prompt "\nNo radius for that object.")
); end if
(setvar 'aperture aper)
(princ)
)
You could have it not just report the radius, but also save it to a variable:
....
(if (osnap pt "cen")
(prompt (strcat "\nRadius is " (rtos (setq rad (distance (osnap pt "nea") (osnap pt "cen")))) "."))
(prompt "\nNo radius for that object.")
); end if
....
It works on not only Circles, Arcs, and Polyline arc segments, but even edges of 3DSolids and Regions that were generated from those, and the dimension-line arcs of angular Dimensions [as if you'd ever want to know the radius of one of those...]. And it rejects fit-curved or spline-curved Polylines. However, it will also report a "radius" for an Ellipse, which will vary depending on where you pick it. I have a way to prevent that, worked out in a different routine, that I haven't incorporated into this one yet, but some time soon....
Kent Cooper, AIA