Message 1 of 6
Adding dimensions to selection set in this AutoLISP code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The code below was taken from this website.
I'm happy to find something that can adjust the size of stacked fractions in multiple MTEXT objects. However, it doesn't work for stacked fractions in dimensions. Unfortunately, adding "DIMENSION" to the selection set doesn't seem to work (it just gives me an error). Any idea how to make it work?
;; Stack Change - Lee Mac
;; Alters the stacking percentage for multiple MText objects.
(defun c:stackchange ( / *error* dm in mt nw pc rx ss st )
(defun *error* ( msg )
(if (and (= 'vla-object (type rx)) (not (vlax-object-released-p rx)))
(vlax-release-object rx)
)
(if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
(princ (strcat "\nError: " msg))
)
(princ)
)
(while
(progn (initget 6)
(and
(setq pc (getreal "\nSpecify new stack % (1-100): "))
(< 100 pc)
)
)
(princ "\nStack % must be less than or equal to 100.")
)
(if
(and pc
(setq ss
(ssget "_:L"
(list
'(0 . "MTEXT")
'(1 . "*{*\\S*[#/^]*;}*")
(if (= 1 (getvar 'cvport))
(cons 410 (getvar 'ctab))
'(410 . "Model")
)
)
)
)
)
(if (setq rx (vlax-get-or-create-object "vbscript.regexp"))
(progn
(vlax-put-property rx 'global actrue)
(vlax-put-property rx 'ignorecase actrue)
(vlax-put-property rx 'multiline actrue)
(vlax-put-property rx 'pattern "\\\\H[0-9]+\\.?[0-9]+x;\\\\S([^;]+);")
(setq dm (getvar 'dimzin))
(setvar 'dimzin 0)
(setq nw (strcat "\\H" (rtos (/ pc 100.0) 2 2) "x;\\S$1;"))
(setvar 'dimzin dm)
(repeat (setq in (sslength ss))
(setq mt (vlax-ename->vla-object (ssname ss (setq in (1- in))))
st (vla-get-textstring mt)
)
(vla-put-textstring mt (vlax-invoke rx 'replace st nw))
)
(vlax-release-object rx)
)
(princ "\nUnable to interface with RegExp object.")
)
)
(princ)
)
(vl-load-com) (princ)