cadman2009 Posted November 26, 2009 Posted November 26, 2009 Hi I want export information's of a pline by picking it , to an excel file like this : dataxls.gif suppose my pline has coordinates as : 10,10,10 20,20,20 30,10,5 40,30,14 Does anyone has , in this case any information's for me ? Quote
Lee Mac Posted November 26, 2009 Posted November 26, 2009 Excel is possible, but CSV file is much much less coding... is this suitable also? Quote
Lee Mac Posted November 26, 2009 Posted November 26, 2009 I wrote this a while back: http://www.cadtutor.net/forum/showthread.php?t=40632 Quote
cadman2009 Posted November 26, 2009 Author Posted November 26, 2009 Excel is possible, but CSV file is much much less coding... is this suitable also? yes , it is ! Quote
Lee Mac Posted November 26, 2009 Posted November 26, 2009 Try this: ;; Polyline Vertex Exporter ~ by Lee McDonnell ~ 26.11.2009 (defun c:pExp (/ ss tmp i j ent tot dis pt) (vl-load-com) (if (and (setq ss (ssget '((0 . "*POLYLINE")))) (setq tmp (getfiled "Output File" (cond (*load) ("")) "txt;csv" 9))) (progn (setq *load tmp tmp (open tmp "a") i -1) (write-line "Point,X,Y,Z,Distance,Total" tmp) (while (setq ent (ssname ss (setq i (1+ i)))) (setq tot 0. j (1- (vlax-curve-getStartParam ent))) (while (<= (setq j (1+ j)) (vlax-curve-getEndParam ent)) (setq pt (mapcar 'rtos (vlax-curve-getPointatParam ent j))) (write-line (strcat (rtos (1+ j) 2 0) (chr 44) (car pt) (chr 44) (cadr pt) (chr 44) (caddr pt) (chr 44) (rtos (setq dis (- (vlax-curve-getDistatParam ent j) (if (zerop j) 0 (vlax-curve-getDistatParam ent (1- j)))))) (chr 44) (rtos (setq tot (+ dis tot)))) tmp)) (write-line "" tmp)) (close tmp))) (princ)) Quote
cadman2009 Posted November 26, 2009 Author Posted November 26, 2009 I wrote this a while back: http://www.cadtutor.net/forum/showthread.php?t=40632 Dear Lee Hi I check your codes ver 1.0 and 2.0 that you write for stevesfr , those export length of segments but I need coordinates of vertex and length information's together , If this is difficult , at least routine must give me length segment and elevation's of start and end point of them . Quote
cadman2009 Posted November 26, 2009 Author Posted November 26, 2009 Try this: ;; Polyline Vertex Exporter ~ by Lee McDonnell ~ 26.11.2009 (defun c:pExp (/ ss tmp i j ent tot dis pt) (vl-load-com) (if (and (setq ss (ssget '((0 . "*POLYLINE")))) (setq tmp (getfiled "Output File" (cond (*load) ("")) "txt;csv" 9))) (progn (setq *load tmp tmp (open tmp "a") i -1) (write-line "Point,X,Y,Z,Distance,Total" tmp) (while (setq ent (ssname ss (setq i (1+ i)))) (setq tot 0. j (1- (vlax-curve-getStartParam ent))) (while (<= (setq j (1+ j)) (vlax-curve-getEndParam ent)) (setq pt (mapcar 'rtos (vlax-curve-getPointatParam ent j))) (write-line (strcat (rtos (1+ j) 2 0) (chr 44) (car pt) (chr 44) (cadr pt) (chr 44) (caddr pt) (chr 44) (rtos (setq dis (- (vlax-curve-getDistatParam ent j) (if (zerop j) 0 (vlax-curve-getDistatParam ent (1- j)))))) (chr 44) (rtos (setq tot (+ dis tot)))) tmp)) (write-line "" tmp)) (close tmp))) (princ)) Dear LEE this one works completely accurate , special thanks for your cooperation Quote
Lee Mac Posted November 26, 2009 Posted November 26, 2009 Dear LEE this one works completely accurate , special thanks for your cooperation You're welcome Cadman Quote
fixo Posted November 26, 2009 Posted November 26, 2009 HiI want export information's of a pline by picking it , to an excel file like this : dataxls.gif suppose my pline has coordinates as : 10,10,10 20,20,20 30,10,5 40,30,14 Does anyone has , in this case any information's for me ? Here is another one too big but with flowers ~'J'~ PlineImport.LSP Quote
Lee Mac Posted November 26, 2009 Posted November 26, 2009 Impressive Fixo - your knowledge of Excel interface is brilliant Quote
fixo Posted November 26, 2009 Posted November 26, 2009 Impressive Fixo - your knowledge of Excel interface is brilliant Nop unfortunatelly Just a counterpart of VBA ~'J'~ Quote
SteveK Posted November 26, 2009 Posted November 26, 2009 Impressive Fixo - your knowledge of Excel interface is brilliant I second that. I know a bit of vba but how you bring that into lisp I don't get. Trial & error is too error prone. That said, fixo, how does your lisp work? When I select a polyline (lw) nothing happens. Not only that but "Command:" disappears from my command line. Quote
fixo Posted November 26, 2009 Posted November 26, 2009 I second that. I know a bit of vba but how you bring that into lisp I don't get. Trial & error is too error prone. That said, fixo, how does your lisp work? When I select a polyline (lw) nothing happens. Not only that but "Command:" disappears from my command line. This will save pline data into the Excel file in the same folder (just with .xls extension) And also in the table are X, Y and Z values so you need probably test it on 3dpoly ~'J'~ Quote
SteveK Posted November 26, 2009 Posted November 26, 2009 Oh really, now I have to remember where all those drawings are saved I tried it on hehe And actually I'd really like to know how to get "Command:" back? Quote
Lee Mac Posted November 26, 2009 Posted November 26, 2009 Fixo messes with the NOMUTT sys var. :wink: {Fixo, better coding practice to store the old value instead of setting it to what you think it should be } Quote
SteveK Posted November 26, 2009 Posted November 26, 2009 Ta Lee, didn't that was it but it was... "NOMUTT: Suppresses the message display (muttering) when it wouldn't normally be suppressed. Displaying messages is the normal mode, but message display is suppressed during scripts, AutoLISP routines, and so on." Quote
alanjt Posted November 27, 2009 Posted November 27, 2009 Fixo messes with the NOMUTT sys var. :wink: {Fixo, better coding practice to store the old value instead of setting it to what you think it should be } I agree with you, but I think nomutt is an exception. Quote
Lee Mac Posted November 27, 2009 Posted November 27, 2009 I agree with you, but I think nomutt is an exception. I agree that no-one would really set it to 1, but I have seen examples in the past where Fixo sets Sys Vars differently... Quote
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.