.NET

Reply
Distinguished Contributor
229 Posts
1 Kudo
Registered: ‎04-26-2005
Post 1 of 3

commandmethod not working

193 Views, 2 Replies
11-07-2006 08:16 AM
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
Distinguished Contributor
229 Posts
1 Kudo
Registered: ‎04-26-2005
Post 2 of 3

Re: commandmethod not working

11-07-2006 08:19 AM in reply to: Patrick Johnson
I did have an attribute in front of the sub's

Public Sub DrawingProperties() (didnot copy over)

pat
Distinguished Contributor
229 Posts
1 Kudo
Registered: ‎04-26-2005
Post 3 of 3

Re: commandmethod not working

11-07-2006 08:36 AM in reply to: Patrick Johnson
found it
working directry not set

pat
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!