ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   A good use for an Object Stack? (https://www.excelbanter.com/excel-programming/407025-good-use-object-stack.html)

[email protected]

A good use for an Object Stack?
 
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("Cranks haft").A4("Bearings").InspectionType(COmeasure).en abled
= 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

[email protected]

A good use for an Object Stack?
 
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

On Mar 3, 9:27*am, wrote:
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 astackas 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 customobjectstack. *The user can then activate
or deactivate each level of thestackin 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, theobjectstackwould look like this:
A1("BaseEngine").A2("RotatingAssembly").A3("Cranks haft").A4("Bearings").Ins*pectionType(COmeasure).e nabled
= 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



RB Smissaert

A good use for an Object Stack?
 
It sounds you need the treeview control.

RBS


wrote in message
...
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("Cranks haft").A4("Bearings").InspectionType(COmeasure).en abled
= 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



Adrian C[_2_]

A good use for an Object Stack?
 
wrote:
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.

--
Adrian C

RB Smissaert

A good use for an Object Stack?
 
Have been using the treeview a lot and not found any problem sofar.
What bugs did you have in mind?

RBS


"Adrian C" wrote in message
...
wrote:
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.

--
Adrian C



Adrian C[_2_]

A good use for an Object Stack?
 
RB Smissaert wrote:

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


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 ;-)

--
Adrian C


All times are GMT +1. The time now is 09:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com