.NET

Reply
Distinguished Contributor
Patrick Johnson
Posts: 229
Registered: ‎04-26-2005
Message 1 of 3 (186 Views)

commandmethod not working

186 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
Patrick Johnson
Posts: 229
Registered: ‎04-26-2005
Message 2 of 3 (185 Views)

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
Patrick Johnson
Posts: 229
Registered: ‎04-26-2005
Message 3 of 3 (185 Views)

Re: commandmethod not working

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

pat

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community