Select all Assembly Browser Nodes VBA or ILOGIC and Ground

Select all Assembly Browser Nodes VBA or ILOGIC and Ground

frank_schalla
Advocate Advocate
1,074 Views
2 Replies
Message 1 of 3

Select all Assembly Browser Nodes VBA or ILOGIC and Ground

frank_schalla
Advocate
Advocate

During the fact that traversing a assembly structure and grounding each first level component is painfull slow

i see that doing this task by selecting interactiv  all nodes and force a ground via right mouse button is very fast.

So i need a solution via (VBA) to select all nodes in a assembly file (Version is 2015 and above so i mean the entry is starting at 5)

and then start the command ground (AllselectedNodes = True)

 

Thank's for your help

Frank

 

0 Likes
1,075 Views
2 Replies
Replies (2)
Message 2 of 3

MechMachineMan
Advisor
Advisor

Yes it is possible.

 

oPane = ThisApplication.ActiveDocument.BrowserPanes("Model")

oDwgName = oPane.TopNode 'Is the WO# and sheet name
oDwgRes = oDwgName.BrowserNodes.Item("Drawing Resources")
oSktch = oDwgRes.BrowserNodes.Item(4)

 

Code similiar to that will get your there. 

You may need to just have it pre-selected and use a control definition, unless the API supports the method to ground based upon the BrowserNodes collection.

 

Good luck.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 3

Vladimir.Ananyev
Alumni
Alumni

You can avoid an assembly structure traversing using ComponentOccurrences.AllLeafOccurrences() property.  You may filter this collection to select components to be grounded.

You may also access all the unique sub-assemblies via AssemblyDocument.AllReferencedDocuments() collection without traversing the structure.

The following code should toggle the ground state for  the selected components:

Dim oCtrlDef As ControlDefinition
Set oCtrlDef = ThisApplication.CommandManager _
       .ControlDefinitions.Item("AssemblyGroundCtxCmd")
oCtrlDef.Execute

Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes