rodrigomachado Posted December 12, 2014 Posted December 12, 2014 Hello guys, First I would like to thank you for this very useful forum. You've been helping me a lot. But now I need a lisp that export the measure of each polyline's segment to excel. Something like the picture attached. Thanks! Quote
BIGAL Posted December 12, 2014 Posted December 12, 2014 Pretty sure lee-mac.com has a routine that will do this. Quote
rodrigomachado Posted December 15, 2014 Author Posted December 15, 2014 I've found there, but that routine has more than what I want. I'd like one with just the Length of the segment. And, if possible, something that can select more polylines for the table, like the image attached before. Quote
Tharwat Posted December 15, 2014 Posted December 15, 2014 You want to export these segments' values or to select polylines and export each segment alone in a separate cell as shown in the Excel sheet ? What about that L1 and L2 ? are they already existed or you want to name the exported polylines to have a reference of each row of value to its polyline ? Quote
rodrigomachado Posted December 15, 2014 Author Posted December 15, 2014 You want to export these segments' values or to select polylines and export each segment alone in a separate cell as shown in the Excel sheet ? What about that L1 and L2 ? are they already existed or you want to name the exported polylines to have a reference of each row of value to its polyline ? I want with each segment alone, like the Excel sheet. About the L1 and L2, they are just an example. For what I need, can be just a numeration in the order of each polyline selected, starting with 1. Quote
Tharwat Posted December 16, 2014 Posted December 16, 2014 Give this a shot and let me know . (defun c:Test (/ *error* ss f o i l n in sn lst a d st) ;;; Author : Tharwat 16.Dec.2014 ;;; ;;; Write Polylines' segments to Excel ;;; ;;; ;;; (defun *error* (x) (if o (close o) ) ) (princ "\n Select Polyline :") (if (and (setq ss (ssget '((0 . "LWPOLYLINE")))) (setq f (getfiled "\n Save as :" (getvar 'DWGPREFIX) "csv" 1)) ) (progn (setq o (open f "w") i 0 l 0. n 0 ) (write-line "Ref No." o) (repeat (setq in (sslength ss)) (repeat (fix (vlax-curve-getendparam (setq sn (ssname ss (setq in (1- in)))) ) ) (setq d (vlax-curve-getdistatparam sn (setq i (1+ i)))) (if (< 0. l) (setq lst (cons (setq a (- d l)) lst)) (setq lst (cons d lst)) ) (if a (setq l (+ l a)) (setq l (+ l d)) ) ) (entmake (list '(0 . "TEXT") (setq st (assoc 10 (entget sn))) (cons 11 (cdr st)) (cons 40 (getvar 'TEXTSIZE)) (cons 1 (itoa (setq n (1+ n)))) (cons 7 (getvar 'TEXTSTYLE)) ) ) (write-line (apply 'strcat (mapcar '(lambda (x) (strcat (rtos x 2 2) ";")) (append (list n) lst) ) ) o ) (setq lst nil i 0 l 0. ) ) (close o) ) ) (princ) )(vl-load-com) 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.