Copy part number.iam to custom column in BOM with iLogic

Copy part number.iam to custom column in BOM with iLogic

BRLMCHKD
Advocate Advocate
1,973 Views
25 Replies
Message 1 of 26

Copy part number.iam to custom column in BOM with iLogic

BRLMCHKD
Advocate
Advocate

Hi there.

Could someone give me an idea, how to copy part number

to the custom column in BOM by use of iLogic - is it possible?

Thank you Smiley Happy

BRLMCHKD

Copy part number to BOM.jpg

0 Likes
Accepted solutions (3)
1,974 Views
25 Replies
Replies (25)
Message 2 of 26

bradeneuropeArthur
Mentor
Mentor

Create a custom Property ie
"CompPartNumber" with the expression "=<Part Number>" (no "")

 

CompPartNumber.JPG

so no ilogic needed for this

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 3 of 26

clutsa
Collaborator
Collaborator

 

This should set the property to all first level parts...(needs tested against  sub-assemblies)

 

Dim app As Inventor.Application = ThisApplication
Dim doc As AssemblyDocument = app.ActiveDocument
Dim compDef As ComponentDefinition = doc.ComponentDefinition
Dim occ As ComponentOccurrence
For Each occ In compDef.Occurrences
	iProperties.Value(occ.Name, "Custom", "CustomColumnNameHere") = ThisDoc.FileName(False)
Next

I couldn't figure out how to make the custom column show in the BOM though... I imagine you can do an Import BOM Customization with something like

Dim BOM As BOM = compDef.BOM
BOM.ImportBOMCustomization("C:\Users\[userNameHere]\Desktop\CustomBOMExportNameHere.xml")
If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

Message 4 of 26

Curtis_Waguespack
Consultant
Consultant

Hi @BRLMCHKD

 

You can use something like the first example to get the 9 right most characters of the assembly file name and  then write that value to a custom iproperty in each occurrence file.

 

If the part number is not always 9 characters then we could use the ")" character to find the start point of the part number, as in the 2nd example.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Dim HasDrawing_List As New ArrayList
' Get the active document. This assumes it is a part document.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition


oPN = Right(ThisDoc.FileName(False),9)


'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)  
	
	oDDoc = oOccurrence.Definition.Document
	iProperties.Value(oOccurrence.Name, "Custom", "Detail Dwg") = oPN

Next

 

 

Dim HasDrawing_List As New ArrayList
' Get the active document. This assumes it Is a part document.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

Dim oName As String
oName = ThisDoc.FileName(False) 'without extension
'Get length Of file name 
oLen = Len(oName)
'find the postion Of the last ) In the name
oPos = InStrRev(oName, ")",-1) 

'Get middle part Of String starting at
'position Of ), +1 
oPN = Mid(oName,oPos+1,(oLen - oPos) )



'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)  
    
    oDDoc = oOccurrence.Definition.Document
    iProperties.Value(oOccurrence.Name, "Custom", "Detail Dwg") = oPN

Next

 

EESignature

Message 5 of 26

BRLMCHKD
Advocate
Advocate

Hi bradeneurope.

 

Full name.jpg

0 Likes
Message 6 of 26

bradeneuropeArthur
Mentor
Mentor

You asked for the Part Number!

The Part Number is the Same as shown in your pictures.

Partnumber1.PNG

Do you have an overview what you understand with Part Number?

 

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 7 of 26

BRLMCHKD
Advocate
Advocate

Hi.

I have to update my wish, to avoid misunderstandings.

See my updated snag shot of what I'm trying to automate.

Many thanks for all your kind answers Smiley Happy

 

Detail dwg numbering_23.10.2018.jpg

0 Likes
Message 8 of 26

BRLMCHKD
Advocate
Advocate

Hi.

I have tried your iLogic, and found it working, on the basis of the first assumptions I gave in my question.

 

But I have just learned that the Detail Dwg column, must follow the part numbers that vary with different numbers,

in the assembly.

Therefore my question remains open, see my last uploaded revised question Smiley Happy

 

0 Likes
Message 9 of 26

bradeneuropeArthur
Mentor
Mentor

Hi,

Differs your partnumber (Inventor Part Number) in length and format?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 10 of 26

BRLMCHKD
Advocate
Advocate

Hi.

 

Yes my partnumber do differs, but the prefix always starts with the same number of digits like e.g.s below.

10270 HAH20 052 Noz6_45degLeft.ipt

10390 HAH10 025 CbFl1.ipt

10400 HAH30 010 InletNoz.ipt

The digits i wants to copy, is number 7 to 15 (the underlined)  Smiley Happy

KR

 

0 Likes
Message 11 of 26

bradeneuropeArthur
Mentor
Mentor

ok that is clear.

do you like to add a ilogic code to your part(s) or do you like to have an ilogic code in your assembly (only)?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 12 of 26

BRLMCHKD
Advocate
Advocate

Hi.

 

I think the simplest solution for me, would be to have an iLogic code in the assembly Smiley Happy

0 Likes
Message 13 of 26

bradeneuropeArthur
Mentor
Mentor

let's give it a try......

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 14 of 26

bradeneuropeArthur
Mentor
Mentor
Public Sub PartNumber()

Dim a As AssemblyDocument
Set a = ThisApplication.ActiveDocument

Dim b As AssemblyComponentDefinition
Set b = a.ComponentDefinition

Dim c As ComponentOccurrence

For Each c In b.Occurrences

MsgBox c.Name

Dim x As Document

Set x = c.Definition.Document

MsgBox x.DisplayName
Dim Partnumber As String
Partnumber = VBA.Left(x.DisplayName, 15)

Partnumber = VBA.Right(Partnumber, 8)
Dim p As Property
On Error Resume Next
x.PropertySets.Item(4).Add Partnumber, "detail dwg"
If Error Then
Set p = x.PropertySets.Item(4).Item("detail dwg")
p.Value = Partnumber
Err.Clear
End If
MsgBox x.PropertySets.Item(1).Item(1).Name

Next

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 15 of 26

bradeneuropeArthur
Mentor
Mentor

for I logic:

 

 Sub Main()

Dim a As AssemblyDocument
a = ThisApplication.ActiveDocument

Dim b As AssemblyComponentDefinition
b = a.ComponentDefinition

Dim c As ComponentOccurrence

For Each c In b.Occurrences

MsgBox (c.Name)

Dim x As Document

x = c.Definition.Document

MsgBox (x.DisplayName)
Dim Partnumber As String
Partnumber = Left(x.DisplayName, 15)

Partnumber = Right(Partnumber, 8)
Dim p As Inventor.Property
Try
x.PropertySets.Item(4).Add (Partnumber, "detail dwg")	
Catch ex As Exception
	
	End Try
		
p = x.PropertySets.Item(4).Item("detail dwg")
p.Value = Partnumber


MsgBox (x.PropertySets.Item(1).Item(1).Name)

Next
End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 16 of 26

BRLMCHKD
Advocate
Advocate

Hi.

Maybe it's not so simpel / easily to do that task with iLogic (?)

It's no big matter, it had just been a help /smart work around to avoid manually entering these numbers Smiley Happy

 

2_Detail dwg numbering_23.10.2018.jpg

 

0 Likes
Message 17 of 26

bradeneuropeArthur
Mentor
Mentor

please remove the msgboxes.

are you a little familiar with programming?

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 18 of 26

BRLMCHKD
Advocate
Advocate

Hi.

No I am not very familiar with programming, but try with great energy to learn something basic knowledge of iLogic 🙂

But I guess I can just remove the msg boxes with putting the (') in front of them

'MsgBox (#.###)

0 Likes
Message 19 of 26

bradeneuropeArthur
Mentor
Mentor

that is correct...

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 20 of 26

BRLMCHKD
Advocate
Advocate

Hi Brad.

Your rule seems to work correctly, at least partly.

Correcting in BOM of the detail drwg. numbers works correct.

 

But now it seems, that I cannot be able to make 'Copy Design' in Vault, of the particular iam, where I was testing your rule(?)  Do you got a clue of what can be wrong?

 

3_Detail dwg numbering_23.10.2018.jpg

 

 

0 Likes