Getting error on [red]RED[/red] line.
An unhandled exception of type 'System.InvalidCastException' occurred in CADTime2.exe
Additional information: Specified cast is not valid.
Not sure what to put there. I have tried several things.
How do I find out if a particular block exists and then extract the already known atributes?
TIA
DougP, MCP, A+
An unhandled exception of type 'System.InvalidCastException' occurred in CADTime2.exe
Additional information: Specified cast is not valid.
Code:
Dim A2K As AutoCAD.AcadApplication
Try
A2K = GetObject(, "AutoCAD.Application")
Catch
A2K = CreateObject("AutoCAD.Application")
End Try
Dim A2Kdwg As AutoCAD.AcadDocument = A2K.ActiveDocument
A2K.Visible = True
A2Kdwg.Application.Documents.Open(DWGName)
Dim ss As AutoCAD.AcadSelectionSets
Dim fType(1) As Integer, fData(1)
Dim i, j As Integer
Dim hndl, atts, NumBlocks As Object
[red]ss = A2K.SelectionSets("ss")[/red]
fType(0) = 0 : fData(0) = "INSERT" : fType(1) = 2 : fData(1) = "B-AttributeBlock"
For i = 0 To ss.Count - 1 'This is how many times the Block exists in the drawing.
hndl = ss.Item(i).Handle
atts = ss.Item(i).GetAttributes
For j = LBound(atts) To UBound(atts) 'This is how many TAGS in a block
'<do whatever here>
Debug.Write("Tag: " & atts(j).TagString & " Value: " & atts(j).TextString)
Next
Next
Not sure what to put there. I have tried several things.
How do I find out if a particular block exists and then extract the already known atributes?
TIA
DougP, MCP, A+