- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
Currently working on an ilogic script to classify frame members to number them, and avoid the "section size - length" type part number.
The loose structure of the code is as follows.
Everything is more or less working until I try to add values into the dictionary. I've confirmed I'm pulling the correct data from each part; however it seems like its not possible to dynamically create variables in VB. So, what's currently happening in the code is I only have the one variable in the dictionary, and it's just being overwritten with each new BOM Row (part), or the variable is just being changed everytime it moves on to the next part. In any case, right now I can only enter one line into my dictionary, anyone got any idea how to fix this?
I've attached the full code below, if you create an assembly with 2-3 frame parts and one pair of frames to be identical, you should be able to run the code as intended.
Kind Regards
Roydon Mackay
Open doc, set up BOM all the usual
set assembly counter at 01
Part Numbering Subroutine
set part counter at 01
'For each Bom Row, determine if row is a part/ assembly/ frame assembly
If part assign part number = P - "partcounter" ; part counter += partcounter + 1
If assembly assign part number = A - "Assembly counter"; Assembly counter += 1; run Part numbering subroutine on Child rows
If frame assembly assign part number = A-Frame-"Assembly counter"; Run FrameProcessor subroutine
Frame Processor subroutine;
Create dictionary "Frame dictionary" (framedata, partnumber)
Public Class framedata (create a class to store all variable's to determine if frame is unique)
For each row in bom
populate framedata class from part information;
For each frame data in framedictionary, check if it matches the new part (this is actually done as a function in a few steps but simplified here)
If part is unique, create a new entry into the dictionary and assign a new part number to the frame part
If part is matched, assign the part number of the matched part
Solved! Go to Solution.