Lisp to select all dimensions with same text override.

Lisp to select all dimensions with same text override.

Anonymous
Not applicable
2,920 Views
7 Replies
Message 1 of 8

Lisp to select all dimensions with same text override.

Anonymous
Not applicable

I would like to know if anyone has a LISP for selecting all dimensions with same text override. I would like to run it on open drawing. On running the lisp it should ask to select a dimension with override already applied and then it should select all the dimension with the same override in the file and should end with all dimension selected so that i can apply any change on that selection set. We have to perform this work through qselect. But it takes some time , i want to automate this through lisp but have no idea.

Thanks to anyone that has something like that and wants to share.

0 Likes
Accepted solutions (1)
2,921 Views
7 Replies
Replies (7)
Message 2 of 8

Moshe-A
Mentor
Mentor

hi,

 

check this one:

note, the current and the new dimtxt values must be a whole numbers  (e.g integers)

 

enjoy

moshe

 

 

(defun c:dimtxtovr (/ val0 val1 ss elist ctr)
 (setvar "cmdecho" 0)
 (command "._undo" "_begin")
 
 (if (and
       (setq val0 (rtos (getreal "\nCurrent dimtxt: ") 2 0))
       (setq val1 (rtos (getreal "\nSet new dimtxt: ") 2 0))
       (setq ss (ssget "x" '((0 . "dimension"))))
     )
  (progn 
   (setq i -1 ctr 0)
   (repeat (sslength ss)
    (setq elist (entget (ssname ss (setq i (1+ i)))))
     
    (if (and
	  (/= (cdr (assoc '1 elist)) "")
	  (eq (cdr (assoc '1 elist)) val0)
	)
     (progn
      (setq ctr (1+ ctr))
      (entmod (subst (cons '1 val1) (assoc '1 elist) elist))
     )
    )
   ); repeat
   
   (if (= ctr 0)
    (prompt "\nNoting found.")
   )
  ); progn
 ); if
  
 (command "._undo" "_end")
 (setvar "cmdecho" 1)
  
 (princ)
)
0 Likes
Message 3 of 8

pbejse
Mentor
Mentor
Accepted solution

@Anonymous wrote:

..select a dimension with override already applied and then it should select all the dimension with the same override in the file and should end with all dimension selected ...


 

 

(defun c:FFD (/ seldim str);; <- Find Fudge Dimension
  (if (and
	(setq seldim
	       (ssget "_:S:E"
		      '((0 . "*DIMENSION")
			(-4 . "<OR")
			(1 . "*?*")
			(-3 ("ACAD"))
			(-4 . "OR>")
		      )
	       ) ;_ end of ssget
	) ;_ end of setq
	(setq str (cdr (assoc 1 (entget (ssname seldim 0)))))
      ) ;_ end of and

    (sssetfirst
      nil
      (ssget "_X" (list '(0 . "*DIMENSION") (cons 1 str)))
    ) ;_ end of sssetfirst
  ) ;_ end of if

  (princ)
) ;

HTH

 

 

Message 4 of 8

_Tharwat
Advisor
Advisor

This?

(defun c:Test ( / str )
  (and (setq str (getstring t "\nSpecify text override to search for :"))
       (sssetfirst nil (ssget "_X" (list '(0 . "*DIMENSION") (cons 1 str) (cons 410 (getvar 'CTAB)))))
       )
  (princ)
  )
0 Likes
Message 5 of 8

Anonymous
Not applicable

Thanks pbejse's sir, 

That was exactly what I wanted . thank you once again.

0 Likes
Message 6 of 8

braudpat
Mentor
Mentor

Hello Mr @pbejse

 

I like your routine so Kudos for you !

 

Regards, Patrice

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


0 Likes
Message 7 of 8

harry.jaff.swift
Explorer
Explorer

Hi, this is amazing!
Is it possible to select all of the M-texts that have the same height with the same principal?

 

I Have an AutoCAD 2D model,  that contains lots of different text sizes and I wanna be able to select specific text size and make them a little smaller but not the same as other texts on the model!   thank yo in advance! 

0 Likes
Message 8 of 8

braudpat
Mentor
Mentor

Hello @harry.jaff.swift 

 

Please create a new Topic with your demand relative to MTEXT!

 

Thanks, The Health, Bye, Patrice

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


0 Likes