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 the answer to @3wood's question is that you would want all line segments the same length, which should not be more than 0.1 drawing units, but may be slightly shorter to divide equally and prevent a much-shorter one at the end, try this:

 

(defun C:A2PL ; = Arc(s) {to} Polylines of all Line segments
  (/ maxseg ss n arc len segs seglen inc)
  (setq maxseg (getdist "\nMaximum segment 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 maxseg)
        segs (+ (fix segs) (if (equal (rem len maxseg) 0 1e-4) 0 1))
        seglen (/ len segs)
        inc 0
      ); setq
      (command "_.pline" "_non" (vlax-curve-getStartPoint arc) "_width" 0 0)
      (repeat segs
        (command "_non" (vlax-curve-getPointAtDist arc (* seglen (setq inc (1+ inc)))))
      ); repeat
      (command "")
      (entdel arc)
    ); repeat
  ); if
  (princ)
); defun
(vl-load-com)

 

It could have the 0.1 unit maximum segment length built in, rather than ask for it, if you always use the same.  And it could have the other usual enhancements, but first see whether it does what you want.

Kent Cooper, AIA