OK, so I know I need to do this using DXF codes and DICTSEARCH. But I'm a little (or a lot) out of my depth.
I have this code which searches the dictionary for the scale "1" = 10'-0" and dumps the properties into a variable "ent" and the object name into "entnm"
Code:
(defun c:SCALETEST (/ slist scaleDict scaleDictName csobj num index scaleObject item entnm ent aScale
tempNameObj tempFirst RatioObj tempLastRatioObj tempDictList tempDictListEnt
newScaleDict)
(setq slist '("1:1"))
(setq scaleDict (dictsearch (namedobjdict) "ACAD_SCALELIST"))
(setq scaleDictName (cdar scaleDict))
(setq csobj (vlax-ename->vla-object scaleDictName))
(setq num (vla-get-count csobj))
(setq index 0)
(repeat num
(setq scaleObject (vlax-invoke-method csobj 'item index))
(setq entnm (vlax-vla-object->ename scaleObject))
(setq ent (entget entnm))
(if (not (member (setq aScale (cdr (assoc 300 ent))) slist))
(progn (entdel entnm))
(progn (setq index (+ index 1)))
)
)
(princ ent)
)
It spits out the following:
((-1 . <Entity name: 7ffffb0ab10>) (0 . SCALE) (5 . 1491) (102 . {ACAD_REACTORS) (330 . <Entity name: 7ffffb051e0>) (102 . }) (330 . <Entity name: 7ffffb051e0>) (100 . AcDbScale) (70 . 0) (300 . 1" = 10'-0") (140 . 1.0) (141 . 120.0) (290 . 0))((-1 . <Entity name: 7ffffb0ab10>) (0 . "SCALE") (5 . "1491") (102 . "{ACAD_REACTORS") (330 . <Entity name: 7ffffb051e0>) (102 . "}") (330 . <Entity name: 7ffffb051e0>) (100 . "AcDbScale") (70 . 0) (300 . "1\" = 10'-0\"") (140 . 1.0) (141 . 120.0) (290 . 0))
I can see that it's got the correct scale from this bit:
(300 . 1" = 10'-0")
But what I don't know how to do is change that to (300 . 1" = 10') and write that back to the entity name in the dictionary. All I want to change is the name of the scale.
As always... thanks for your help!
-JP