Author Topic: Mtext Width  (Read 7017 times)

0 Members and 1 Guest are viewing this topic.

DanB

  • Bull Frog
  • Posts: 367
Mtext Width
« on: March 30, 2005, 02:08:31 PM »
Does anyone know if there is a way to change existing MTEXT to a specified width without going through the properties bar. I want to create a button (macro) that allows me to select MTEXT and the MTEXT width would change to a predefined value (say 5 for this example). Many times I find MTEXT that has grips that go wayyyyy off the screen, I would rather shorten them up and pull them to where I need them.

Thanks,
Dan

daron

  • Guest
Mtext Width
« Reply #1 on: March 30, 2005, 03:21:59 PM »
activex???

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Mtext Width
« Reply #2 on: March 30, 2005, 03:26:23 PM »
Active property : Width
DXF group code : 41
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Mtext Width
« Reply #3 on: March 30, 2005, 04:02:21 PM »
You can modify this:
Code: [Select]
;; Author unknown, modifications by CAB
;;
;;;********************************************************************;
;;; Change Mtext width                                                 ;
;;;--------------------------------------------------------------------;
;;; This function will allow you to change the Mtext width of selected ;
;;; text. I use this to help in my drafting duties. I hate having to   ;
;;; do things repetitavly, so this helps me eliaviate some of that.    ;
;;;********************************************************************;
(defun C:ChangeTW (/ Obj-list Obj NewWidth ssget->vla-list)
  (vl-load-com)
  ;;===================================================================;
  ;; SSGET->VLA-LIST                                                   ;
  ;;-------------------------------------------------------------------;
  (defun ssget->vla-list (selection-set / index vla-list)
    (setq index (if selection-set (1- (sslength selection-set)) -1))
    (while (>= index 0)
      (setq vla-list (cons (vlax-ename->vla-object
                             (ssname selection-set index)) vla-list)
            index    (1- index)
      )
    )
    vla-list
  )
;;;===================================================================;

  (vla-StartUndoMark (vla-Get-ActiveDocument (vlax-Get-Acad-Object)))
  (setq Obj-list (ssget->vla-list (ssget '((0 . "MTEXT")))))
  (setq NewWidth (getdist ">>:Enter new Mtext width: "))
  (mapcar
    '(lambda (obj)
       (if (vlax-property-available-p Obj 'Width)
         (vlax-put-property Obj 'Width NewWidth)
         (vlax-Release-Object Obj)
       )
     )
    Obj-list
  )
  (prompt "\>>:Objects Changed, program complete.")
  (vla-EndUndoMark (vla-Get-ActiveDocument (vlax-Get-Acad-Object)))
  (princ)
)
(prompt "\n***  Mtext width change loaded, Enter ChangeTW to run.  ***")
(princ)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

DanB

  • Bull Frog
  • Posts: 367
Mtext Width
« Reply #4 on: March 31, 2005, 08:25:46 AM »
Thanks, I'll give this a shot and see if I can fit it to my needs.

Dan

daron

  • Guest
Mtext Width
« Reply #5 on: March 31, 2005, 08:45:30 AM »
Of course, this then becomes a programming need and not a general cad question, so it is not in the proper forum. Moving.....

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Mtext Width
« Reply #6 on: March 31, 2005, 08:51:51 AM »
Thanks Daron,
I did try to think of a way to use a command but couldn't.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

daron

  • Guest
Mtext Width
« Reply #7 on: March 31, 2005, 09:26:51 AM »
It's okay. I too in the past wondered the same thing with no luck. I knew it was a simple task with activex which is why "activex" was all I said. If this question had been posted in the proper forum, I might have been more inclined to look around for the lisp I wrote to solve the very problem. I'm not trying to be rude. I just don't like answering lisp questions that are placed in the CAD General forum. I know sometimes it can be a hard thing to determine where a question should go. That's what we have moderators for, but if a person would just ponder their own answer before posting, it might be made easier to know where to post. Here's a sample: 'pondering'>- "Is it possible to type -mtext and work through a command line sequence to change the width? Trying... Nope! Grr. I must need to get this programmed. Well, those great people at the swamp might be able to help. Maybe the Autolisp forum is where this needs to go???"

Novel idea. A bit corny, but nove.