Message 1 of 22
Updating user parameter with ilogic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
I am trying to change the user parameter of an Asset model from an Assemply.
I would like my user paramter "ID_Number" to be equal to to the item number from the Bill of Materials.
I have used folowing code, but every time i run it, Inventor freezes and crashses...
What is the problem?
Thanks in advance
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") ' Set the Row Merge Settings oBOM.SetPartNumberMergeSettings(False) Dim oBOMRow As BOMRow For Each oBOMRow In oBOMView.BOMRows 'Set a reference to the primary ComponentDefinition of the row 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) ItemNumber = oBOMRow.ItemNumber Parameter(CompFileNameOnly, "ID_Number") = ItemNumber Next