Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Kent1Cooper
en respuesta a: Anonymous

If, on the other hand, you want results as in @3wood 's image, with whatever shorter-length piece is left over at one end, this will do that:

 

(defun C:A2PL ; = Arc(s) {to} Polylines of all Line segments
  (/ seglen ss n arc len segs inc)
  (setq seglen (getdist "\nSegment length: "))
  (prompt "\nTo convert Arc(s) to Polyline(s) of Line segments,")
  (if (setq ss (ssget "_:L" '((0 . "ARC"))))
    (repeat (setq n (sslength ss))
      (setq
        arc (ssname ss (setq n (1- n)))
        len (getpropertyvalue arc "length")
        segs (/ len seglen)
        segs (+ (fix segs) (if (equal (rem len maxseg) 0 1e-4) 0 1))
        inc 0
      ); setq
      (command "_.pline" "_non" (vlax-curve-getStartPoint arc) "_width" 0 0)
      (repeat (1- segs)
        (command "_non" (vlax-curve-getPointAtDist arc (* seglen (setq inc (1+ inc)))))
      ); repeat
      (command (vlax-curve-getEndPoint arc) "")
      (entdel arc)
    ); repeat
  ); if
  (princ)
); defun
(vl-load-com)

 

But bear in mind that it measures the specified distance between vertices along the curve of the Arc, which means that the resulting Polyline line segments are chords and therefore slightly shorter [how much shorter depends on the radius of the Arc] -- here with a specified distance of 1 drawing unit:

Kent1Cooper_0-1626783167554.png

If it's important for the line segments to be exactly the specified length, that could be calculated based on the radius.

Kent Cooper, AIA