Well, posted a routine not long ago that lets you convert Splines to Polylines. I just found a better routine than the one I posted made by Lee-Mac that lets you convert many types of objects to polylines. It even lets you select a polyline and add more segments to it (as seen with the rectangle in the animated pic)
Here’s how:
- SEGS <enter> to start
- Select objects – Line, Arc, Circle, Ellipse, Rectangle, Polyline, Spline…
- <enter> when finished selecting objects
- Specify # of segments (the more segments the smoother curved objects will look)
;;---------------------=={ Segment Curve }==------------------;;
;; ;;
;; Divides selected objects into an LWPolyline with a ;;
;; specified number of segments of equal length. ;;
;;------------------------------------------------------------;;
;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
(defun c:Segs ( / *error* _StartUndo _EndUndo acdoc ss j ) (vl-load-com)
(defun *error* ( msg ) (and acdoc (_EndUndo acdoc))
(or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
(princ (strcat "\n** Error: " msg " **")))
(princ)
)
(defun _StartUndo ( doc ) (_EndUndo doc)
(vla-StartUndoMark doc)
)
(defun _EndUndo ( doc )
(if (= 8 (logand 8 (getvar 'UNDOCTL)))
(vla-EndUndoMark doc)
)
)
(setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object)) *segs (cond ( *segs ) ( 10 )))
(if
(and (setq ss (ssget "_:L" '((0 . "ARC,CIRCLE,LWPOLYLINE,SPLINE,LINE,ELLIPSE"))))
(progn (initget 6)
(setq *segs (cond ( (getint (strcat "\nSpecify Number of Segments <" (itoa *segs) "> : ")) ) ( *segs )))
)
)
(progn (_StartUndo acdoc)
(repeat (setq j (sslength ss))
(
(lambda ( e / k l i p )
(setq k (/ (vlax-curve-getDistatParam e (vlax-curve-getEndParam e)) (float *segs))
l (entget e)
i -1
)
(repeat (1+ *segs)
(setq p (cons (cons 10 (trans (vlax-curve-getPointatDist e (* (setq i (1+ i)) k)) 0 e)) p))
)
(if
(entmake
(append
(list
(cons 0 "LWPOLYLINE")
(cons 100 "AcDbEntity")
(cons 100 "AcDbPolyline")
(cons 90 (length p))
(cons 38 (last (car p)))
(cons 70 (if (vlax-curve-isClosed e) 1 0))
)
(apply 'append
(mapcar '(lambda ( a ) (if (assoc a l) (list (assoc a l)))) '(6 8 39 48 62 210))
)
p
)
)
(entdel e)
)
)
(ssname ss (setq j (1- j)))
)
)
(_EndUndo acdoc)
)
)
(princ)
)


Pingback: AutoLISP: Make and Save Custom Hatch Pattern | AutoCAD Tips
Thank! Works wonders!
thakz… work easily…..
i am trying segs lisp and i process also done but when i use savehatch commond for creating hatch “Line with invalid angle 235.159428º omitted” error occured with many lines like that.
and process is complete with error.
then, when i apply hatch “Missing parameter on line 2804.” error is occured.
so plz help me how can i draw hatch. (I have to darw hatch for tiles)
Hilarious, thanks a LOT !!!