- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sorry if this is a repeat, but i couldn't find anything similar in searches.
My current mission is to create some subroutines to translate text elements from an imperial drawing to a metric drawing - our operation uses two sets of templates, which causes quite a bit of mismatch at times and the process is currently quite laborious to convert between the two.
Currently, i have the function working for "rounded" numbers, anything to the precision of 3 digits is working correctly, as it is able to match strings and select the appropriate texts.
Where this breaks down, is when i have some "computed" entities (i.e. objects which have been taken from an imperial scale in an imperial template, and dropped into a metric template with metric scales - and thus the model text height is some weird value).
I've noticed that the height value in the extended data results in an extended 6 digit number, but i'm still unable to filter these text entities with this longer value if i hand-code them in - i suspect i'm not actually seeing the whole value that autocad associates with the entity.
I've also noticed that i can qselect all the text in question using the text heights as displayed in the properties window (which adheres to the drawing settings)
Can anyone shed some light on this? it seems to me there must be a way to make this work if it exists in qselect - i suspect i'm not handling a number correctly or trying to use the wrong value or something.
(defun c:ctxh ( / ff1 xx1 EntityData Data newheight oldheight annoscale oldheightin newheightin) (setq annoscale (getvar "cannoscalevalue")) (setq oldheightin (/ (getreal "\n enter old text height: ") annoscale )) (setq newheightin (/ (getreal "\n enter new text height: ") annoscale )) (setq oldheight (atof(rtos oldheightin 2 3))) (setq newheight (atof(rtos newheightin 2 3))) (setq selectionset (ssget "_X" (list '(0 . "TEXT,MTEXT") (cons 40 oldheight)))) (repeat (setq N (sslength selectionset)) (setq Data (ssname selectionset (setq N (- N 1)))) (setq EntityData (entget Data)) (setq ff1(assoc 40 EntityData)) (setq xx1 (cons 40 newheight)) (entmod(subst xx1 ff1 EntityData)) ) (princ) )
Solved! Go to Solution.