AboutScott Cook Expertise I`ve been using AutoCAD since 1987 and programming AutoLISP nearly as long. I can answer questions about programming AutoCAD (except ARX) and production enhancement techniques. I cannot answer questions about AutoCAD crashes or DWG corruption. AutoCAD PROGRAMMING (menus, lisp) related questions only!
Experience Since 1987. Author of Plot2000 software for for AutoCAD, http://www.plot2000.com.
PROGRAMMING QUESTIONS ONLY PLEASE. Questions that are NOT related to programming or AutoCAD customization (menus and lisp only please) are outside the scope of my volunteer services and will NOT BE ANSWERED.
Question I have a VB 6.0 program that I have been using succesfully with Acad 2002 to extract the values of attributes and write them into an Excel document. In running the same program with Acad 2006, I am getting a peculiar error. I use the getattributes method to iterate through the Attribute References one at a time, I then use a select case statement to evaluate the TagString and I can capture the value. In one particular block, there are several TagStrings that are identical, so I need to distinguish between them by the location within the block, which is consistent. I send the TagString and the Attribute Reference to the foloowing sub routine:
Public Sub DetermineAttribute(rpTag As String, rpatt As AcadAttributeReference)
Select Case rpTag
Case Is = "xxx"
Select Case rpatt.Height
Case Is > (4 * titleScale)
rpXXX = 1
Case Is > (3 * titleScale)
If rpatt.InsertionPoint(0) > (titleScale * 25) Then
rpXXX = 2
Else
rpXXX = 3
End If
Case Is > (2.2 * titleScale)
If rpatt.InsertionPoint(1) > (titleScale * 78) Then
rpXXX = 4
Else
rpXXX = 5
End If
Case Else
rpXXX = 10
End Select
Case Is = "x"
If rpatt.InsertionPoint(0) > (titleScale * 50) Then
rpXXX = 6
Else
rpXXX = 7
End If
Case Is = "y"
If rpatt.InsertionPoint(1) > (titleScale * 60) Then
rpXXX = 8
Else
rpXXX = 9
End If
Case Else
End Select
End Sub
I get a "Type Mismatch" error. If I change the rpatt declaration to 'Object' instead of 'AcadAttributeReference', I get a Run-Time error '451', Property let procedure not defined and property get procedure did not return and object.
While using the program with Acad 2002, I can use the above sub routine without error.
Thank You in advance
Answer vb is out of my area of expertise. however if it works in the other version fine, I've seen that be because you haven't imported the type library or aren't referencing the proper base class. I've seen some of this stuff require a slightly different declaration of the type of object you are dealing with based on the version. that's where I'd start looking.