
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
i have this ilogic code provided by @Anonymous that allows me to copy the item number from a part list and past this for each corresponding parts in a model property.
for the item number i have chosen it to fill it in the "stock number field"
i have been trying to adapt this code to run it so it would to the same for the item qty in the bom list, and past it in the status field of each corresponding part, regardless of the level of detail.
if anyone with experience with the i-logic parameter/names that can help me out with a code, or update the current one i am using, would be appreciated.
this is the idea: fill in the stocknumber with item nr data and fill in status with the qty data.
and this is the current code i am using in the assembly:
Sub Main Dim oAssemblyDocument As AssemblyDocument oAssemblyDocument = ThisDoc.Document Dim oAssemblyComponentDefinition As AssemblyComponentDefinition oAssemblyComponentDefinition = oAssemblyDocument.ComponentDefinition 'Get Name of Active LOD NameActiveLOD = oAssemblyComponentDefinition.RepresentationsManager.ActiveLevelOfDetailRepresentation.Name 'Active Master LOD oAssemblyComponentDefinition.RepresentationsManager.LevelOfDetailRepresentations(1).Activate Dim oBOM As BOM oBOM = oAssemblyComponentDefinition.BOM oBOM.StructuredViewEnabled = True oBOM.StructuredViewFirstLevelOnly = False Dim oBOMView As BOMView oBOMView = oBOM.BOMViews(2) 'Structured view Call RecursiveCheckAndSetProps(oBOMView.BOMRows,0) 'Reactive original LOD oAssemblyComponentDefinition.RepresentationsManager.LevelOfDetailRepresentations(NameActiveLOD).Activate End Sub Sub RecursiveCheckAndSetProps(ByVal oRowsElements As BOMRowsEnumerator, indent As Integer) On Error Resume Next For Each oBOMRow As BOMRow In oRowsElements Dim oComponentDefinition As ComponentDefinition oComponentDefinition = oBOMRow.ComponentDefinitions.Item(1) Dim oBOMItemNumber As String oBOMItemNumber = oBOMRow.ItemNumber() 'this is item number in the BOM Dim rDoc As Document = oComponentDefinition.Document Call Check_Prop(rDoc,oBOMItemNumber) If Not oBOMRow.ChildRows Is Nothing Then Call RecursiveCheckAndSetProps(oBOMRow.ChildRows,indent+1) End If Next End Sub Sub Check_Prop(rDoc As Document,oBOMItemNumber As String) Dim oComponentDefinitionPropertySet As PropertySet oComponentDefinitionPropertySet = rDoc.PropertySets.Item("Design Tracking Properties") 'project property tab 'set the Stock Number to the oBOMItemNumber variable oComponentDefinitionPropertySet.Item("Stock Number").Value = oBOMItemNumber End Sub
Solved! Go to Solution.