That's OK... I am truly appreciative of the time you have put into this. So the thing is, my form is modal. I would netload, then type in the command to run my form, which generates a block. Then I would type in the command to run the doubleclick event you so kindly provided.
At this point, I would expect to double-click on the block I just created, and have the default doubleclick event overridden, but no, that still doesn't happen.
What I'm trying to understand is this: When exactly is the default doubleclick event for block reference supposed to be overridden? 'Cos like I mentioned in my last post, the logic of the code you provided seems flawless, but I simply can't understand why I stil don't have the desired effect...
I trash around online quite a bit searching for more solutions, and many a time I keep getting the referral to do something with the CAD cuix file. Do you think this is feasible? And if so, can this be done from code, as opposed to typing cuix in the command line and pulling up the AutoCAD cui customization interface?
Here is the module I am using to accomplish doubleclick event handling:
Imports acApp = Autodesk.AutoCAD.ApplicationServices.Application
' AutoCAD Interop
Imports acOp = Autodesk.AutoCAD.Interop
Imports acOpCom = Autodesk.AutoCAD.Interop.Common
Private acDoc As acOp.AcadDocument
Private handlerAdded As Boolean = False
Public Sub eventDoubleClick()
If handlerAdded = False Then
If acDoc Is Nothing Then
acDoc = CType(acApp.DocumentManager.MdiActiveDocument.Acad
AddHandler acDoc.BeginDoubleClick, AddressOf callback_DoubleClick
handlerAdded = True
Catch ex As Autodesk.AutoCAD.Runtime.Exception
Private Sub callback_DoubleClick(ByVal PickPoint As Object)
Dim activeDoc As Document = acApp.DocumentManager.MdiActiveDocument
Dim prmtSel As PromptSelectionResult = activeDoc.Editor.GetSelection()
Using docLock As DocumentLock = activeDoc.LockDocument()
If prmtSel.Status <> PromptStatus.OK Then Return
If prmtSel.Value.Count <> 1 Then Return
Dim id As Autodesk.AutoCAD.DatabaseServices.ObjectId = _
Using acTrans As Autodesk.AutoCAD.DatabaseServices.Transaction = _
Dim dbObj As Autodesk.AutoCAD.DatabaseServices.DBObject = _
Dim ent As Autodesk.AutoCAD.DatabaseServices.Entity = _
If ent Is Nothing Then
Dim blockRef As Autodesk.AutoCAD.DatabaseServices.BlockReference = _
If blockRef Is Nothing Then
And the Commands class, from which my vb.net form is generated, as well as where the ModDoubleClick.eventDoubleClick() method is called:
Public Class Commands
' Component for displaying the Mass Straight Conveyor form
Public Shared Sub massStraight()
' Call this to override default block dblclk event handler
' Display the mass straight form
Dim cForm As New frmMassStraight
Catch ex As Autodesk.AutoCAD.Runtime.Exception
To execute, I start AutoCAD 2010, and type 'mst' into the command bar to run the command which both launches my form and as well 'supposedly' applies doubleclick handler.
After form execution has drawn a block, I doubleclick on the block and the AutoCAD block Attributes Editor still appears.
Really frustrating, isn't it? No end in sight, still hoping for some insight as to why the module isn't doing what it's supposed to do, override the default AutoCAD doubleclick event for blocks (with attributes)...
I have attached two screenshots showing the double click actions responsible for block and attribute editing.
You may try editing the macro for the attribute edit double click action to include your command that displays the form.
I havent tried the sample code yet. Please let me know if modifying the double click action in cuix does not help. I will debug through the code that you already provided.
Thank you very much, let me check out your screenshots and see how it helps...
Quick word though, I would be slightly skeptical about making adjustments directly in the cuix, since this would affect ALL DOUBLE-CLICKED BLOCK REFERENCES, right?
But I am only interested in affecting double-clicked block references which were created by my form (the block name has certain identifiable substrings), while therest of the block references in the drawing would continue to exhibit the default AutoCAD double-click behavior...
Still, let me take a look at your screenshots and investigate my cuix.
Thanks for your help, much appreciated!
Further suggestions/pointers/advice still welcome.
Any idea how to write the macro string for opening a vb.net form in the cuix double-click macro field?
In regular vb.net code, this would be acApp.ShowModalDialog(cForm), but in macro?
Perhaps, something like
^C^C_netload "C:/Tem/myAutoCADForm.dll" ;
I checked out the cuix screenshots; unfortunately, I need to be able to accomplish this double-click action programmatically, as I feel that's the only way I shall be able to apply my custom double-click action to only specific block references, instead of ALL block references.
All the research I have done online enabled me to compile the module I posted here, and the code's logic seems sensible, but unfortunately, after I run the command, double-clicking blocks still pulls up the default autocad double-click action (attredit)
DO you have any idea how this can be made to work?
Many thanks in advance...
You can try using IMessageFilter to avoid double click message going to AutoCAD. Refer DevBlog http://adndevblog.typepad.com/autocad/2012/05/how-
Thanks for the posted link... I'm still trying to figure out how to customize that JigMsgFilter class to suit my needs. I am still relatively new to AutoCAD VB.Net customization, and so many things out there are still confusing for me, but I am finding my way thru gradually.
I am currently attempting to fingure out how the class in your post can be customized for doubleclick action...
also take look at the new post on similar issue http://forums.autodesk.com/t5/NET/How-to-capture-d