TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: PM on September 23, 2021, 05:05:19 AM
-
Hi i am using this code to check if the drawing is fake dimensions. The code works fine and find all over write dimensions in the drawing and mark them with red number and fill color yellow. I find that if in a drawing the dimension is not over write but we have change the dimension scale linear and then run the lisp restore the dimension scale linear to 1 without any alert (and this is not correct). Is it possible not change the dimension scale linear to 1 but mark this dimensions with other color (for example blue numbers and fill green ) ?
(defun c:fakedim
(/ i ss
) (if (setq ss
(ssget "X" '
((0 .
"DIMENSION") (-3 ("ACAD"))))) )
(if (setq ss
(ssget "X" '
((0 .
"DIMENSION") (-4 .
"<AND")(-4 .
"<NOT")(1 .
"")(-4 .
"NOT>")(-4 .
"<NOT")(1 .
"*<>*")(-4 .
"NOT>")(-4 .
"AND>"))))
)
)
(alert "No fake dimensions in the drawing !!!!") )
)
)
Thanks
-
This will do what you asked.
(defun c:fakedim (/ SS c i)
(vl-load-com)
(setvar "cmdecho" 0)
(setq c 0 i 0)
(if (setq ss (ssget "X" '((0 . "DIMENSION"))))
(foreach dim (mapcar 'cadr (ssnamex ss))
(setq iOG (vlax-ename->vla-object dim))
(if (/= (vla-get-LinearScaleFactor iOG) 1)
(progn
(vlax-put-property iOG "textcolor" 5)
(vlax-put-property iOG 'TextFill :vlax-true)
(vlax-put-property iOG 'TextFillColor 3)
(setq c (1+ c))
)
)
(if (/= (vla-get-textoverride iOG) "")
(progn
(vlax-put-property iOG "textcolor" 1)
(vlax-put-property iOG 'TextFill :vlax-true)
(vlax-put-property iOG 'TextFillColor 2)
(setq i (1+ i))
)
)
)
(alert "No Dimensions in the drawing !!!!")
)
(if (or (> i 0) (> c 0))
(progn
(prompt (strcat "\n" (itoa c) " Dimensions with Linear Scale Diffrence"))
(prompt (strcat "\n" (itoa i) " Dimensions with Text Overwritten"))
)
)
(setvar "cmdecho" 1)
(princ)
)
--Edit-- updated code to use the same SS and added a counter with report.
Don't know what the (-3 ( "ACAD")) is used for can someone explain? might be better to just use "(if (setq ss (ssget "X" '((0 . "DIMENSION"))))"
-
You're right...
There is no point if filtering for XDATA - it's obvious that '((0 . "DIMENSION")) is quite enough...
-
Hi mhupp. I try your code but gives me
; error: syntax error
Can you fix it?
Thanks
-
Hi mhupp. I try your code but gives me
; error: syntax error
Can you fix it?
Thanks
Was making some fixes added a counter should work now.
-
You're right...
There is no point if filtering for XDATA - it's obvious that '((0 . "DIMENSION")) is quite enough...
So it this changing more then the linear scale?
(entmod (list (cons -1 (ssname ss (setq i (1- i)))) (list -3 (list "ACAD"))))
-
Now work fine thanks
-
Excellent PM! Such a nice tool for "the-reveal"!