VB.net: How to use nested ListOf to create Jagged List ?
Posted on 2007-07-31
I'm writing a program to create simple G-code for CNC machining based on creating a chain of lines and arcs. The basic element is a cContour class which defines a single segment (LINE or ARC). I then have a class, cChain, which contains a ListOf (cContour), which defines a single Chain or Loop.
So, I have the capabliltiy to define a boundary or toolpath to machine. Now, for machining a pockiet, I'll need to have a series of chains to remove all the material at the boundary and all areas within. For simple shapes such as a circle (2 semi-circles), the pocket consists of a single chain at each offset layer. This could be handled by having a Class called cToolPath containing a ListOf(cChain).
However, for more complex shapes the toolpath may be separated into multiple chains at each offset layer. For example, let's consider a shape like a butterfly or bowtie which narrows in the middle. At successive offset layers to generate the toolpath, the offset path will yield two chains as the middle section collapses. So, now, I need a jagged list of cChains at each layer. Eseentially, I have a nested ListOf. Unfortunately, I don't know how to get this to work.
I tried to create a new Class called LayerOfChains which contains a ListOf(cChain). I can't seem to be able to retrieve the data from the class using CTYPE. How do I handle having a ListOf ( List Of (cContour)) ??