A good use for an Object Stack?

T

turbonate

Hello, I've done a bit of searching for how and why to use stacks and
I think I've got a good candidate. But I don't have any experience
creating stacks yet and I'd like to make sure I'm headed in the right
direction. I'll be using a stack as a data storage structure.

I'm creating a program for engineers to specify part inspections based
on an assembly tree. My thought is that I will allow the user to
select a top level assembly that is in a text based file and then read
that text file into a custom object stack. The user can then activate
or deactivate each level of the stack in a similar manner to
MSExplorer and then when getting to an individual part the user
selects an inspection type.

example:
The user wants to measure bearings in an engine.

The user will select a text file with the engine assembly in it. The
macro will load the assmbly tree into a sheet which has the first five
columns set up with checkboxes to enable or disable each level of the
assembly tree (the fifth column being an inspection type). If a level
of the assembly is disabled its children are not visible, similar to
exploring for files in Explorer. The user then browses to the
appropriate part through the assembly tree and selects the measurement
type.

Here's my plan:
I'd like four levels of assemblies with the bottom two levels to have
one of five enumerated inspection types. for example:

..A1() 'assembly level 1
..A2() 'assembly level 2 etc
..A3()
..A4()

enum type:
..InspectionType()

where A3() and A4() can have the .InspectionType() property.

continuing my example, the object stack would look like this:
A1("BaseEngine").A2("RotatingAssembly").A3("Crankshaft").A4("Bearings").InspectionType(COmeasure).enabled
= True

a second approach (or perhaps these are the same?):
A1(1).name = "BaseEngine"
A2(1).name = "RotatingAssembly"
A3(3).name = "Crankshaft"
A4(6).name = "Bearings"

A1(1).A2(1).A3(3).A4(6).InspectionType(COmeasure).enabled = True


Do either of these look like a good approach? If so, which one makes
more sense and how do I create the custom objects and their properties
dynamically based on the imported text file?

Thanks for the help!
I'm using MS office Pro 2003 on Windows XP SP3

Best Regards,
Nate
 
T

turbonate

I read through the whole "when to use a stack" discussion and it seems
like "stack" is not the correct terminology. Maybe I should call this
a custom object tree?

Any help here would be greatly appreciated!
Nate
 
A

Adrian C

Hello, I've done a bit of searching for how and why to use stacks and
I think I've got a good candidate. But I don't have any experience
creating stacks yet and I'd like to make sure I'm headed in the right
direction. I'll be using a stack as a data storage structure.

Look at XML and the use of the DOM, which is data collected in memory as
a stacked heirarchy of Objects. Easy interchange between text and
objects! You are on the way to re-inventing the wheel otherwise.

Also, "bill of materials" is the key term for what you are solving. Lots
of solutions out there.

The treeview control is a nice tool for travelling between nodes but
expect some hair-pulling bugs.
 
R

RB Smissaert

Have been using the treeview a lot and not found any problem sofar.
What bugs did you have in mind?

RBS
 
A

Adrian C

It's mainly me switching between different versions of the control on
different platform builds on Win95/98/NT4.0 and probably XP (can't
remember when I stopped developing on it). I was messing about placing
drop down context menu's at branch nodes and changing icons at the nodes
to echo state of the branch and dependant items. Not strange stuff, but
sometimes the context menu would not drop or the tree would redraw with
missing icon graphics (memory leak?). Long time ago though, current use
may be better - hope so ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top