AutoCAD Architecture Forum
Welcome to Autodesk’s AutoCAD Architecture Forums. Share your knowledge, ask questions, and explore popular AutoCAD Architecture topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to transform a spline into a polyline with Autocad 2009?

2 REPLIES 2
Reply
Message 1 of 3
mila_08_807
2883 Views, 2 Replies

How to transform a spline into a polyline with Autocad 2009?

Hi,

 

I am a student and I am trying to transform a spline into a polyline with the AutoCAD 2009 that with have at Uni for the CNC machine but "pedit" doesn't work, what should I do?

2 REPLIES 2
Message 2 of 3
Mike.Lamka
in reply to: mila_08_807

You can't turn a pline into a polyline.  If you start with a polyline then you can use pedit to turn it into a spline and back a ployline.  I would suggest to always avoid using splines unless you absolutely must.

Message 3 of 3
pendean
in reply to: mila_08_807

Spline to Pline:


1. WMFOUT and WMFIN, then rescale.


2. Express Tools, Flatten


3. SPL2PL.VLX at http://www.dotsoft.com/freestuff.htm


4. Save the drawing as an R12 DXF. If the spline has been converted to a 3D polyline, Use the EXPLODE command on the 3D polyline, which will turn it into line objects.
Use the PEDIT command, and select one of the lines. At the prompt to convert this to a polyline, select Yes.
Select Join and then select the remaining lines. You should now have a 2D polyline approximation of the spline.


5. R2010 and higher, try PEDIT, select the SPline, convert to Pline (current AutoCAD versions are totally free to qualified students, why are you stuck in R2009?)


6. Use this Lisp, revised to work in rotated UCS:


(defun c:Spline2Pline (/ *error* OSM OBJ SS FPT LPT
PTLST TPTLST OBJPTLST PT PTNAME DIV)
(defun *error* (Msg)
(cond
((or (not Msg)
(member Msg '("console break"
"Function cancelled"
"quit / exit abort"
)
) ;close member
) ;close or
) ;closes condition, no message to display
((princ (strcat "\nError: " Msg))) ;else display message
) ;close cond
(setvar "osmode" OSM)
(setvar "cmdecho" 1)
(princ)
) ;end error

(defun massoc (key alist / x nlist)
(foreach x alist
(if (eq key (car x))
(setq nlist (cons (cdr x) nlist))
)
)
(reverse nlist)
) ;end

;start
(setvar "cmdecho" 0)
(setq OSM (getvar "osmode"))
(setvar "osmode" 0)

(initget 7)
(setq DIV (getint "\nEnter number of polyline segments: "))
(setq OBJ (car (entsel "\nSelect spline: ")))
(while
(or
(null OBJ)
(/= "SPLINE" (cdr (assoc 0 (entget OBJ))))
) ;or
(setq OBJ (car (entsel "\nSpline not selected - try again...")))
) ;while

(setq OBJPTLST (massoc 11 (entget OBJ))) ;spline fit points
(setq FPT (car OBJPTLST)) ;first point
(setq LPT (last OBJPTLST)) ;last point
(command "_divide" OBJ DIV)
(setq SS (ssget "p"))
(while (> (sslength SS) 0)
(setq PTNAME (ssname SS 0))
(setq PT (cdr (assoc 10 (entget PTNAME))))
(setq PTLST (cons PT PTLST))
(ssdel PTNAME SS)
(entdel PTNAME)
) ;while
(setq PTLST (reverse PTLST))
(setq PTLST (cons FPT PTLST)) ;add first point
(setq PTLST (append PTLST (list LPT))) ;add last point
(foreach x PTLST ;rotated UCS
(setq TPTLST (cons (trans x 0 1) TPTLST)))
(command "_pline" (foreach p TPTLST (command p)))
(command)
(entdel OBJ)
(*Error* nil)
(princ)
) ;end

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost