ktbjx Posted March 15, 2016 Posted March 15, 2016 is there a way to get a LINE's start X, Start Y, End X, End Y, Start Z, End Z, Length, Angle. and put it on excel??? i want to put it on excel and i want to input datas corresponding to those coordinates. what im doing is data extraction, but its kinda hard to look for a single line and when i find it, thats where i input my data. in excel it looks like this: start X Start Y End X End Y Start Z End Z Length Angle CU AU HoleID the CU AU HoleID part is where i input is there an easier way to do this? Quote
BIGAL Posted March 15, 2016 Posted March 15, 2016 Its actually easy as you can work out the centre point of the line you can use various ssget options to retrieve the line, ssget "F" or "WP" or "CP" you need a tiny pick box etc Using entsel would be easier but alludes me for a pick point. Quote
ktbjx Posted March 15, 2016 Author Posted March 15, 2016 i still dont know what to do, how can i code it??? Quote
Lee Mac Posted March 15, 2016 Posted March 15, 2016 The following simple example will write the data you have described to a tab-delimited Excel spreadsheet: (defun c:linex ( / des enx ept idx sel spt xls ) (if (and (setq sel (ssget '((0 . "LINE")))) (setq xls (getfiled "Create Excel File" "" "xls" 1)) ) (if (setq des (open xls "w")) (progn (repeat (setq idx (sslength sel)) (setq enx (entget (ssname sel (setq idx (1- idx)))) spt (cdr (assoc 10 enx)) ept (cdr (assoc 11 enx)) ) (write-line (strcat (rtos (car spt)) "\t" (rtos (cadr spt)) "\t" (rtos (car ept)) "\t" (rtos (cadr ept)) "\t" (rtos (caddr spt)) "\t" (rtos (caddr ept)) "\t" (rtos (distance spt ept)) "\t" (angtos (angle spt ept)) ) des ) ) (close des) ) (princ "\nUnable to open file for writing.") ) ) (princ) ) Quote
BIGAL Posted March 16, 2016 Posted March 16, 2016 Lee the poster has posted twice, once as output the other as input, wants to be able to find a line from excel hence the other post about ssget "F". The simple way is to write a macro in excel and copy and paste a column etc stepping through data, need a bit of time or need to do a getexcel.lsp type function. Maybe time at home tonight. Quote
Recommended Posts
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.