Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
in reply to: Anonymous

Update We have the QTYs adding up correctly now I am working on the Job Number. I have manipulated the rule we used for the QTY to try to make the Job Number work. I have this in a test file so the actual variable we are pulling the number from is liable to change I was using something that we do not use currently.

 

The issue I get now is this will not adjust the sub components inside sub assemblies (If a Sub assembly has another sub assembly inside it) This also doesn't reset the Job # on parts inside sub assemblies that it actually works on the first time. I'm kind of looking for an idea of what I'm doing wrong I know there probably other methods to doing this but the goal is to do it automatically behind the scenes since this shop wants things to be as simple and with less interactions as possible. The veteran in here is mad that Inventor requires more clicks then MDT. Since we are working on large machine layouts at a time we are using multiple Sub Assemblies to keep our structure somewhat manageable.

 

Here is my Code

 

doc = ThisDoc.Document
Dim oAssyDef As AssemblyComponentDefinition = doc.ComponentDefinition
Dim oBOM As BOM = oAssyDef.BOM

oBOM.StructuredViewEnabled = True

Dim oBOMView As BOMView = oBOM.BOMViews.Item("Structured")

Dim oBOMRow As BOMRow

For Each oBOMRow In OBOMView.BOMRows
Dim oCompDef As ComponentDefinition
oCompDef = OBOMRow.ComponentDefinitions.Item(1)

Dim CompFullDocumentName As String = oCompDef.Document.FullDocumentName
Dim CompFileNameOnly As String
Dim index As Integer = CompFullDocumentName.lastindexof("\")

CompFileNameOnly = CompFullDocumentName.substring(index+1)

iProperties.Value(CompFileNameOnly, "Custom" , "JOB #") = iProperties.Value ("Project" , "Project")

Next