+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 12 of 12
  1. #11
    Senior Member TroutKing's Avatar
    Discipline
    Electrical
    TroutKing's Discipline Details
    Occupation
    I work as a designer and drafter for a mid sized multi-disciplined engineering firm
    Discipline
    Electrical
    Details
    I am the physical designer in the power/substation group of my company
    Using
    AutoCAD 2010
    Join Date
    May 2007
    Location
    Castle Rock Colorado
    Posts
    141

    Default

    Registered forum members do not see this ad.

    Ha! Fishing has not been very productive this year. Way too busy with my fourth child only 8 months old.

    OK, with the help I received here and my other research and the beginning of a bald spot on the side of my head from scratching while thinking, I was able to get this to work. I'm not sure how stable it is but it works. If anyone want's to adjust it to make it better - please feel free! I don't get my feelings easily hurt from constructive critism! Just ask Oleg. I can't tell you how many times he has reached over the internet and thumped me in the head!

    Code:
     
    Option Explicit
    Sub Example_GetSubEntity()
        Dim Object As Object
        Dim PickedPoint As Variant, TransMatrix As Variant, ContextData As Variant
        Dim MyStyle As String
        Dim MyWidth As Integer
        Dim i As Integer
        Dim REPLY As String
        MyStyle = "STANDARD"
        MyWidth = 1#
     
        On Error GoTo NOT_ENTITY
     
    TRYAGAIN:
    Do
        ThisDrawing.Utility.GetSubEntity Object, PickedPoint, TransMatrix, ContextData
                If Not Object.StyleName = MyStyle Then
                Object.StyleName = MyStyle
                Object.ScaleFactor = MyWidth
                End If
                Object.Update
    Loop
        Exit Sub
     
    NOT_ENTITY:
        REPLY = MsgBox("                   You have not selected an attribute" & vbCr & vbCr & "Press RETRY to continue or CANCEL to end the macro", vbRetryCancel, "                    A SPECIAL MESSAGE JUST FOR YOU")
        If REPLY = 4 Then
        Resume TRYAGAIN
        End If
     
    End Sub

  2. #12
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Pietari, Venäjä
    Posts
    1,598

    Default

    Registered forum members do not see this ad.

    If you used 'Option Explicit' better yet to cast all object
    explicitly, so you have to cast an object as AttributeReference
    Set attRef = Object
    then change its properties, you will be avoid many mistakes
    in your code
    I posted you another loop example, sorry, not tested
    See you,
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

Similar Threads

  1. Individual Text Object
    By mac111 in forum AutoCAD Beginners' Area
    Replies: 1
    Last Post: 20th Jun 2011, 03:06 am
  2. How to set default size/style for dimensions text ?
    By cyril_13 in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 13
    Last Post: 15th Apr 2010, 04:43 pm
  3. How to separate text into individual lines?
    By Chris333 in forum AutoCAD Beginners' Area
    Replies: 7
    Last Post: 29th Oct 2007, 01:14 pm
  4. Change default text style
    By Robert J in forum AutoCAD Beginners' Area
    Replies: 6
    Last Post: 3rd Oct 2007, 07:54 pm
  5. Default Text Style in 2000LT
    By cadaholic in forum AutoCAD Beginners' Area
    Replies: 8
    Last Post: 22nd Aug 2005, 03:42 pm

Bookmarks

Posting Permissions

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