Results 1 to 4 of 4

Thread: Justify all text in drawing

  1. #1
    100 Club sgroff's Avatar
    Join Date
    2006-07
    Location
    The Group "W" Bench
    Posts
    107
    Login to Give a bone
    0

    Default Justify all text in drawing

    I have some old files that we need to mirror for a project. Can I use VBA to iterate through all the text objects and reverse their justification?

    for example, If a piece of text is top left justified, I need it to be top right justified.

    I assume i can use an "if" statement but i'm struggling finding any code that let me iterate through each text object in the drawing.

    any help would be greatly appreciated

  2. #2
    Member
    Join Date
    2011-08
    Posts
    14
    Login to Give a bone
    0

    Default Re: Justify all text in drawing

    This code should do what you require. You would have to use your own alignment codes instead of 9 and 11

    Code:
    Sub realigntext()
        Dim ent As AcadEntity
        Dim dwg As AcadDocument
        Set dwg = ThisDrawing
        For Each ent In dwg.ModelSpace
            If ent.ObjectName = "AcDbText" Then
                If ent.Alignment = 9 Then ent.Alignment = 11
            End If
        Next ent
    End Sub
    Last edited by Opie; 2015-11-17 at 02:55 PM. Reason: [code] tags added

  3. #3
    100 Club sgroff's Avatar
    Join Date
    2006-07
    Location
    The Group "W" Bench
    Posts
    107
    Login to Give a bone
    0

    Default Re: Justify all text in drawing

    Quote Originally Posted by ssaqibh346404 View Post
    This code should do what you require. You would have to use your own alignment codes instead of 9 and 11

    Sub realigntext()
    Dim ent As AcadEntity
    Dim dwg As AcadDocument
    Set dwg = ThisDrawing
    For Each ent In dwg.ModelSpace
    If ent.ObjectName = "AcDbText" Then
    If ent.Alignment = 9 Then ent.Alignment = 11
    End If
    Next ent
    End Sub
    Awesome. I'll try it out later. thanks a million

  4. #4
    Member
    Join Date
    2011-08
    Posts
    14
    Login to Give a bone
    0

    Default Re: Justify all text in drawing

    you can use these constants instead of numbers

    acAlignmentLeft

    acAlignmentCenter

    acAlignmentRight

    acAlignmentAligned

    acAlignmentMiddle

    acAlignmentFit

    acAlignmentTopLeft

    acAlignmentTopCenter

    acAlignmentTopRight

    acAlignmentMiddleLeft

    acAlignmentMiddleCenter

    acAlignmentMiddleRight

    acAlignmentBottomLeft

    acAlignmentBottomCenter

    acAlignmentBottomRight

Similar Threads

  1. TEXT - SELECT JUSTIFY GRIP
    By wpeacock in forum AutoCAD General
    Replies: 3
    Last Post: 2010-01-20, 03:54 PM
  2. Annotative text justify point / scale point
    By Jonathan Pitt in forum AutoCAD LT - General
    Replies: 0
    Last Post: 2010-01-05, 01:59 PM
  3. Replies: 1
    Last Post: 2009-05-06, 06:40 PM
  4. Can't justify Model Text?
    By cstarr in forum Revit Architecture - General
    Replies: 4
    Last Post: 2005-11-18, 05:09 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
  •