dxfval options, textToVal, pt2block download

This commit is contained in:
2019-12-09 02:01:42 +01:00
parent 437c614344
commit 88a162a530
3 changed files with 224 additions and 12 deletions

View File

@@ -6,7 +6,7 @@
;; gyetpet@gmail.com
;; gyetvai-peter.hu
(defun C:dxfval (/ i imax il j jmax jl x ss currElem code groupCode sube en2 enlist2 )
(defun C:dxfval (/ i imax il j jmax jl x ss currElem code groupCode sube listauto savefile f savepath en2 enlist2 )
;variables:
(setq i 0);counter to zero
(setq imax 1);while variable
@@ -29,25 +29,60 @@
(setq il (sslength ss));length of selection
(prompt "\nDxf group code: (leave empty for all) ")
(setq groupCode (getint))
(print groupCode)
(initget 1 "Yes No")
(setq sube (getkword "List sub entities? [Yes/No]"))
(while imax
(print )
(print )
(princ "Checking element ")
(princ (1+ i))
(princ "/")
(princ il)
; ------------------------------ output settings ----------------------------- ;
(if (< 1 il)
(progn
(initget 1 "Yes No")
(setq listauto (getkword "List all automatically? [Yes/No]"))
)
(setq listauto "No")
)
(initget 1 "Yes No")
(setq savefile (getkword "Save to file? [Yes/No]"))
(if (= savefile "Yes")
(progn
(setq savepath (getfiled "Output path" "" "" 1))
(setq f (open savepath "w"))
)
)
; -------------------------- going through elements -------------------------- ;
(while imax
; -------------------- long output only for non auto list -------------------- ;
(if (= listauto "No")
(progn
(print )
(print )
(princ "Checking element ")
(princ (1+ i))
(princ "/")
(princ il)
(print )
)
(progn
(print )
(princ (strcat (itoa (1+ i)) ":"))
)
)
(setq currElem (entget (ssname ss i) ))
(if groupCode
; --------------------- print only groupcode if added --------------------- ;
(progn
(print (cdr (assoc groupCode currElem)))
(princ (cdr (assoc groupCode currElem)))
(if (= savefile "Yes") (prin1 (cdr (assoc groupCode currElem)) f))
)
; --------------------- print all if groupcode not added --------------------- ;
(progn
(setq jl (length currElem))
@@ -65,6 +100,7 @@
(setq en2(entnext (ssname ss i))) ;- Get the next sub-entity
; ------------------------------- sub entities ------------------------------- ;
(if (and en2 (= sube "Yes"))
(progn
@@ -92,13 +128,13 @@
)
)
)
)
);- sub entities end
)
)
(if (not (or (= il 1)(= (1+ i) il)))
(if (and (not (or (= il 1)(= (1+ i) il))) (= listauto "No"))
(progn
(prompt "\nPress any key to continue to the next element: ")
(setq code (grread))
@@ -111,6 +147,7 @@
(if (= i il) (setq imax nil));finish function if i equals il
)
(if (= savefile "Yes") (close f))
(setq ss nil)
(princ)
)