how to export co-ordinates to excel CSV file?

how to export co-ordinates to excel CSV file?

Anonymous
Not applicable
2,202 Views
3 Replies
Message 1 of 4

how to export co-ordinates to excel CSV file?

Anonymous
Not applicable

Dear all,

          i want to export auto cad co-ordinates to excel. please any one send the  lisp file for this type. 

herewith i attached i needed lisp type.   i need to show that co-ordinate number vise and csv format also. please anyone help me to find a solution.

id numbers.JPGtable column id.JPG

 

 

0 Likes
Accepted solutions (2)
2,203 Views
3 Replies
Replies (3)
Message 2 of 4

dbhunia
Advisor
Advisor
Accepted solution

Hi,

 

what I get from your post....

 

1   "01, 02,03..." all are blocks with a single attribute.

2   The X-coordinate is NORTHING & Y-coordinate is EASTING

 

If so try this.....

 

(defun C:MC (/)
(setq BN (getstring "\nEnter the block Name to Select: "))
(Setq selectionset (ssget "_A" (list (cons 0 "insert")(cons 2 BN))))
(setq Text "POINTS,EASTING,NORTHING")
(repeat (setq N (sslength selectionset))
	(setq Data (ssname selectionset (setq N (- N 1))))
	(setq EntityData (entget Data))
	(setq IP (cdr (assoc 10 EntityData)))
	(setq elst(entget(entnext Data)))
	(setq AT (cdr (assoc 1 elst)))
	(setq Text (strcat text "\n" AT "," (rtos(nth 1 ip)) "," (rtos(nth 0 ip))))
)
(setq fn "C:\\output.csv"
     fp (open fn "w")
)
(write-line text fp)
(close fp)
)

 

 

It will create a file at "C:\\output.csv".....

 

Only things you have to do.......

 

1   To enter the block name.

2   To sort the generated *.cvs file (to the column points)......

 

Hopefully you can manage the rest.......

 

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 3 of 4

Anonymous
Not applicable

@dbhunia wrote:

Hi,

 

what I get from your post....

 

1   "01, 02,03..." all are blocks with a single attribute.

2   The X-coordinate is NORTHING & Y-coordinate is EASTING

 

If so try this.....

 

(defun C:MC (/)
(setq BN (getstring "\nEnter the block Name to Select: "))
(Setq selectionset (ssget "_A" (list (cons 0 "insert")(cons 2 BN))))
(setq Text "POINTS,EASTING,NORTHING")
(repeat (setq N (sslength selectionset))
	(setq Data (ssname selectionset (setq N (- N 1))))
	(setq EntityData (entget Data))
	(setq IP (cdr (assoc 10 EntityData)))
	(setq elst(entget(entnext Data)))
	(setq AT (cdr (assoc 1 elst)))
	(setq Text (strcat text "\n" AT "," (rtos(nth 1 ip)) "," (rtos(nth 0 ip))))
)
(setq fn "C:\\output.csv"
     fp (open fn "w")
)
(write-line text fp)
(close fp)
)

 

 

It will create a file at "C:\\output.csv".....

 

Only things you have to do.......

 

1   To enter the block name.

2   To sort the generated *.cvs file (to the column points)......

 

Hopefully you can manage the rest.......

 

 


dear sir,

            i'm not a expert. so how to use this coding in autocad.

0 Likes
Message 4 of 4

dbhunia
Advisor
Advisor
Accepted solution

Hi,

 

If you go through online you should get how to load a .lsp file & run it ........ ok....

 

1   First copy & paste the entire code into notepad & save it with some name with "LSP" extension .........(like "XXX.LSP")

2   Type command "APPLOAD" you should get the window.....(this window for AutoCAD 2007, this differs on version)

1.PNG

 

3   Now select the saved "*.lsp" (say XXX.LSP) file from your saved location & press "Load" button & close the window...

4   Now put the command "MC" & press enter ....... the code will run......


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes