Results 1 to 5 of 5

Thread: Justify Mtext / Default Justification Mtext

  1. #1
    100 Club
    Join Date
    2007-07
    Posts
    104
    Login to Give a bone
    0

    Question Justify Mtext / Default Justification Mtext

    Does anyone know how to set the default justification value for mtext in a drawing?
    I know you can change the justification using the "justifytext" command, but that needs text in the drawing before it works, and it only works after the mtext is inserted.

    I really need to set the justification before any text is inserted. I can get the justification value of text after it inserted using VBA, but that wont do any good, because the insertion point is the attachmentpoint. The attachmentpoint (beforehand) determines where the text ends up on a drawn line. Changing it afterwards makes the mtext end up at the wrong point.

    I have noticed that the first Mtext I insert is justified to "Left", While the second Mtext I insert is justified to "TopLeft". Perhaps there is a pattern there that could be used.

    I also found this lisp routine that makes sure mtext set to "MiddleCenter" before it is typed. I don't know how to make that work in VBA though.
    Code:
    (progn(initdia)(command "._MTEXT" (getpoint) "_J" "_MC"))
    Last edited by darfnuggi; 2008-12-11 at 11:35 AM. Reason: Found additional information

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,396
    Login to Give a bone
    0

    Default Re: Justify Mtext / Default Justification Mtext

    In vba and .net, you have to create an ent first then change its properties. I think if you read the help topic on AttachmentPoint, you will first understand how it works and then be able to manipulate, InsertionPoint, AttachmentPoint and BoundingBox to move it where you want. Note that changing the justification for mtext does not move the text, just the AttachmentPoint. Just calculate where you want the text to be and move the AttachmentPoint.
    C:> ED WORKING....

  3. #3
    100 Club
    Join Date
    2007-07
    Posts
    104
    Login to Give a bone
    0

    Default Re: Justify Mtext / Default Justification Mtext

    I was hoping there was a way to choose the justification before the text is inserted, so as to avoid extra steps. I will have to change the properties after the text is inserted.

    ' get coords of current attachmentpoint
    ' set new attachmentpoint
    ' get coords of new attachmentpoint
    ' move mtext from old coords to new coords

  4. #4
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,396
    Login to Give a bone
    0

    Default Re: Justify Mtext / Default Justification Mtext

    That is correct.
    C:> ED WORKING....

  5. #5
    100 Club
    Join Date
    2007-07
    Posts
    104
    Login to Give a bone
    0

    Default Re: Justify Mtext / Default Justification Mtext

    I've been trying to find a way to achieve this movement (from old attachmentpoint coordinates to new attachmentpoint coordinates), but I feel kind of stuck.

    The lisp routine for gathering info on entities (entget (car (entsel))) gives me groupcode 10, showing the x, y, z values I want (the coordinates of the attachmentpoint).
    I found out by now that I can use the following to get coordinates with VBA,
    Code:
     MsgBox oMText.insertionPoint(1)
    and have set up the follwing code to build from.

    Code:
     Public Sub Coords()
    
    Dim xyz(0 To 2) As Double
    
    xyz(0) = 100#  ' can I associate the value of groupcode 10?
    xyz(1) = 50#  ' can I associate the value of groupcode 20?
    xyz(2) = 0#  ' can I associate the value of groupcode 30?
    
    MsgBox xyz(0) & "," & xyz(1) & "," & xyz(2)
    
    End Sub
    Last edited by darfnuggi; 2009-01-28 at 10:45 AM. Reason: Found a new idea, making the other ones obsolete.

Similar Threads

  1. Default MTEXT justification
    By johnny138421 in forum AutoCAD General
    Replies: 3
    Last Post: 2015-10-20, 11:12 AM
  2. Justify WITHIN mtext
    By beardking in forum AutoCAD General
    Replies: 3
    Last Post: 2009-11-16, 09:22 AM
  3. Replies: 1
    Last Post: 2009-05-06, 06:40 PM
  4. Mtext Default justification
    By drafting700 in forum ACA General
    Replies: 1
    Last Post: 2007-07-12, 02:18 PM
  5. Mtext center justify
    By awarren in forum AutoCAD General
    Replies: 3
    Last Post: 2006-04-07, 01:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •