Results 1 to 2 of 2

Thread: Block Attributes to Text Error

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2014-04
    Posts
    1
    Login to Give a bone
    0

    Default Block Attributes to Text Error

    I try to add Text object at the same point with Block object.
    But it gave an error at red line below.

    Error Code is;
    Run-time error '5':
    Invalid prosedure call or argument

    Code:
    Sub Block_Attributes_to_Text()
    Dim obj As AcadBlockReference
    Dim oText As AcadText
    Dim inspt As Variant
    Dim AttList As Variant
    Dim metin As String
    Dim poz As String
    Dim adet As String
    Dim cap As String
    Dim ara As String
    Dim boy As String
    Dim MidPoint(0 To 2)
    Dim NewColorObject As AcadAcCmColor
    Dim acı As Double
    
    ThisDrawing.Utility.GetEntity obj, inspt, "Select Block:"
    
    If obj.ObjectName = "AcDbBlockReference" Then
    
        If obj.HasAttributes Then
    
            AttList = obj.GetAttributes
    
            For i = LBound(AttList) To UBound(AttList)
    
                Select Case AttList(i).TagString
        
                Case Is = "POZ1"
                    poz = AttList(i).TextString
                Case Is = "DAD"
                    adet = AttList(i).TextString
                Case Is = "CAP"
                    cap = AttList(i).TextString
                Case Is = "ARA"
                    ara = AttList(i).TextString
                Case Is = "BOY1"
                    boy = AttList(i).TextString
                End Select
    
            Next i
    
        End If
    
    Else
        MsgBox "You did not select a block."
    End If
            
         
            metin = poz & "+" & adet & "»" & cap & "/" & ara & " L=" & boy
    
            MidPoint(0) = obj.InsertionPoint(0)
            MidPoint(1) = obj.InsertionPoint(1)
            MidPoint(2) = 0
    
            Set oText = ThisDrawing.ModelSpace.AddText(metin, MidPoint, 5)
            Set NewColorObject = obj.TrueColor
            NewColorObject.ColorMethod = acColorMethodByACI
            NewColorObject.ColorIndex = 2
            oText.TrueColor = NewColorObject
                
            acı = obj.Rotation
            oText.Rotate MidPoint, acı
            oText.Update
    
    
    
    acı = Empty
    Set NewColorObject = Nothing
    Erase MidPoint
    boy = vbNullString
    ara = vbNullString
    cap = vbNullString
    adet = vbNullString
    poz = vbNullString
    metin = vbNullString
    AttList = Empty
    inspt = Empty
    oText = Nothing
    obj = Nothing
    
    
    End Sub

  2. #2
    Active Member
    Join Date
    2012-11
    Location
    Italy
    Posts
    65
    Login to Give a bone
    0

    Default Re: Block Attributes to Text Error


Similar Threads

  1. Replies: 1
    Last Post: 2014-06-16, 07:54 PM
  2. Block with field attributes within a dynamic block conundrum
    By flash5238 in forum Dynamic Blocks - Technical
    Replies: 0
    Last Post: 2014-05-13, 07:51 PM
  3. Replies: 2
    Last Post: 2012-06-06, 12:28 PM
  4. Replies: 21
    Last Post: 2007-03-20, 02:03 PM
  5. Extract Dynamic Block Attributes, values change as Block changes
    By dave.buckberry in forum Dynamic Blocks - Technical
    Replies: 11
    Last Post: 2006-09-05, 04:38 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
  •