= implemented = NOT implemented
Application Events | BricsCAD | AutoCAD |
---|---|---|
AppActivate |
|
|
AppDeactivate |
|
|
ARXLoaded |
|
|
ARXUnloaded |
|
|
BeginCommand |
|
|
BeginFileDrop |
|
|
BeginLisp |
|
|
BeginModal |
|
|
BeginOpen |
|
|
BeginPlot |
|
|
BeginQuit |
|
|
BeginSave |
|
|
EndCommand |
|
|
EndLisp |
|
|
EndModal |
|
|
EndOpen |
|
|
EndPlot |
|
|
EndSave |
|
|
LispCancelled |
|
|
NewDrawing |
|
|
SysVarChanged |
|
|
WindowChanged |
|
|
Document Events | BricsCAD | AutoCAD |
---|---|---|
Activate |
|
|
BeginClose |
|
|
BeginCommand |
|
|
BeginDocClose |
|
|
BeginDoubleClick |
|
|
BeginLisp |
|
|
BeginPlot |
|
|
BeginRightClick |
|
|
BeginSave |
|
|
BeginShortcutMenuCommand |
(*) |
|
BeginShortcutMenuDefault |
(*) |
|
BeginShortcutMenuEdit |
(*) |
|
BeginShortcutMenuGrip |
(*) |
|
BeginShortcutMenuOsnap |
(*) |
|
Deactivate |
|
|
EndCommand |
|
|
EndLisp |
|
|
EndPlot |
|
|
EndSave |
|
|
EndShortcutMenu |
|
|
LayoutSwitched |
|
|
LispCancelled |
|
|
ObjectAdded |
|
|
ObjectErased |
|
|
ObjectModified |
|
|
SelectionChanged |
|
|
WindowChanged |
|
|
WindowMovedOrResized |
|
|
Note: Events marked with (*) in list above are currently ignored. They all use the parameter ShortcutMenu (declared as AcadPopupMenu on AutoCAD and Object on BricsCAD). AcadPopupMenu is currently not implemented by BricsCAD's COM.
Object Events | BricsCAD | AutoCAD |
---|---|---|
Modified |
Following VBA code works on AutoCAD but NOT on BricsCAD:
Option Explicit Private Sub AcadDocument_BeginCommand(ByVal CommandName As String) MsgBox "AcadDocument_BeginCommand ::Command= " & CommandName End Sub Private Sub AcadDocument_Activate() MsgBox "AcadDocument_Activate" End Sub Private Sub AcadDocument_Deactivate() MsgBox "AcadDocument_Deactivate" End Sub
The code below declares and initializes oDocEvents using 'WithEvents'. This oDocEvents object will implement the needed events. In our example following document events will be caught: _BeginCommand, _EndCommand,_Activate and _Deactivate.
The Sub synchDoc is responsible for keeping the oDocEvents synchronized with the currently active drawing. As you can see it gets called at several places.
Option Explicit Public WithEvents oDocEvents As AcadDocument Sub main() synchDoc End Sub Private Sub synchDoc() Dim sCurName As String: sCurName = vbNullString Dim sDocName As String: sDocName = vbNullString On Error Resume Next 'workaround oDocEvents possible Nodocument error sDocName = UCase(oDocEvents.Name) sCurName = UCase(ThisDrawing.Application.ActiveDocument.Name) Error 0 If sDocName = vbNullString Then Set oDocEvents = ThisDrawing.Application.ActiveDocument End If If sDocName <> sCurName Then Set oDocEvents = ThisDrawing.Application.ActiveDocument End If End Sub Private Function logEvent(sMessage As String) 'comment/uncomment as needed Debug.Print sMessage 'MsgBox sMessage 'ThisDrawing.Utility.Prompt sMessage End Function '-------DOCUMENT EVENT HANDLERS------------- Private Sub oDocEvents_BeginCommand(ByVal CommandName As String) logEvent "oDocEvents_BeginCommand ::Command= " & CommandName End Sub Private Sub oDocEvents_EndCommand(ByVal CommandName As String) If CommandName = "NEW" Then synchDoc If CommandName = "OPEN" Then synchDoc logEvent "oDocEvents_EndCommand ::Command= " & CommandName End Sub Private Sub oDocEvents_Activate() logEvent "oDocEvents_Activate" End Sub Private Sub oDocEvents_Deactivate() synchDoc logEvent "oDocEvents_Deactivate" End Sub
© Bricsys NV. All rights reserved. |