BOM - Select all

BOM - Select all

PACDrafting
Collaborator Collaborator
933 Views
3 Replies
Message 1 of 4

BOM - Select all

PACDrafting
Collaborator
Collaborator

Hi

 

If a user opens a BOM. What is the command to select all?

 

I will be writing some code to after this select all is run. It then copies the selection, opens excel and pastes into excel.

 

This is due to the fact that we only want the user to expand the assemblies that are required to be in the BOM. e.g. an off the shelf purchase of a cylinder does not require all parts to be purchased, only the cylinder itself.

 

Another option is replace the assembly of the cylinder as a derived part file, but this will not allow driving constraints. So this will not work.

 

Our customer is not using Item Master unfortunately.

 

Thanks for any help

Paul

0 Likes
Accepted solutions (1)
934 Views
3 Replies
Replies (3)
Message 2 of 4

MechMachineMan
Advisor
Advisor
Accepted solution

Isn't this case what making the parent purchased BOM Structure, and the sub-components either purchased or phantom BOM Structure is intended for?


--------------------------------------
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 4

Owner2229
Advisor
Advisor

I don't know about the selection, but here's how to export BOM "directly":

 

 

Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument

' Set a reference to the BOM
Dim oBOM As BOM = oDoc.ComponentDefinition.BOM

' Set the structured view to 'all levels'
oBOM.StructuredViewFirstLevelOnly = False

' Make sure that the structured view is enabled
oBOM.StructuredViewEnabled = True

' Set a reference to the "Structured" BOMView
Dim oStructuredBOMView As BOMView = oBOM.BOMViews.Item("Structured")

' Export the BOM view to an Excel file
oStructuredBOMView.Export("C:\temp\BOM-StructuredAllLevels.xls", FileFormatEnum.kMicrosoftExcelFormat)

' Another option - to export parts only:
' Make sure that the parts only view is enabled
oBOM.PartsOnlyViewEnabled = True ' Set a reference to the "Parts Only" BOMView Dim oPartsOnlyBOMView As BOMView = oBOM.BOMViews.Item("Parts Only") ' Export the BOM view to an Excel file oPartsOnlyBOMView.Export("C:\temp\BOM-PartsOnly.xls", FileFormatEnum.kMicrosoftExcelFormat)

 

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
Message 4 of 4

PACDrafting
Collaborator
Collaborator

Your right thanks Justin

 

Changing the subcomponents to Phantom removes them from the sub assembly

0 Likes