Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, all .
help Create lisp please, i want to click POLYLINE and get NE and sent to Excel or Notepad
thanks
Solved! Go to Solution.
Hi, all .
help Create lisp please, i want to click POLYLINE and get NE and sent to Excel or Notepad
thanks
Solved! Go to Solution.
Try this.
(defun rh:sammlung_n (o_lst grouping / tmp n_lst) (setq n_lst nil) (if (= (rem (length o_lst) grouping) 0) (while o_lst (while (< (length tmp) grouping) (setq tmp (cons (car o_lst) tmp) o_lst (cdr o_lst) );end_setq );end_while (setq n_lst (cons (reverse tmp) n_lst) tmp nil );end_setq );end_while (princ "\nModulus Error : The passed list length is not exactly divisible by the group size!!") );end_if (reverse n_lst) );end_defun (defun c:gpc ( / obj o_type c_lst t_file fp ) (setq obj (vlax-ename->vla-object (car (entsel "\nSelect Polyline : ")))) (cond ( (wcmatch (setq o_type (vlax-get-property obj 'objectname)) "*Polyline") (setq n (if (wcmatch o_type "*3d*") 3 2) c_lst (rh:sammlung_n (vlax-get obj 'coordinates) n) t_file (vl-filename-mktemp "Polyline" (getvar 'dwgprefix) ".csv") fp (open t_file "w") );end_setq (foreach v c_lst (setq p_str (strcat "N=" (rtos (cadr v) 2 3) ", E=" (rtos (car v) 2 3))) (write-line p_str fp) );end_foreach (close fp) ) ( (alert "Not a Polyline")) );end_cond );end_defun
Type gpc to run
I am not one of the robots you're looking for
When select Polyline:
Command: (LOAD "C:/Users/CHAN/Desktop/sammlung_n.LSP") C:GPC
Command: GPC
Select Polyline : nil
Command:
sammlung_n is the name of a subroutine to sort the coordinates into a list
Copy code, past into notepad and save to file somewhere in your autocad path. You choose the filename.
Command: APPLOAD <enter>
Navigate to where you saved the file, select and press load button. Press the close button.
Command : gpc <enter>
Should ask you to select a polyline. Creates a csv file in the same directory as the drawing. Double click this file and it will open in Excel
Link to detailed explanation - http://www.lee-mac.com/runlisp.html
I am not one of the robots you're looking for
Yes it's
when i Command : gpc <enter> and select Polyline
Command :
Select Polyline : nil
That is correct.
Go to drawing folder and look for "polyl###.csv" file. Double click and it will open in excel.
I am not one of the robots you're looking for
(defun rh:sammlung_n (o_lst grouping / tmp n_lst) (setq n_lst nil) (if (= (rem (length o_lst) grouping) 0) (while o_lst (while (< (length tmp) grouping) (setq tmp (cons (car o_lst) tmp) o_lst (cdr o_lst) );end_setq );end_while (setq n_lst (cons (reverse tmp) n_lst) tmp nil );end_setq );end_while (princ "\nModulus Error : The passed list length is not exactly divisible by the group size!!") );end_if (reverse n_lst) );end_defun (defun c:gpc ( / obj o_type c_lst t_file fp ) (setq obj (vlax-ename->vla-object (car (entsel "\nSelect Polyline : ")))) (cond ( (wcmatch (setq o_type (vlax-get-property obj 'objectname)) "*Polyline") (setq n (if (wcmatch o_type "*3d*") 3 2) c_lst (rh:sammlung_n (vlax-get obj 'coordinates) n) t_file (vl-filename-mktemp "Polyline" (getvar 'dwgprefix) ".csv") fp (open t_file "w") );end_setq (foreach v c_lst (setq p_str (strcat "E=" (rtos (car v) 2 3) ", N=" (rtos (cadr v) 2 3))) (write-line p_str fp) );end_foreach (close fp) ) ( (alert "Not a Polyline")) );end_cond );end_defun
As requested. Enjoy.
I am not one of the robots you're looking for