@ekinsb What is the easiest way to do so? Loop the entire select set into a array and then loop the array into the selectset? Or is there a specific method I can use? (But as I read the API there is not?) Document.SelectSet cannot be converted to array.
Dim oSelectedObjectsArray as Object()
For each oObject as Object in oDoc.SelectSet
oSelectedObjectsArray.Add(oObject)
Next
' Update the property
For each oObject as Object in oSelectedObjectsArray
oDoc.SelectSet.Select(oObject)
Next
@MechMachineMan I create a UserControl in Visual Studio for my AddIn and added into a dockable window as subscribed in the programming help (see sample below) only thing that changed is the HWND value this must be set to the UserControl.Handle to load the control into the dockable window.
Dockable window API Sample
Description
This sample demonstrates creating a dockable window and adding a dialog into it.
VBA Sample Code
You need to create the (modeless) dialog and set the hwnd of the dialog in the code below.
Sub DockableWindow()
Dim oUserInterfaceMgr As UserInterfaceManager
Set oUserInterfaceMgr = ThisApplication.UserInterfaceManager
' Create a new dockable window
Dim oWindow As DockableWindow
Set oWindow = oUserInterfaceMgr.DockableWindows.Add("SampleClientId", "TestWindowInternalName", "Test Window")
' Get the hwnd of the dialog to be added as a child
' CHANGE THIS VALUE!
Dim hwnd As Long
hwnd = 4851096
' Add the dialog as a child to the dockable window
Call oWindow.AddChild(hwnd)
' Don't allow docking to top and bottom
oWindow.DisabledDockingStates = kDockTop + kDockBottom
' Make the window visible
oWindow.Visible = True
End Sub
|
My code
Is placed in the UserControl Class
Public Sub New(ByVal Application As Inventor.Application)
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
' Set reference to the Inventor application and store it local
_InvApp = Application
' Set reference to the Application events and store it local
_ApplicationEvents = _InvApp.ApplicationEvents
' Set reference to the user input events and store it local
_UserInputEvents = _InvApp.CommandManager.UserInputEvents
' Add a event handlers to catch the user selection changes
AddHandler _ApplicationEvents.OnActivateDocument, AddressOf Document_Activated
AddHandler _UserInputEvents.OnSelect, AddressOf UserSelect
AddHandler _UserInputEvents.OnUnSelect, AddressOf UserUnSelect
' Set reference to the user interface manager
Dim oUserInterfaceMgr As UserInterfaceManager _
= _InvApp.UserInterfaceManager
' Create a new dockable window
_Browser = oUserInterfaceMgr.DockableWindows.Add("SampleClientId", "DDCIntName", "Ellimetal DDC")
' Add control to the dockable window
_Browser.AddChild(Me.Handle)
' Dock the window to the right
_Browser.DockingState = DockingStateEnum.kDockRight
' Show the title bar
_Browser.ShowTitleBar = True
' Set the dockable window visible
_Browser.Visible = True
' Set the window width
_Browser.Width = 220
End Sub
Problem: Even if I state the the browser.width = 220 this does not work for me. I made a post about this but haven't got any use full feedback. If you manage to size the browser as you like please let me know.
https://forums.autodesk.com/t5/inventor-customization/api-dockable-window-width-not-working/td-p/642...
Please kudo if this post was helpfull
Please accept as solution if your problem was solved
Inventor 2014 SP2