Hi
@Anonymous wrote:
Hi dbhunia, you have been so much help i hate to bother again but i have this small script file that i drop into my drawing and it swaps out the border with another one (see below). I would like to take this one step farther and be able to change attibutes 'TITLE1, TITLE2 & TITLE3 to upper case at the same time. Is this possible? Thank you
.......................
How far I believe in this world Nothing is IMPOSSIBLE .......... Only thing we have to explore things in proper way ..... But the thing matters which one is proper way ......
In my limited Knowledge in AutoCAD it is not possible directly to change to Upper Case through SCRIPT file using AutoCAD commands......
But the Execution Behavior of a SCRIPT file in AutoCAD is to Execute line by line (Start to End) whatever you entered into the file.......
So Accept this Behavior of SCRIPT file and place some Code of LISP from the last post into it and run it.......(Put this Below lines in your SCRIPT file)
Try this.......
;Put_this_lines_after_Your_Lines
;Change_Attribute_Values_to_Upper
(vl-load-com)
(setq Att_Tag_lst (list "TITLE1" "TITLE2" "TITLE3"));;Put_Attribute_Tag_Names_like_this_pattern_as_many_as_you_want....
(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
(setq ss (ssget "X" (list '(0 . "INSERT"))))
(repeat (setq NOS (sslength ss))
(setq Data (ssname SS (setq NOS (- NOS 1))))
(setq obj (vlax-ename->vla-object Data))
(foreach att (vlax-invoke Obj 'GetAttributes)
(repeat (setq N1 (length Att_Tag_lst))
(setq Att_Tag (nth (setq N1 (- N1 1)) Att_Tag_lst))
(if (= (vla-get-Tagstring att) Att_Tag)
(progn
(setq Att_Value (strcase (vla-get-Textstring att)))
(vla-put-textstring att Att_Value)
);repeat
);if
);repeat
);foreach
);repeat
;Done
Or Create a separate SCRIPT file with the above code and run it....... It's tested in AutoCAD 2007 hopefully work in upper version.
Only problem in the above mentioned way is .................... All this Lisp Code will be visible in Command line history........
That also can be Resolved.......
Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....