Drawing BOM Indented?

Drawing BOM Indented?

chayman
Enthusiast Enthusiast
872 Views
6 Replies
Message 1 of 7

Drawing BOM Indented?

chayman
Enthusiast
Enthusiast

When inserting a BOM in a drawing, is there a way for there to be a visual child/parent relationship?

At the moment the only visual relationship is as follows with no indentation:

1.1 

1.2 

2

2.2

 

 

Is there a way to have indentation like:

1

     1.1

     1.2

2

     2.1

     2.2

 

0 Likes
873 Views
6 Replies
Replies (6)
Message 2 of 7

MechMachineMan
Advisor
Advisor
Sub Main()
    delimchar = "."

    Dim oPartsList As PartsList
    oPartsList = ThisDoc.Document.ActiveSheet.PartsLists.Item(1)

    For Each oRow in oPartsList.PartsListRows
        oCurRow = TRIM(oRow.Item(1).Value)
        oSpcCount = Len(oCurRow) - Len(oCurRow.Replace(delimchar, "")) 
        oRow.Item(1).Value = Space(oSpcCount) & oCurRow
    Next
End Sub

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

chayman
Enthusiast
Enthusiast

@MechMachineMan

 

Thanks for you quick response. I have created a rule called "BOM" and inserted the parts list in the drawing for the respective assembly. I run the rule, yet nothing happens to the BOM.

 

It is still:

1

1.1

1.2

etc

 

 

0 Likes
Message 4 of 7

MechMachineMan
Advisor
Advisor

Because you have your parts list style set to "Centered" for the item number column.

 

Indentation only works with a left aligned column....

 

Edit Parts List

Format Column

Click the box to left align the item number column.


--------------------------------------
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 5 of 7

MechMachineMan
Advisor
Advisor

Or use this code with the added justification in as a bandaid fix, instead of properly changing the partslist style to match what you want...

 

Sub Main()
    delimchar = "."

    Dim oPartsList As PartsList
    oPartsList = ThisDoc.Document.ActiveSheet.PartsLists.Item(1)

oPartsList.PartsListColumns.Item(1).ValueHorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextLeft
For Each oRow in oPartsList.PartsListRows oCurRow = TRIM(oRow.Item(1).Value) oSpcCount = Len(oCurRow) - Len(oCurRow.Replace(delimchar, "")) oRow.Item(1).Value = Space(oSpcCount) & oCurRow Next End Sub

 

 


--------------------------------------
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 6 of 7

Anonymous
Not applicable

Hi There, Thank you for your input and help so far. I tried using the code but got an error. Please see the attachment. I would greatly appreciate if you can help debug it.

Many Thanks.

0 Likes
Message 7 of 7

elelieveld
Participant
Participant

If you want the indent to be more pronounced visually, change:

 

oSpcCount = Len(oCurRow) - Len(oCurRow.Replace(delimchar, ""))

to

 

 oSpcCount = (Len(oCurRow) - Len(oCurRow.Replace(delimchar, ""))) * 5
0 Likes