Interior Posted April 17, 2009 Share Posted April 17, 2009 Hi, i was wondering if its is possible to convert a spline into a polyline because obviously you can't pedit i don't want to draw over it as it doesn't create a true solid but mainly because it changes the curve. or just a way to be able to extrude the curve. thank you Quote Link to comment Share on other sites More sharing options...
Came Posted April 17, 2009 Share Posted April 17, 2009 Try Search; http://www.cadtutor.net/forum/search.php?searchid=594961 Quote Link to comment Share on other sites More sharing options...
Organic Posted April 18, 2009 Share Posted April 18, 2009 Try Search; http://www.cadtutor.net/forum/search.php?searchid=594961 No matches found. I was trying to do this the other day (didn't get it either). Quote Link to comment Share on other sites More sharing options...
Cad64 Posted April 18, 2009 Share Posted April 18, 2009 See here: http://www.cadtutor.net/forum/showthread.php?t=9417 I've renamed this thread to something a little more appropriate, since your question really has more to do with converting splines to polylines than it does with extruding. You will notice at the bottom of this page there are now several 'Similar Threads' that relate to your question. Quote Link to comment Share on other sites More sharing options...
Came Posted April 18, 2009 Share Posted April 18, 2009 My apologize, i was doing something else so i get carried away Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 18, 2009 Share Posted April 18, 2009 I found this a while back - might suit you: (defun c:CurvesToSegments(/ cSet sLen cLen sDis ptLst oOsn eLst cAns vCnt lPt) (vl-load-com) (princ "<<< Select curves to transform >>>") (if (setq cSet (ssget '((0 . "*POLYLINE,SPLINE,ARC,CIRCLE,ELLIPSE")))) (if(setq sLen(getdist "\nSpecify segment lentgth: ")) (progn (setq oOsn(getvar "OSMODE")) (setvar "CMDECHO" 0)(setvar "OSMODE" 0) (foreach itm(setq eLst(vl-remove-if 'listp (mapcar 'cadr(ssnamex cSet)))) (setq sDis 0.0 cLen(-(vlax-curve-getDistAtParam itm (vlax-curve-getEndParam itm)) (vlax-curve-getDistAtParam itm (vlax-curve-getStartParam itm))) ); end setq (if(= "LWPOLYLINE"(cdr(assoc 0(entget itm)))) (progn (setq vCnt 1 ptLst(list(vlax-curve-GetPointAtDist itm sDis))) (while(and (<= sDis cLen) (vlax-curve-GetPointAtParam itm vCnt) (setq cPt(vlax-curve-GetPointAtDist itm sDis)) ); end and (if(= 0.0(vla-GetBulge(vlax-ename->vla-object itm)(1- vCnt))) (setq ptLst(append ptLst (list(vlax-curve-GetPointAtParam itm vCnt))) sDis(vlax-curve-GetDistAtParam itm vCnt) ); end setq (progn (while(<= sDis(vlax-curve-GetDistAtParam itm vCnt)) (setq cPt(vlax-curve-GetPointAtDist itm sDis) ptLst(append ptLst(list cPt)) sDis(+ sDis sLen)) ); end while (setq ptLst(append ptLst (list(vlax-curve-GetPointAtParam itm vCnt)))) ); end progn ); end if (setq vCnt(1+ vCnt)) ); end while ); end progn (while(and (<= sDis cLen) (setq cPt(vlax-curve-GetPointAtDist itm sDis)) ); end and (setq ptLst(append ptLst(list cPt)) sDis(+ sDis sLen)) ); end while ); end if (if(not(equal(setq lPt(vlax-curve-getEndPoint itm))(last ptLst))) (setq ptLst(append ptLst(list lPt))) ); end if (command "_.pline")(mapcar 'command ptLst)(command "") (setq ptLst nil) ); end foreach (initget "Yes No") (setq cAns(getkword "\nRemove old curves [Yes/No] <Yes>: ")) (if(or(null cAns)(= cAns "Yes")) (mapcar 'entdel eLst) ); end foreach (setvar "CMDECHO" 1)(setvar "OSMODE" oOsn) ); end progn ); end if ); end if (princ) ); end of c:CurvesToSegments Quote Link to comment Share on other sites More sharing options...
Interior Posted April 19, 2009 Author Share Posted April 19, 2009 Hi what do i do with the code i got as far as saving in notebook? thanks Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 19, 2009 Share Posted April 19, 2009 Save is as a .lsp file, then in AutoCAD, go to load application, or type "appload" at the command line. Load the file that you just saved. Type the syntax at the command line to invoke the command - in this case: CurvestoSegments You can always change the syntax in the LISP file to something you can type easier - like c2s or something. Quote Link to comment Share on other sites More sharing options...
Interior Posted April 20, 2009 Author Share Posted April 20, 2009 Is there a way of making the spline a polyline without it changing the shape? because at the moment its moving the line and changing the position so it move into areas which have set distances is there a way of getting the line to run over where i have it already as a spline? Quote Link to comment Share on other sites More sharing options...
eldon Posted April 20, 2009 Share Posted April 20, 2009 Have you tried the FLATTEN command? Quote Link to comment Share on other sites More sharing options...
fuccaro Posted April 20, 2009 Share Posted April 20, 2009 Or export in dxf R14 format and reimport in AutoCAD Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 20, 2009 Share Posted April 20, 2009 Sounds like a UCS problem, have you tried the code with the UCS set to World? Quote Link to comment Share on other sites More sharing options...
Interior Posted April 21, 2009 Author Share Posted April 21, 2009 I've done all these things repeated times and i can't get anything to place the line in the existing position will in places sit over the line and others places on the line sit correctly. i have tried turning it to world also and this has not helped. what else can i do? Quote Link to comment Share on other sites More sharing options...
gcp310 Posted April 21, 2009 Share Posted April 21, 2009 google spl2pl.lsp its a lisp prog to convert splines to polys and it works great. http://www.dotsoft.com/freestuff.htm Quote Link to comment Share on other sites More sharing options...
Interior Posted April 21, 2009 Author Share Posted April 21, 2009 google spl2pl.lsp its a lisp prog to convert splines to polys and it works great. i can download it but then can't open it any suggestions Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 21, 2009 Share Posted April 21, 2009 If it is a .Vlx file, (which I think it is), you cannot open it. - it is a compiled file. You will need to load it in AutoCAD, and just invoke it as you would a LISP. As it is a compiled file, beware of the source as you do not know what may be in it... Quote Link to comment Share on other sites More sharing options...
Interior Posted April 21, 2009 Author Share Posted April 21, 2009 When i convert to polyline it is not smooth it creates a new line which has ridges and not following the line created originally by the spline. i need it to run the same path as the spline because the stairs etc run to this already and cannot change. any ideas are greatly need as i have to fix it as its my final degree project. thank you Quote Link to comment Share on other sites More sharing options...
Hardney Posted November 26, 2010 Share Posted November 26, 2010 I have tried flatten and it works perfectly!!! Quote Link to comment Share on other sites More sharing options...
barry2104 Posted December 23, 2016 Share Posted December 23, 2016 Hi Lee Mac, this is a nice Lisp, though when i'm not in "world coordinates" but have my crosshairs rotated north/south to suit my drawing, then this Lisp not only breaks a curve into smaller straight polylines, but it also moves and rotates the whole Thing...!? Any idea why, or rather, whether there is a fix for it? I found this a while back - might suit you: (defun c:CurvesToSegments(/ cSet sLen cLen sDis ptLst oOsn eLst cAns vCnt lPt) (vl-load-com) (princ "<<< Select curves to transform >>>") (if (setq cSet (ssget '((0 . "*POLYLINE,SPLINE,ARC,CIRCLE,ELLIPSE")))) (if(setq sLen(getdist "\nSpecify segment lentgth: ")) (progn (setq oOsn(getvar "OSMODE")) (setvar "CMDECHO" 0)(setvar "OSMODE" 0) (foreach itm(setq eLst(vl-remove-if 'listp (mapcar 'cadr(ssnamex cSet)))) (setq sDis 0.0 cLen(-(vlax-curve-getDistAtParam itm (vlax-curve-getEndParam itm)) (vlax-curve-getDistAtParam itm (vlax-curve-getStartParam itm))) ); end setq (if(= "LWPOLYLINE"(cdr(assoc 0(entget itm)))) (progn (setq vCnt 1 ptLst(list(vlax-curve-GetPointAtDist itm sDis))) (while(and (<= sDis cLen) (vlax-curve-GetPointAtParam itm vCnt) (setq cPt(vlax-curve-GetPointAtDist itm sDis)) ); end and (if(= 0.0(vla-GetBulge(vlax-ename->vla-object itm)(1- vCnt))) (setq ptLst(append ptLst (list(vlax-curve-GetPointAtParam itm vCnt))) sDis(vlax-curve-GetDistAtParam itm vCnt) ); end setq (progn (while(<= sDis(vlax-curve-GetDistAtParam itm vCnt)) (setq cPt(vlax-curve-GetPointAtDist itm sDis) ptLst(append ptLst(list cPt)) sDis(+ sDis sLen)) ); end while (setq ptLst(append ptLst (list(vlax-curve-GetPointAtParam itm vCnt)))) ); end progn ); end if (setq vCnt(1+ vCnt)) ); end while ); end progn (while(and (<= sDis cLen) (setq cPt(vlax-curve-GetPointAtDist itm sDis)) ); end and (setq ptLst(append ptLst(list cPt)) sDis(+ sDis sLen)) ); end while ); end if (if(not(equal(setq lPt(vlax-curve-getEndPoint itm))(last ptLst))) (setq ptLst(append ptLst(list lPt))) ); end if (command "_.pline")(mapcar 'command ptLst)(command "") (setq ptLst nil) ); end foreach (initget "Yes No") (setq cAns(getkword "\nRemove old curves [Yes/No] <Yes>: ")) (if(or(null cAns)(= cAns "Yes")) (mapcar 'entdel eLst) ); end foreach (setvar "CMDECHO" 1)(setvar "OSMODE" oOsn) ); end progn ); end if ); end if (princ) ); end of c:CurvesToSegments Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.