Erase all dimensions with specific measurement

Erase all dimensions with specific measurement

Tallans422
Advocate Advocate
821 Views
5 Replies
Message 1 of 6

Erase all dimensions with specific measurement

Tallans422
Advocate
Advocate

Hello,

I thought there was a LISP routine floating around that would delete all dimensions from your drawing that have a specific measurement value that you can specify within the routine.  Anyone familiar?

Thanks

0 Likes
Accepted solutions (1)
822 Views
5 Replies
Replies (5)
Message 2 of 6

Kent1Cooper
Consultant
Consultant

You can specify the Measurement value in QSELECT to find them for you, to Erase.

Kent1Cooper_0-1715627001723.png

[and similarly with the other varieties of Dimensions].

 

But I think that would require really exact same-ness.  Two Dimensions that display as the same measurement because of the precision setting in the Dimension Style could be different a few more decimal places down, and therefore not found in the same QSELECT operation.  If that's a possibility, it is probably necessary to find more Dimensions than you want, and step through them to check their Measurement values for being what you're aiming for but with a fuzz factor.

Kent Cooper, AIA
0 Likes
Message 3 of 6

Tallans422
Advocate
Advocate

I know about the option in qselect.  Trying to find a way to automate it for many users in a LISP routine.

 

Thanks

0 Likes
Message 4 of 6

komondormrex
Mentor
Mentor

hi,

maybe like this

 

(command "_erase" (ssget "_x" (list '(0 . "dimension") (cons 42 <number - your dim value>))) "")
;eg
(command "_erase" (ssget "_x" (list '(0 . "dimension") (cons 42 37))) "")

 

also may be tuned using -4 group codes. 

 

0 Likes
Message 5 of 6

ВeekeeCZ
Consultant
Consultant
Accepted solution

Possibly something like this. You can adjust the value of fuzz.

 

(defun c:DimEraseMeasurement (/ f s r e i)

  (if (and (setq f 0.01) ; fuzzy
	   (setq s (ssget "_X" (list '(0 . "DIMENSION") (cons 410 (getvar 'ctab)))))
	   (or (setq r (getdist "\nSpecify measurement of dims to be removed <select example>: "))
	       (and (setq r (car (entsel "\nSelect dimension: ")))
		    (or (= "DIMENSION" (cdr (assoc 0 (entget r))))
			(prompt "\nError: Wrong selection. Selected object isn't DIMENSION."))
		    (setq r (cdr (assoc 42 (entget r)))))))
    (repeat (setq i (sslength s))
      (setq e (ssname s (setq i (1- i))))
      (if (not (equal r (cdr (assoc 42 (entget e))) f))
	(ssdel e s))))
  (if (and s (/= 0 (sslength s)))
    (command "_.erase" s ""))
  (princ)
  )
0 Likes
Message 6 of 6

Tallans422
Advocate
Advocate

That's the ticket BeekeeCZ, thanks!

0 Likes