ILoveMadoka Posted 4 hours ago Posted 4 hours ago I found some code by kent1cooper here (defun C:MTW ; = MText Width (/ ss wf n mt) (if (and (setq ss (ssget "_:L" '((0 . "MTEXT")))) (setq wf (getreal "\nWidth Factor to apply: ")) ); and (repeat (setq n (sslength ss)); then (setq mt (ssname ss (setq n (1- n)))) (setpropertyvalue mt "Contents" (strcat "{\\W" (rtos wf 2) ";" (getpropertyvalue mt "Contents") "}") ); setpropertyvalue ); repeat ); if (princ) ); defun This works great.... BUT once the width has been changed it no longer works. Is it a simple fix to change the width after it has been changed? Ideally select multiple and not have to pick the dropdown to change. If you have a style that has a defined width, the routine works until you change it to something else. If you run STRIPMTEXT on a string, it resets something so the change text code works again. Quote
Steven P Posted 3 hours ago Posted 3 hours ago (edited) The code is adding a width string to the text. These characters are hidden but will show up if you click on the text and look at it in the properties menu, or via the LISP line: (assoc 1 (entget(car(entsel)))) In the code it adds {\\W'wf'; to the string where wf is the width factor Something like {\\W0.8;Here is a text string} If you run the code again, it will add another width factor to the text string... but won't remove the first, so you get something like this: {\\W0.5;{\\W0.8;Here is a text string}} - noting that the new text width is applied and then the first one is applied.. result is you only see what was applied first. Need to remove this formatting to the text string before applying a new one. You might also have issues if other text formatting is used, such as underlined, italics, bold... For width you might be able to amend Lee Macs Unformat LISP to just unformat the width portion: https://lee-mac.com/unformatstring.html In these text strings replace with just 'W' ACcFfHLlOopQTW and here ACcFfHLlOoPpQSTW change to SW ... and then apply the new width formatting from your LISP .. though CAD is off so not tested - all part of the fun for you! ...if Lee Mac is passing through, feel free to correct me, though many years later I am just about understanding some of your codes. Edited 3 hours ago by Steven P Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.