Jump to content

Recommended Posts

Posted

Hi everybody

Can someone write me a lisp-code to export points to CSV?
1) User should select the entities

2) Enter Lisp Command
3) Windows explorer should appear, where to save the csv File with the points X-Y-Z

 

I would be very very happy for that! 1000 Thanks!

Posted (edited)
19 hours ago, Mepspec said:

Thank you, is there a solution without a GUI Menu?

 

Example
 

 



(defun c:testex ( / FILENAME FO LST NUM SS STR TLK X)
  
  (setq ss (ssget (list (cons 0 "point"))))
  
  (if (/= ss nil)
    (progn
      
      (setq filename (getfiled "NAME THE EXPORT FILE" (strcat (getvar 'dwgprefix) (getvar 'dwgname)) "csv" 1))
      (setq fo (open filename "a"))
      
      (setq num 0)
      
      (repeat (setq x (sslength ss))
	(setq tlk (ssname ss (setq x (- x 1))))
	(setq lst (cdr (ASSOC 10 (ENTGET tlk))))
	(setq str (strcat
		    (rtos (setq num (1+ num)) 2 0)
		    ";"
		    (rtos (nth 0 lst) 2 2)
		    ";"
		    (rtos  (nth 1 lst) 2 2)
		    ";"
		    (rtos  (nth 2 lst) 2 2)
		    )
	      )
		(write-line str fo)
	)
      (close fo)
      )
    
    )
  (princ)
  )

 

Edited by hosneyalaa
change

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...