Results 1 to 2 of 2

Thread: CommandEnded Event

  1. #1
    100 Club KevinBarnett's Avatar
    Join Date
    2001-10
    Location
    Pretoria, South Africa
    Posts
    119
    Login to Give a bone
    0

    Question CommandEnded Event

    I need to write a program that performs actions at the end of certain commands. To this end I have written the following code. The code should at least message "Kilroy was here" but it doesnt (although, what I really need is name of the command that just ended).
    What is missing?
    Thx.
    Kevin.

    Imports System
    Imports Autodesk.AutoCAD.ApplicationServices
    Imports Autodesk.AutoCAD.EditorInput
    Imports Autodesk.AutoCAD.Runtime
    Imports Autodesk.AutoCAD.DatabaseServices
    Imports Autodesk.AutoCAD.GraphicsInterface

    Public Class Class1
    Implements Autodesk.AutoCAD.Runtime.IExtensionApplication

    Private CurrentDoc As Document

    Private Shared Sub m_doc_Commandended(ByVal sender As System.Object, _
    ByVal e As Autodesk.AutoCAD.ApplicationServices.CommandEventArgs)
    Dim curdb As Database = Application.DocumentManager.MdiActiveDocument.Database
    Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = curdb.TransactionManager
    Dim myT As Transaction = tm.StartTransaction()
    MsgBox("Kilroy was here")
    Try
    MsgBox(sender.ToString)
    Catch ex As Exception
    myT.Abort()
    MsgBox(ex.Message.ToString)
    Finally
    myT.Dispose()
    End Try
    End Sub

  2. #2
    100 Club KevinBarnett's Avatar
    Join Date
    2001-10
    Location
    Pretoria, South Africa
    Posts
    119
    Login to Give a bone
    0

    Question Re: CommandEnded Event

    Filipe sent me a solution on the autodesk discussion group. Code included below. But the loaded function only functions in the drawing that was active when NETLOAD was executed. Is there an AutoCAD setting to enable netload across all drawings or must the code be changed?

    Imports System
    Imports Autodesk.AutoCAD.ApplicationServices
    Imports Autodesk.AutoCAD.EditorInput
    Imports Autodesk.AutoCAD.Runtime
    Imports Autodesk.AutoCAD.DatabaseServices
    Imports Autodesk.AutoCAD.GraphicsInterface

    Public Class Class1

    Implements Autodesk.AutoCAD.Runtime.IExtensionApplication

    Private CurrentDoc As Document

    Public Sub New()
    CurrentDoc = Application.DocumentManager.MdiActiveDocument
    AddHandler CurrentDoc.CommandEnded, AddressOf m_doc_CommandEnded
    End Sub

    Private Shared Sub m_doc_CommandEnded(ByVal sender As System.Object, _
    ByVal e As Autodesk.AutoCAD.ApplicationServices.CommandEventArgs)
    MsgBox("Kilroy was here!")
    msgbox(e.GlobalCommandName)
    End Sub

Similar Threads

  1. Replies: 9
    Last Post: 2014-07-07, 02:40 AM
  2. using event in standalone VB ?
    By dohkim139878 in forum VBA/COM Interop
    Replies: 5
    Last Post: 2011-04-01, 05:52 PM
  3. Replies: 3
    Last Post: 2006-03-23, 10:25 PM
  4. VB.Net savecomplete event
    By KevinBarnett in forum Dot Net API
    Replies: 0
    Last Post: 2006-01-30, 10:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •