Lisp to export polyline length of walls of building from Autocad to excel

Lisp to export polyline length of walls of building from Autocad to excel

sajid727
Contributor Contributor
415 Views
4 Replies
Message 1 of 5

Lisp to export polyline length of walls of building from Autocad to excel

sajid727
Contributor
Contributor

With the help of friends in this forum, I have got lisp to get the area and perimeter for rooms from AutoCAD drawings and export it to excel (lisps attached). I need help if somebody could modify the attached lisp or create a new lisp to get the length of polylines for end-to-end selection of points (to quantify the walls of building in the drawing), and then export it to excel.  Also note that the color of polyline should change on selection, so as to avoid duplication.

Drawing attached.

 

0 Likes
416 Views
4 Replies
Replies (4)
Message 2 of 5

Sea-Haven
Mentor
Mentor

Not quite sure what you mean by "end-to-end selection of points " I am guessing pick points. Then get properties of say the last pline created.

 

So you have, the last used row number, the issue I see with column number is if you exceed column "Z" 91.

 

I use this which is row and column put cell. 

;;	Thanks to fixo			;;
;;   = Set Excel cell text =    ;;
;;				;;
(defun xlsetcelltext ( row column text)
(setq cells (vlax-get-property  (vlax-get-property xls "ActiveSheet") "Cells"))
  (vl-catch-all-apply
    'vlax-put-property
    (list cells 'Item row column
	(vlax-make-variant (vl-princ-to-string text) vlax-vbstring)))
)

 

0 Likes
Message 3 of 5

sajid727
Contributor
Contributor

Thanks for your reply Sea-Haven. I request you to attach the lisp, as I don't have experience in lisp.

By end-to-end selection, I mean pick points. 

I want to pick points of polyline in AutoCAD drawing and export the length (in meters) to excel sheet, such that the selected polyline color changes on selection.

 

0 Likes
Message 4 of 5

Sea-Haven
Mentor
Mentor

There is no problem in picking points and getting a length, I do not understand the change color part. Can post a dwg with before and after, or more detail shown of what your doing.

0 Likes
Message 5 of 5

sajid727
Contributor
Contributor

I have attached drawings with before and after. As you can see, there is no color in the BEFORE dwg, but when a line is selected by picking the points, its color changes to green in the AFTER dwg. 

I need the length in excel sheet (xlsx format).

The Lisp loaded (ROOM_DATAr.lsp) in my previous post, the color of polyline changes on selection, but this lisp is to get room area and perimeter quantity and then exported to excel using Lisp (ROOM_DATA_OUTs). If you can modify this lisp or create a new one.

 

 

0 Likes