- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I try to get the BOMStructure of an assembly with ilogic.
With a Part it works fine, but not with an Assembly.
Is there a different between Part and Assembly?
This Rule runs automaticly bevore save the Dokument.
I know where the problem is:
If doc.DocumentType = kPartDocumentObject And doc.ComponentDefinition.BOMStructure = 51970 Then
But I don't know how to fix it.
May someone help?
Here is the ilogic code for the Rule.
THX
'kDefaultBOMStructure=51969 'The Default Structure type.
'kNormalBOMStructure=51970 'The normal Structure type.
'kPhantomBOMStructure=51971 'The phantom Structure type.
'kReferenceBOMStructure=51972 'The reference Structure type.
'kPurchasedBOMStructure=51973 ' The purchased Structure type.
'kInseparableBOMStructure=51974 'The inseparable Structure type.
'kVariesBOMStructure=51975 'The Structure type varies amongst references.
'
'kUnknownDocumentObject
'kPartDocumentObject
'kAssemblyDocumentObject
'kDrawingDocumentObject
'kPresentationDocumentObject
'kDesignElementDocumentObject
'kForeignModelDocumentObject
'kSATFileDocumentObject
'kNoDocument
doc = ThisDoc.Document
InventorVb.DocumentUpdate()
'Part and normal
If doc.DocumentType = kPartDocumentObject And doc.ComponentDefinition.BOMStructure = 51970 Then
iProperties.Value("custom", "10_Werkst./DIN") = doc.PropertySets.Item("Design Tracking Properties").Item("Material").Value
iProperties.Value("custom", "11_Abmessung") = Round(Measure.ExtentsLength,0) & "x" & Round(Measure.ExtentsWidth,0) & "x" & Round(Measure.ExtentsHeight,0)
iProperties.Value("Custom", "Masse")=(Round(iProperties.Mass,2)) &" kg"
End If
'Assembly and inseparable
If doc.DocumentType = kAssemblyDocumentObject And doc.ComponentDefinition.BOMStructure = 51974 Then
iProperties.Value("custom", "10_Werkst./DIN") = doc.PropertySets.Item("Design Tracking Properties").Item("Weld Material").Value
iProperties.Value("custom", "11_Abmessung") = Round(Measure.ExtentsLength,0) & "x" & Round(Measure.ExtentsWidth,0) & "x" & Round(Measure.ExtentsHeight,0)
iProperties.Value("Custom", "Masse")=(Round(iProperties.Mass,2)) &" kg"
End If
If Mid(ThisDoc.FileName(False), 14, 1) = "-" Then
iProperties.Value("custom", "05_Benennung") = Mid(ThisDoc.FileName(False), 22, Len(ThisDoc.FileName(False))-21)
iProperties.Value("custom", "08_Erstzulieferer-Nr.") = Left(ThisDoc.FileName(False), 16)
Else
MessageBox.Show("Dateiname falsch", "Hinweis", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
Solved! Go to Solution.