Jump to content

Recommended Posts

Posted

If anyone have for above mentioned subject any lisp program please share .

Either I select one by one or all at time .

 

Export xy of mleader with text value in csv in sorting number .

Thanks 

Cad file attached 

 

Thanks 

0_MLEADER ARROW HEAD XY & TEXT VALUE.dwg

Posted

Hi @Ish

 

Try this:

 

(defun c:EXMLD ( / save_location header op ss len i vals data pt pt_x pt_y ss2 data2 data3 val)
  (setq save_location (getfiled "Select a location for save" "" "csv" 1))
  (setq header (strcat "TEXT" "," "EASTING" "," "NORTHING"))
  (setq op (open save_location "a"))
  (write-line header op)
  (setq ss (ssget "X" '((0 . "MULTILEADER"))))
  (setq len (sslength ss))
  (setq i 0)
  (while (< i len)
    (setq vals nil)
    (setq data (entget (ssname ss i)))
    (setq pt (nth 56 data))
    (setq pt_x (cadr pt))
    (setq pt_y (caddr pt))
    (command "._explode" (ssname ss i))
    (setq ss2 (ssget "X" '((0 . "INSERT"))))
    (setq data2 (entget (ssname ss2 0)))
    (setq data3 (entget (entnext (cdr (assoc -1 data2)))))
    (setq val (cdr (assoc 1 data3)))
    (command "._undo" "1")
    (setq vals (strcat val "," (rtos pt_x 2 4) "," (rtos pt_y 2 4)))
    (write-line vals op)
    (setq i (1+ i))
    )
  (close op)
  (princ (strcat "\nThe data was saved in " "\"" (vl-filename-base save_location) "\"" "."))
  (princ)
  )

 

To sort a list, after saving file, is much easier to do in excel using a "filter" above "Text" column. If this happen on picture 1, use the "Don't convert".

image.thumb.png.d069325ca29f4bd63286800329757094.png

 

Best regards.

  • Like 1
Posted

Thanks @Saxlle

 

For sorting no issue for me 

 

It's working good but it not asking to select object, automatic internal select all and export.

If possible for you please add select option one by one and  select all.

Thanks 

Posted (edited)
22 minutes ago, Ish said:

Thanks @Saxlle

 

For sorting no issue for me 

 

It's working good but it not asking to select object, automatic internal select all and export.

If possible for you please add select option one by one and  select all.

Thanks 

 

Your welcome @Ish.

 

Try with this modification: 

(defun c:EXMLD ( / old_nomutt save_location header op answ ss len i vals data pt pt_x pt_y ss2 data2 data3 val)
  (setq old_nomutt (getvar "nomutt"))
  (setvar "nomutt" 1)
  (setq save_location (getfiled "Select a location for save" "" "csv" 1))
  (setq header (strcat "TEXT" "," "EASTING" "," "NORTHING"))
  (setq op (open save_location "a"))
  (write-line header op)
  (initget "O A" 1)
  (setq answ (getkword "\nDo you want to select one by one or All? [O/A]:"))
  (if (= answ "O")
    (progn
      (princ "\nSelect multileaders:")
      (setq ss (ssget '((0 . "MULTILEADER"))))
      )
    (progn
      (setq ss (ssget "X" '((0 . "MULTILEADER"))))
      )
    )
  (setq len (sslength ss))
  (setq i 0)
  (while (< i len)
    (setq vals nil)
    (setq data (entget (ssname ss i)))
    (setq pt (nth 56 data))
    (setq pt_x (cadr pt))
    (setq pt_y (caddr pt))
    (command "._explode" (ssname ss i))
    (setq ss2 (ssget "X" '((0 . "INSERT"))))
    (setq data2 (entget (ssname ss2 0)))
    (setq data3 (entget (entnext (cdr (assoc -1 data2)))))
    (setq val (cdr (assoc 1 data3)))
    (command "._undo" "1")
    (setq vals (strcat val "," (rtos pt_x 2 4) "," (rtos pt_y 2 4)))
    (write-line vals op)
    (setq i (1+ i))
    )
  (close op)
  (setvar "nomutt" old_nomutt)
  (princ (strcat "\nThe data was saved in " "\"" (vl-filename-base save_location) "\"" "."))
  (princ)
  )

 

Best regards.

Edited by Saxlle
Posted (edited)

There is no problems using lisp for sorting a LIST I do up to 5 values in a list, so can sort on text only etc. 

 

Part 2 your welcome to use this just look inside it has all the functions you need to write direct to Excel. Just copy the function required from the code. Need a different app name  for Libre Calc.

Alan Excel library.lsp

Edited by BIGAL

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