
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to make a LISP that would enable me to select a table, then it would separate it's content depending on the value of the first column. It kind of work because it separates the data, but I have to click between each bit of text being placed.. I'd also like the table to disappear once the text has been placed.
This is the original matrix
Here's what I want it to do
Here's my code so far :
(defun c:midz (/ c ctr dat etdata ind lst prefix r tab tblent tblobj val varname)
(setq snapMode (getvar "osmode")) ;Enlève le Object Snap (F3)
(setvar "osmode" 0)
(setq maximum (getint "\n Nombre de lignes: "))
(setq etdata (entget (setq tblent (car (entsel "\nSelect table object: "))))
ind (cdr (assoc 91 etdata))
tab (cdr (assoc 92 etdata))
r 0
c 0
ctr 1
prefix "var"
tblobj (vlax-ename->vla-object tblent))
(while (< c tab)
(while (< r ind)
(set (setq varname (read (strcat prefix (itoa ctr))))
(setq val (vlax-invoke tblobj 'getcellvalue r c)))
(setq lst (cons (setq dat (cons varname val)) lst))
(setq ctr (if (listp (cdr dat))
ctr
(1+ ctr))
r (1+ r)))
(setq r 0
c (1+ c)))
(vl-remove-if '(lambda (x) (listp (cdr x))) (reverse lst))
(setq iteration 1)
(setq yvalue1 27.75)
(setq yvalue2 27.75)
(while (<= iteration maximum)
(if (= (eval (read (strcat "var" (itoa iteration)))) 1)
(command "_text" "J" "M" (strcat "-53.5," (rtos yvalue1)) "4" "0" (eval (read (strcat "var" (itoa (+ iteration maximum)))))
(setq yvalue1 (+ yvalue1 -30.5)))
)
(setq iteration (1+ iteration)))
(setq iteration 1)
(while (<= iteration maximum)
(if (= (eval (read (strcat "var" (itoa iteration)))) 2)
(command "_text" "J" "M" (strcat "153.5," (rtos yvalue2)) "4" "0" (eval (read (strcat "var" (itoa (+ iteration maximum)))))
(setq yvalue2 (+ yvalue2 -30.5)))
)
(setq iteration (1+ iteration)))
(princ))
Solved! Go to Solution.