Rabindra Bhatta Posted September 23 Posted September 23 (edited) hello there, Can anyone please provide me a lisp file that provides polyline vertices respective distance and there vertices. i have desired level at a point and it will be used as reference level for the polyline vertices. The data then need to be required to exported to excel. Please kindly help. the data should be in 0,100 2,101 5,110 Edited September 23 by Rabindra Bhatta Quote
devitg Posted September 23 Posted September 23 1 hour ago, Rabindra Bhatta said: hello there, Can anyone please provide me a lisp file that provides polyline vertices respective distance and there vertices. i have desired level at a point and it will be used as reference level for the polyline vertices. The data then need to be required to exported to excel. Please kindly help. the data should be in 0,100 2,101 5,110 @Rabindra Bhatta, please upload your sample dwg , included te block or whatever is the triangle and 98.00 , and xls sample to be used 1 Quote
BIGAL Posted September 24 Posted September 24 I thought posted a reply on my phone at moment look for surface rl.lsp by me does 1 point but simple fix for multiple points CIVIL SITE DESIGN does this as a report for all chainages XYZ 1 Quote
Rabindra Bhatta Posted September 25 Author Posted September 25 @devitg I have attached the file. As i have many such polyline with reference level about 100. I have tried to do it manually by providing distance and level as shown in drawing. it is taking me too much time to do the work as i have to provide dimension and then level after that i have to write it manually to excel. It would be a kind help sir, if you can provide me a lisp file to do the work. Drawing2.dwg Quote
Tsuky Posted September 25 Posted September 25 Hi, Try this, you can select muliples polylines for export result to Excel (I have add the handle of entitie in Excel for find in drawing) (vl-load-com) (defun WriteExcel (data / xlApp wBook cells i j) (setq xlApp (vlax-create-object "Excel.Application") wBook (vlax-invoke-method (vlax-get-property xlapp 'WorkBooks) 'Add) cells (vlax-get-property xlApp 'Cells) i 0 ) (foreach row data (setq i (1+ i) j 0) (foreach val row (setq j (1+ j) cell (vlax-variant-value (vlax-get-property cells 'Item i j)) ) (vlax-put-property cell 'Value2 val) ) ) (vlax-invoke-method (vlax-get-property (vlax-get-property xlApp 'ActiveSheet) 'Columns ) 'AutoFit ) (vlax-put-Property xlApp 'Visible :vlax-true) ) (defun c:Pline_Level ( / ss n ename dxf_ent hndl pr flag e_line dxf_10 dxf_11 ptdef_z ss_t z_text pt_start pt_end seg_len dlt_z pt_z data) (princ "\nSelect polylines.") (while (null (setq ss (ssget '((0 . "LWPOLYLINE"))))) (princ "\nSelection is empty, or aren't POLYLINES!") ) (repeat (setq n (sslength ss)) (setq ename (ssname ss (setq n (1- n))) dxf_ent (entget ename) hndl (cdr (assoc 5 dxf_ent)) pr -1 flag T ) (redraw ename 3) (while flag (while (not (setq e_line (entsel "\nSelect line for reference for highlight polyline: ")))) (cond ((eq (cdr (assoc 0 (entget (car e_line)))) "LINE") (setq dxf_10 (cdr (assoc 10 (entget (car e_line)))) dxf_11 (cdr (assoc 11 (entget (car e_line)))) ) (if (equal (cadr dxf_10) (cadr dxf_11) 1E-13) (setq flag nil ptdef_z (cadr dxf_10)) (progn (princ "\nThe line is not horizontal") (setq flag T)) ) ) (T (princ "\nIsn't a line") (setq flag T)) ) ) (princ "\nSelect Text/MText") (while (not (setq ss_t (ssget "_+.:E:S" '((0 . "*TEXT")))))) (setq z_text (atof (cdr (assoc 1 (entget (ssname ss_t 0))))) seg_len 0.0 ) (repeat (fix (vlax-curve-getEndParam ename)) (setq pt_start (vlax-curve-GetPointAtParam ename (setq pr (1+ pr))) pt_end (vlax-curve-GetPointAtParam ename (1+ pr)) dlt_z (- (cadr pt_start) ptdef_z) pt_z (+ z_text dlt_z) data (cons (list hndl (atof (rtos seg_len 2 4)) (atof (rtos pt_z 2 2))) data) seg_len (abs (- (car pt_end) (car pt_start))) ) ) (setq dlt_z (- (cadr pt_end) ptdef_z) pt_z (+ z_text dlt_z) data (cons (list hndl (atof (rtos seg_len 2 4)) (atof (rtos pt_z 2 2))) data) ) (redraw ename 4) ) (if data (WriteExcel (cons (list "HANDLE" "LENGTH" "ELEV") (reverse data) ) ) ) (prin1) ) 1 Quote
BIGAL Posted September 26 Posted September 26 Admin double posted. @Tsuky I think wanted chainage of section also in data. See other post dwg. 1 Quote
Rabindra Bhatta Posted September 27 Author Posted September 27 @Tsuky Thankyou very much . It helped me. 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.