Can someone take a look, I netload this dll and can not get the commandmethods to work.
Imports System
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.EditorInput
Namespace Morton
Public Class Class1
Public Sub DrawingProperties()
Dim DP As DrawingProperties = New DrawingProperties
Application.ShowModalDialog(DP)
End Sub
Public Sub ViewSB1()
DrawingType("SHEETNO", "DType", "SB1")
End Sub
Public Sub DrawingType(ByVal strTag As String, ByVal strBlockName As String, _
Optional ByVal strTagValue As String = "", Optional ByVal strResult As String = "")
Dim DB As Database = HostApplicationServices.WorkingDatabase
Dim Trans As Transaction = DB.TransactionManager.StartTransaction
Dim BT As BlockTable = CType(Trans.GetObject(DB.BlockTableId, OpenMode.ForRead), BlockTable)
If BT.Has(strBlockName) Then
Dim btr As BlockTableRecord = CType(Trans.GetObject(BT(strBlockName), OpenMode.ForRead), BlockTableRecord)
Dim blockRefIds As ObjectIdCollection = btr.GetBlockReferenceIds(False, False)
If blockRefIds.Count > 0 Then
Dim br As BlockReference = CType(Trans.GetObject(blockRefIds(0), OpenMode.ForRead), BlockReference)
Dim attCount As Integer = br.AttributeCollection.Count
Dim i As Integer
For i = 0 To attCount - 1 Step 2
Dim ar As New AttributeReference
If (ar.Tag.Trim() = strTag) And (ar.TextString.Trim = strTagValue) Then
ar = CType(Trans.GetObject(br.AttributeCollection(i + 1), OpenMode.ForWrite), AttributeReference)
ar.TextString = strResult
End If
Next
End If
End If
Trans.Commit()
End Sub
End Class
End Namespace
thanks
pat