Jump to content

Recommended Posts

Posted

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?

Posted

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.

Posted

i still dont know what to do,

how can i code it???

Posted

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)
)

Posted

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.

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...