Huibert Posted October 3, 2008 Share Posted October 3, 2008 For a new program I am writing i need to get rid of an arc in a 2dpolyline but I want to keep my new polyline of straight line segments close to the original arc. How can I convert an arc into a 3Dpolyline with several straight sections? Quote Link to comment Share on other sites More sharing options...
rocheey Posted October 3, 2008 Share Posted October 3, 2008 For a new program I am writing i need to get rid of an arc in a 2dpolyline but I want to keep my new polyline of straight line segments close to the original arc. How can I convert an arc into a 3Dpolyline with several straight sections? here's a (Non-Intuitive) way straight from Autocad: the FLATTEN command. yes, it works on 2d objects - go figure. Type "Flatten", select your polyline, and when it asks "remove hidden lines?", say "Yes". (Saying YES converts arcs to straight line segments, saying NO "converts" to arcs) Works on splines, as well. Quote Link to comment Share on other sites More sharing options...
fixo Posted October 4, 2008 Share Posted October 4, 2008 Try this one (defun dxf (key alist) (cdr (assoc key alist)) ) (defun C:A2L (/ cnt cpt delta ea elist en ep num osm rad sa sp ss) (setq osm (getvar "osmode")) (setvar "osmode" 0) (command "._undo" "_be") (setq ss (ssget "+.:S:E" (list (cons 0 "ARC")))) (setq en (ssname ss 0) elist (entget en) cpt (dxf 10 elist) rad (dxf 40 elist) sa (dxf 50 elist) ea (dxf 51 elist) num (getint "\nNumber of lines: ") delta (abs(/ (- ea sa) num)) cnt 0) (if (> sa ea) (setq delta (- (/ (* pi 2) num) delta)) ) (while (< cnt num) (setq sp (polar cpt (+ sa (* cnt delta)) rad) ep (polar cpt (+ sa (* (1+ cnt) delta)) rad) ) (command "._line" sp ep "") (setq cnt (1+ cnt)) ) (setvar "osmode" osm) (command "._undo" "_e") (princ) ) (princ "\nStart command with A2L") (princ) ~'J'~ Quote Link to comment Share on other sites More sharing options...
Huibert Posted October 8, 2008 Author Share Posted October 8, 2008 here's a (Non-Intuitive) way straight from Autocad: the FLATTEN command. yes, it works on 2d objects - go figure. Type "Flatten", select your polyline, and when it asks "remove hidden lines?", say "Yes". (Saying YES converts arcs to straight line segments, saying NO "converts" to arcs) Works on splines, as well. Thanks this was exactly what I was looking for! 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.