addhandler cancel command

addhandler cancel command

Anonymous
Not applicable
1,787 Views
4 Replies
Message 1 of 5

addhandler cancel command

Anonymous
Not applicable

I am trying to add a handler for cancelling a command.

On http://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-F432E285-8B94-4ACD-A186-89E1218DEC07 i can see that a cancel handler exists but my interop.acadApplication doesnt have a cancel event.

"Addhandler AcadAPP.EndCommand, AdressOf..." and "Addhandler AcadAPP.EndCommand, AdressOf..." are working for me but i need to add a handler for cancelling a command too.

Does anyone know how to do this?

0 Likes
Accepted solutions (1)
1,788 Views
4 Replies
Replies (4)
Message 2 of 5

SENL1362
Advisor
Advisor

You can add Handlers handling those events, but they will not Issue those events, i.e. you have to Cancel the Command you're self.

 

doc.CommandCancelled +=doc_CommandCancelled;
doc.CommandFailed +=doc_CommandFailed;

0 Likes
Message 3 of 5

Anonymous
Not applicable

I see now that my post wasen't really clear.

I only need to handle the event but i don't know how to write it in vb.

AddHandler AcadAPP.EndCommand, AdressOf callback_EndCommand works for me.

The problem is that AcadAPP (Autodesk.Autocad.interop.Acadapplication) doesnt include any cancelcommand handlers.

Do you know how to write your piece of code in vb?

0 Likes
Message 4 of 5

SENL1362
Advisor
Advisor
no, i'm not experienced in VB. sorry, i made the switch from VBA to C#
0 Likes
Message 5 of 5

_gile
Consultant
Consultant
Accepted solution

Hi,

 

The issue isn't related to the VB language, it's related to the used API.

AutoCAD COM API doesn't provide a CommandCancelled event,  the AutoCAD .NET API does provide it for the Autodesk.AutoCAD.ApplicationServices.Document class.

 

Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument

AddHandler acDoc.CommandCancelled, AddressOf docCommandCancelled

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes