Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ID values to clipboard

3 REPLIES 3
Reply
Message 1 of 4
BB8x
202 Views, 3 Replies

ID values to clipboard

Hi

 

Is any lisp or comment for this. I am using id command and I see coordinates. Maybe someone has lisp who would do same thing like ID, but copy X = , .... into the clipboard?

 

Thanks

Tags (1)
3 REPLIES 3
Message 2 of 4
paullimapa
in reply to: BB8x

give this idcb.lsp a try:

; idcb takes point selected on screen and copies X,Y,Z as text to clipboards
; OP:
; https://forums.autodesk.com/t5/autocad-forum/id-values-to-clipboard/m-p/12163699#M1112565s
(defun c:idcb (/ id txt)
 ; copytext to clipboard with str as text string argument
 ; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-to-clipboard-in-one-step/m-p/7517011/highlight/true#M361124
 (defun COPYTEXT (str / html)
   (vl-load-com)
   (if (= (type str) 'STR )
    (progn
     (vlax-invoke (vlax-get (vlax-get (setq html (vlax-create-object "htmlfile")) 
      'ParentWindow) 'ClipBoardData) 'SetData "Text" str)
     (vlax-release-object html)
     (princ "\nSuccessfully Copied text to Clipboard")
	) ; progn
    (princ"\nOnly Text is Supported.")
   ) ; if
   (princ)
 )
 (while(not id)
  (if(setq id(getpoint"\nSelect Point: "))
   (progn
     (setq txt(strcat "\nX is "(rtos(car id)2 4) " Y is " (rtos(cadr id)2 4) " Z is " (rtos(caddr id)2 4)))
     (copytext txt)
   )
   (princ"\nNo Point Selected.")
  ) ; if
 ) ; while
) ; defun

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 4
BB8x
in reply to: BB8x

Thank you, works like I wanted

 

Better paste to Excel like this:

(while(not id)
(if(setq id(getpoint"\nSelect Point: "))
(progn
(setq txt(strcat "X is "(rtos(car id)2 4) " Y is " (rtos(cadr id)2 4) " Z is " (rtos(caddr id)2 4)))
(copytext txt)

 

Message 4 of 4
Sea-Haven
in reply to: BB8x

If you want to Excel ask for that, 2 common methods, write a csv file or write direct to excel. For me the latter. Keep picking points they appear in Excel.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost