How to convert any spline to pline? Anyone can help me? Thanks very much in advanced.
|
How to convert any spline to pline? Anyone can help me? Thanks very much in advanced.
Hi ttaahhhh,
Test this code
Code:(defun massoc (key alist / x nlist) ; Jaysen Long (foreach x alist (if (eq key (car x)) (setq nlist (cons (cdr x) nlist)) ) ) (reverse nlist) ) (defun c:test (/ cmt len sp ss sse) (if (setq ss (car (entsel "\nSelect an object spline"))) (progn (setq sse (entget ss)) (setq sp (massoc 10 sse)) (setq len (length sp)) (setq cmt 0) (repeat len (command "_pline" (nth cmt sp)(nth (1+ cmt) sp) "") (setq cmt (1+ cmt)) ) ; repeat (command "_erase" ss "") ) ; progn (alert "\nInvalid selected object,try again") ) ; if (princ) )
Other way to do .
Code:(defun C:spltopl () (while (not (and (setq lstSelection (entsel "\nSelect Spline: ")) (setq sngSegment (getdist "\nGet Segment Length: ")) (setq objSelection (vlax-ename->vla-object (car lstSelection))) (wcmatch (vla-get-objectname objSelection) "AcDb2dPolyline,AcDbPolyline,AcDbLine,AcDbArc,AcDbSpline" ) ) ) (princ "\nError please select again: ") ) (setq sngLength (vlax-curve-getDIstAtParam objSelection (vlax-curve-getEndParam objSelection) ) sngDistance 0.0 ) (vl-cmdf "._pline" (vlax-curve-getpointatDist objSelection 0.0)) (repeat (fix (/ sngLength sngSegment)) (vl-cmdf (vlax-curve-getpointatDist objSelection sngDistance)) (setq sngDistance (+ sngDistance sngSegment)) ) (vl-cmdf (vlax-curve-getPointAtParam objSelection (vlax-curve-getEndParam objSelection) ) "" ) )
Last edited by Opie; 2007-08-27 at 02:42 PM. Reason: [CODE] tags added
thanks all .
just find a link:http://forum.arkitera.com/autocad/58...-cevirmek.html
You could use explode on the spline, and pedit to join all segments.
oops, I was looking at a polyline with spline applied by pedit and not one made with the spline command.
I wonder what the diiference is between the two.