PDA

View Full Version : Range help!


jgardner.79905
2005-10-21, 04:47 PM
I am currently putting together a routine which will change the textoverride of all dimension in a drawing that equal 3.5" to be a space, so no text is displayed in that dimension. The routine below is what I have put together and it seems to be working great for dimension that are exactly 3.5", but our dimension precision is set to 1/32" of an inch. So I was hoping someone could help me with how I could put a small range in the if statement.
(defun c:dblank ()
(setq ssSelection (ssget "X" (list (cons 0 "dimension"))))
(repeat (setq intCount (sslength ssSelection))
(setq intCount (1- intCount)
entSelection (ssname ssSelection intCount)
objSelection (vlax-ename->vla-object entSelection)
)
(if (= (vla-get-measurement objSelection) 3.5)
(vla-put-TextOverride objSelection " ")
)
(princ)
)
)[ Moderator Action = ON ] What are [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code) [ Moderator Action = OFF ]

Thanks for any help
Jason

Opie
2005-10-21, 05:16 PM
(defun c:dblank ()
(setq ssSelection (ssget "X"(list (cons 0 "dimension"))))
(repeat (setq intCount (sslength ssSelection))
(setq intCount (1- intCount)
entSelection (ssname ssSelection intCount)
objSelection (vlax-ename->vla-object entSelection)
)
(if (AND (>= (vla-get-measurement objSelection) (- 3.5 (/ 1 32)))(<= (vla-get-measurement objSelection) (+ 3.5 (/ 1 32))))
(vla-put-TextOverride objSelection " "))
(princ))
)

jgardner.79905
2005-10-21, 05:34 PM
Would you have any idea why this would be working great on some dimensions and not others? It seems like it wiil work fine on newly generated dimensions but not older ones. Any ideas?

Thanks
Jason

kennet.sjoberg
2005-10-21, 06:14 PM
You can try this instead :
(= (rtos (vla-get-measurement objSelection) 2 5 ) "3.50000" )

: ) Happy Computing !

kennet

T.Willey
2005-10-21, 06:56 PM
Try this.
(if (equal (vla-get-measurement objSelection) 3.5 0.03125)
(vla-put-TextOverride objSelection " ")
)

jgardner.79905
2005-10-21, 07:53 PM
Thanks everyone. Now it works like a champ!

Jason

jgardner.79905
2005-10-25, 03:13 PM
I just have one more question. The routine I have put together from the help above works great, I am just curious if it's possible to have this routine do what it is doing but only to 3 of the 4 dimension styles I am using.

Thanks
Jason

kennet.sjoberg
2005-11-04, 09:12 AM
... I am just curious if it's possible to have this routine do what it is doing but only to 3 of the 4 dimension styles...
Yes, filter out the ones in ssget you do not want to change

(setq ssSelection
(ssget "_X"
'(
(-4 . "<not" )(-4 . "<and")
( 0 . "DIMENSION" )
( 3 . "NotThisA,NotThisB,NotThisC") ;; <-- appropriate dimension style name
(-4 . "and>")(-4 . "not>" )
)
)
)

: ) Happy Computing !

kennet