Jump to content

Recommended Posts

Posted

hello guys:

I need a selection filter to select texts and mtext other than 3.5 in size

try this code from Master Lee 

(ssget '((0 . "CIRCLE") (-4 . "<>") (40 . 5.0)))

modified

 

(defun c:pru (/ ss )
(ssget '((0 . "TEXT") (-4 . "<>") (40 . 3.5))) 
  (princ)
)

 

 

I need to identify texts other than 3.5 with some color.

 

help please  thanks

 

 

Posted (edited)
7 hours ago, leonucadomi said:

hello guys:

I need a selection filter to select texts and mtext other than 3.5 in size

 

Try this: 

;; Modified by DV. Visit my page at: https://lispautocad.gumroad.com/

(defun c:PRU (/ ss)
  (if (setq ss (ssget '((0 . "TEXT,MTEXT") (-4 . "<>") (40 . 3.5))))
    (progn
      (sssetfirst nil ss)
      (princ (strcat "\nSelecting: " (itoa (sslength ss)) " objects."))
    )
    (princ "\nNo Object.")
  )
  (princ)
)

 

Edited by DATVO
  • Thanks 1
Posted
7 hours ago, DATVO said:

 

Try this: 

;; Modified by DV. Visit my page at: https://lispautocad.gumroad.com/

(defun c:PRU (/ ss)
  (if (setq ss (ssget '((0 . "TEXT,MTEXT") (-4 . "<>") (40 . 3.5))))
    (progn
      (sssetfirst nil ss)
      (princ (strcat "\nSelecting: " (itoa (sslength ss)) " objects."))
    )
    (princ "\nNo Object.")
  )
  (princ)
)

 

I ALREADY TRIED IT AND IT SELECTED THEM ALL FOR ME, I DON'T KNOW WHAT HAPPENS

:(

My purpose is to detect all texts that do not have a desired height, in this case 3.5

Posted
(defun c:pru2 ( / ss alturaColor colorNuevo)
  (setq alturaColor 3.5) ; Define la altura a verificar
  (setq colorNuevo 1)  ; Define el color a aplicar (ej. rojo)
  (setq ss (ssget "X" '((0 . "TEXT,MTEXT")))) ; Selecciona todos los textos
  (if ss
    (progn
      (setq i 0)
      (while (setq en (ssname ss i))
        (setq obj (vlax-ename->vla-object en))
        (if (/= (vla-get-height obj) alturaColor)
          (vlax-put-property obj 'color colorNuevo) ; Cambia el color
        )
        (setq i (1+ i))
      )
    )
  )
  (princ)
)

This routine does what I need, but it has a problem that I cannot understand, I have objects in the paperspace that have a height of 3.5 and it recognizes them as if they did not have it and changes them to red. :(

can someone help? thanks

Posted (edited)

This

 

(ssget '((0 . "TEXT") (-4 . "<>") (40 . 3.5))) 

 

should work. You can change "TEXT" to "*TEXT" to also capture MText

 

Though looking at the code you have, I am assuming that is just a snippet of what you want to do. Here are a couple of hints:

(defun c:pru ( / ss )   ;;Yup localised variables, C: prompt, all good
  (setq ss (ssget '((0 . "TEXT") (-4 . "<>") (40 . 3.5))) ) ;; ADDED (SETQ SS ... ) so that you can use the selection set later

  (princ (sslength ss)) ;; Added this in to show the result of the selection set

  (princ)               ;;Exit quietly
)

 

Edited by Steven P

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