• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

string to filter mtext on a layer called "mq"

  • Thread starter Thread starter Mano63
  • Start date Start date

Mano63

Guest
good evening to all users,
I have plans with hundreds of data fields expressed in mtext (each mtext shows the number of square meters of the associated retino) on a layer called "mq".
I would need a command that with a window selects me exclusively mtext on the "mq" layer and returns the total in a mtext (clicking on an existing mtext).
I attach a lisp that I already use, but it does not filter the mtext on the sqm layer, but selects them all.I ask some understanding soul (and expert) to add to the attached lisp a string to filter mtext on the "mq" layer.the test can be done on the attached dwg by selecting all the drawing with a single window (mtexts on the "mq" layer are cyan-colored) and the text to be clicked for the return of the total is the written "totalemq".
Thank you.
 

Attachments

Code:
(defun c:caarea(/ sel mtext obj sum)
(prompt "\nselect design area: "
(setq sel (ssget (cons 0 "mtext") (cons 8 "mq"))))
(setq sum (fnestraidati sel)
(if (/= sum nil)
(progn)
(setq sel (sing "\nselect totalmq: ")
(Sectq n (car sel))
(setq obj (vlax-ename->vla-object n))
(vlax-put-property obj "textstring" (strcat "totale sqm" (rtos sum 2))
)
)
)

(defun fnestraidati(sel / count n testo)
(setq count 0 value 0.0)
(repeat (sslength sel)
(setq n (ssname sel count)
(setq text (cdr (assoc 1 (entget n)))))
(setq value (+ value))
(setq count (+ count 1))
)
value
)

; function requiring to select the entity. uses entsel function.
(defun sing (strprompt / a)
(while (not (setq a))
a
)
Please.
 
Thank you very much rpor66!
I hope I didn't mess up. It works fine, and I removed the text "total square meters", so that only the quantity is inserted in figures.
Unfortunately, my work, in these days, is quite boring: I work with very few layers, and if I had no commands like this, which allow me to act without isolating the layers, the times would reach me. . .
Thanks again, and good day!
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top