.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

commandmethod not working

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
399 Views, 2 Replies

commandmethod not working

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
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

I did have an attribute in front of the sub's

Public Sub DrawingProperties() (didnot copy over)

pat
Message 3 of 3
Anonymous
in reply to: Anonymous

found it
working directry not set

pat

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost