Thanks @hosneyalaa
I see you saw my typo for box1---> box2 (I also noticed just recently)
and thanks for the rtos recommendation I forgot about that.
Basically now my problem is how to handle this data.
I don't want to create a CAD table anymore.
My Options are:
- to input it to excel via getexcel
- create a new csv file with the data
- paste to clipboard the data so the user can paste to whatever cell he likes
I am very interested in a clipboard option I saw a code
from @CodeDing here
This method is very convincing, my idea is to create a string that if I paste in excel would mimic the results of my table.
In this code he successfully segregated each text by a tab entry (moving to the next cell) so my only problem is how to code the "Enter" command in a strcat generated text
(defun c:C2E ( / _SetClipBoardText ss txt cnt len)
(vl-load-com)
;Function to set clipboard
(defun _SetClipBoardText ( text / htmlfile result )
;; Attribution: Reformatted version of
;; post by XShrimp at theswamp.org.
;; See http://tinyurl.com/2ngf4r.
(setq result
(vlax-invoke
(vlax-get
(vlax-get
(setq htmlfile (vlax-create-object "htmlfile"))
'ParentWindow
)
'ClipBoardData
)
'SetData
"Text"
text
)
)
(vlax-release-object htmlfile)
text
);defun
;Get input from user. 4 dims, in order w/ window (ssget) capability
(setq ss nil cnt 1 txt "")
(while (not ss)
(prompt (strcat "\nSelect Dimension " (itoa cnt) ": "))
(if (setq ss (ssget '((0 . "DIMENSION"))))
(if (= 1 (sslength ss))
(progn
(setq len (cdr (assoc 42 (entget (ssname ss 0)))))
(setq txt (strcat txt (rtos len 4)))
(if (/= 4 cnt) (setq ss nil txt (strcat txt "\t")))
(setq cnt (1+ cnt) len nil)
);progn
(progn
(setq ss nil)
(prompt "\n...invalid. More than 1 object selected.")
);progn
);if
;else
(prompt "\n...nothing selected")
);if
);while
;If string, send to clipboard and send feedback to user
(if (< 0 (strlen txt))
(progn
(_SetClipBoardText txt)
(prompt "\nText Successfully copied to clipboard.")
);progn
(prompt "\nFailure, no text to copy to clipboard...")
);if
(princ);finish quietly
);defun