TheSwamp
Code Red => VB(A) => Topic started by: Guest on November 09, 2006, 01:17:14 PM
-
I'm trying to create a program to perform a certain task when a particular block is double-clicked. The part I'm having trouble with is capturing what type of entity is being double-clicked. Once I get that, I'll be off an runningl; but I can't seem to get past the starting line. :(
In the meanwhile, I'll keep plugging along.
-
under tools->customize->interface you can create a custom dbl-clk
Hope that helps
As for the type of entity, are you filtering at all?
-
/watching with interest...
-
under tools->customize->interface you can create a custom dbl-clk
Hope that helps
As for the type of entity, are you filtering at all?
What version? I'm on '05.
-
that was from the 07 help file. So, if its not there in 05, we need to make our own.
-
So here's what i came up with. Basically what I'm doing is unloading the DblClkEdit.arx file, then displaying a dialog box, then reloading the DblClkEdit.arx file.
See attached DWG and DVB - Open the DWG, load the DVB then double click a bubble. It *should* display the keypad dialog box. From there you simply click a number and the attribute is automatically updated and the dialog box is closed.
Comments...?? Suggestions...?? Is there a better way to handle the double-click event??
-
Am I to take it you got it working?
-
Am I to take it you got it working?
Feel free to take it...
It seems to be working okay so far. I'm just not 100% confident that what I'm doing is the best (or recommended) way to go about it (I.E. turning off DblClkEdit then turning it back on). I see no one has downloaded the ZIP so I'm probably not going to get any suggestions or comments. *hint* *hint*
I should clarify something (brain was running on coffee fumes at the time).
So here's what i came up with. Basically what I'm doing is unloading the DblClkEdit.arx file turning off DBLCLKEDIT, then displaying a dialog box, then reloading the DblClkEdit.arx file turning on DBLCLKEDIT.
-
I was just asking in case you needed some more help with it. I have my own DblClick Reactor already defined.
-
I was just asking in case you needed some more help with it.
I guess maybe... I'm not above asking for help when I need it. What does your reactor do? Is it VBA?
-
Sorry, im not ignoring you, I have just been in meetings. I'll try to DL it tonight
-
Yep VBA reactor .. I keep the built in reactor turned off by default.
Mine basically has events tied to specific types of entities and specifically named blocks.
For example, if I double click on text it opens the appropriate text editor whether it is mtext, attdef, dtext etc. Certain blocks when double clicking opens my personal enhanced attribute editor.
I have used other ideas in the past, for example, whenever I placed a cut section or detail mark, I could double click on it and open or change to the appropriate drawing and zoom in on the detail.
-
Keith:
Could you please post a snippet of the code? I've been having some problems with mine and wanted to take a peek at some code that DOES work.
Thanks.
-
Here is a link to a VBA sample by Lee Ambrosius:
http://www.hyperpics.com/customization/vb_vba/vba_downloads.asp
HTH
-
This is the basic shell ..... you can add your specific object handlers as needed. I place this in a click reactor dvb and load it independently. One word of advice. Unless the acvba.arx (or whatever it is called) is loaded the VBA reactors will not fire. Place this code in the ThisDrawing code segment.
Private Sub AcadDocument_BeginDoubleClick(ByVal PickPoint As Variant)
Dim AcadObj As AcadEntity
Dim AcadDim As AcadDimension
Dim SelSet As AcadSelectionSet
'translate our point so we can double click even in other UCS settings
PickPoint = ThisDrawing.Utility.TranslateCoordinates(PickPoint, acWorld, acUCS, False)
On Error GoTo ClearOut
'create selection set
Set SelSet = ThisDrawing.SelectionSets.Add("ClickReactor")
'grab objects at point
SelSet.SelectAtPoint PickPoint
'process each object ignoring those without a handler
For Each AcadObj In SelSet
'Add conditional statement for all objects to handle along with the default handler
'edit text in default text editor
If AcadObj.ObjectName = "AcDbText" Then
SendCommand "_.ddedit" & vbLf & "(handent " & Chr(34) & AcadObj.Handle & Chr(34) & ")" & vbLf
'edit mtext in default text editor
ElseIf AcadObj.ObjectName = "AcDbMText" Then
SendCommand "_.ddedit" & vbLf & "(handent " & Chr(34) & AcadObj.Handle & Chr(34) & ")" & vbLf
ElseIf AcadObj.ObjectName = "AcDbBlockReference" Then
'edit attributes in custom attribute editor
If AcadObj.HasAttributes = True Then
SendCommand "modatt" & vbLf '& "(handent " & Chr(34) & AcadObj.Handle & Chr(34) & ")" & vbLf
End If
End If
Next AcadObj
' Funny thing about dims, they don't handle the same for some reason
For Each AcadDim In SelSet
' step through all objects, even if they are not dims ... I am just lazy and don't want to filter for them
On Error Resume Next
SendCommand "_.ddedit" & vbLf & "(handent " & Chr(34) & AcadDim.Handle & Chr(34) & ")" & vbLf
Next AcadDim
' We are done now do clean up
ClearOut:
' delete the selection set
ThisDrawing.SelectionSets.Item("ClickReactor").Delete
' done now
End Sub
-
Luis: Thanks for the link.
Keith: Thanks for the snippet.