Angehängt ein ADDIN welches ein Kontextmenü innerhalb der Diva erzeugt.
Ich will erreichen das bei Anwahl ein bereits geladenes Macro (VBA) gestartet wird.
Der Eintrag wird erzeugt (siehe Angehängte DLL.
But nothing happens
*************************************
Option Explicit
Implements ApplicationAddInServer
Private oApp As Inventor.Application
Private WithEvents oInputEvents As UserInputEvents
Private WithEvents oFaceAreaButton As ButtonDefinitionHandler
Private oFace As Face
Private Sub ApplicationAddInServer_Activate(ByVal AddInSiteObject As Inventor.ApplicationAddInSite, ByVal FirstTime As Boolean)
Set oApp = AddInSiteObject.Application
Set oInputEvents = oApp.CommandManager.UserInputEvents
' Create a new command that will be used later on the context menu.
Set oFaceAreaButton = AddInSiteObject.CreateButtonDefinitionHandler("MySampleContextCommand", kQueryOnlyCmdType, "Senden an IV NATIV")
End Sub
Private Property Get ApplicationAddInServer_Automation() As Object
Set ApplicationAddInServer_Automation = Nothing
End Property
Private Sub ApplicationAddInServer_Deactivate()
Set oFace = Nothing
Set oFaceAreaButton = Nothing
Set oInputEvents = Nothing
Set oApp = Nothing
End Sub
Private Sub ApplicationAddInServer_ExecuteCommand(ByVal CommandID As Long)
' Not used.
End Sub
Private Sub oFaceAreaButton_OnClick()
On Error Resume Next
Dim oVBAProject As InventorVBAProject
Dim oVBAComponent As InventorVBAComponent
Dim oVBAMember As InventorVBAMember
Set oVBAProject = Nothing
Dim oApp As Inventor.Application
Set oApp = GetObject(, "Inventor.Application")
Set oVBAMember = oVBAComponent.InventorVBAMembers.Item("Inventor_nativ")
oVBAMember.Execute
End Sub
Private Sub oInputEvents_OnContextMenu(ByVal SelectionDevice As Inventor.SelectionDeviceEnum, ByVal AdditionalInfo As Inventor.NameValueMap, ByVal CommandBar As Inventor.CommandBar)
Dim oDoc As Document
Set oDoc = oApp.ActiveDocument
' Do some trivial rejects first to determine if we're in a valid context for a
' face to be selected.
Dim oControl As CommandBarControl
Set oControl = CommandBar.Controls.Add(kBarControlButton, oFaceAreaButton.ControlDefinition, 2)
oControl.GroupBegins = True
End Sub
------------------
Es gab mal Zeiten, da haben wir und gefreut im 2D Ansichten gemalt zu haben.
Lasst uns dies nicht vergessen wenn wir Ansichten erstellt bekommen
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP