Muna Posted March 26, 2020 Posted March 26, 2020 Hello, I am searching for a lisp that can export the lengths of all selected polylines and export them to either Excel or an AutoCad table. so far I cannot find the right one. The lisp would need to have you select multiple polylines and give the total lengths of each polyline with auto labeling in the order that they were selected in. Then the data would either appear on an AutoCad table or Excel with autolabel number, Layer name and Length. Quote
Tharwat Posted March 28, 2020 Posted March 28, 2020 Give the following program a shot. NOTE: the download may take a few moments so be patient while the link become ready. https://autolispprograms.wordpress.com/get-lengths-program/ Quote
Farsin Posted May 16, 2020 Posted May 16, 2020 (edited) hi, was looking for this lisp routine. made some tweaks to match my requirement. 1. added additional column to get area of polyline 2. changed units from imperial to metric. i was working on a drawing in millimeters. and i wanted the length output to be in meters and area in sq meters. edited the cvunit thing in the code for that. thank you all, i am completely beginner in this. and this thread was a great help test area length.lsp additionally, is there a way to add one more column with some sort of identifier for the polylines? Edited May 16, 2020 by Farsin Quote
Sabarinathan Posted May 7, 2022 Posted May 7, 2022 On 5/31/2018 at 2:31 PM, BIGAL said: Not to hard look for matching lines in code above in most cases its add to the number an extra 1. (setq numcolumns 3) ............ (vla-setcolumnwidth objtable 2 25) ....... (vla-settext objtable 1 2 "Layer") ........ (vla-settext objtable Y 1 (rtos (vla-get-length e) 2 3)) (vla-settext objtable Y 2 (vla-get-layer e) ) Hi, Bigal I would like to add a polyline coordinate for X, Y, and Z. Would it be possible to add a polyline coordinate? Quote
BIGAL Posted May 8, 2022 Posted May 8, 2022 (edited) Need more info a pline has multiple xyz co-ords not sure what you want need to dummy up an example. Edited May 8, 2022 by BIGAL Quote
le-tan-phuc Posted June 27 Posted June 27 On 8/29/2015 at 8:47 AM, BIGAL said: Here is a table version, works for me as metric may need mods for inches re row sizes etc. Will only work in modelspace see curspace. Tharwat stuffed up lambda please help any other suggestions welcome. (defun c:Test (/ s x y doc objtable numrows rowheight pt1 colwidth curspace) ;; Tharwat 26. 08. 2015 ; ;; mods by BIGAL 29.08.2015 now as table (vl-load-com) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (setq curspace (vla-get-modelspace doc)) (setq pt1 (vlax-3d-point (getpoint "\nPick point for top left hand of table: "))) (princ "\nSelect LWpolylines to export to a Table :") (setq s (ssget '((0 . "LWPOLYLINE")))) (if (/= s nil) (progn ; now do table (setq numrows (+ 2 (sslength s))) (setq numcolumns 2) (setq rowheight 7) (setq colwidth 25) (setq objtable (vla-addtable curspace pt1 numrows numcolumns rowheight colwidth)) (vla-settext objtable 0 0 "Pline lengths") (vla-setcolumnwidth objtable 0 10) (vla-setcolumnwidth objtable 1 25) (vla-settext objtable 1 0 "Pline") (vla-settext objtable 1 1 "Length") (vla-SetTextHeight Objtable (+ acDataRow acHeaderRow acTitleRow) 2.5) (vla-SetAlignment Objtable acDataRow acMiddleCenter) (setq x 1) (SETQ Y 2) (setq r -1) ;((lambda (r / e) (while (setq e (vlax-ename->vla-object(ssname s (setq r (1+ r))))) (vla-settext objtable Y 0 (rtos x 2 0)) (vla-settext objtable Y 1 (rtos (cvunit (vla-get-length e) "inch" "feet") 2 4)) (setq x (1+ x )) (setq y (1+ Y )) ); while ; )) ;lambda ) ;progn (alert "You have not picked any plines run again") ) ; if (princ) ) ; defun (c:test) Dear Bigal, Can you add a column show the layer names of the polyline, please? Phuc Le Quote
le-tan-phuc Posted June 28 Posted June 28 Sorry Bigal I found your instructions and it worked, thank you very much ! 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.