Grid/Palletizing library and example

  • The question of how to write a program to handle 2D or 3D "grid" type operations (often for palletizing, but there are other operations that need the same mathematical offsets) comes up on a semi-regular basis.

    Long ago (KSS 5.4 era), I was stuck doing this myself, and then ended up with a few weeks with nothing to do, thanks to supplier delays. So I amused myself by writing a general library that would handle any conceivable 1D, 2D, or 3D grid, with offsets, "every other position" patterns, etc, all by just adjusting some standardized variables. I used it for that project, polished it to a high gloss, and then proved its flexibility when the customer threw me a massive curveball by completely changing the pallet-grid pattern of the parts I had to handle (and creating a situation where my "zero" index was actually in the middle, but I still had to pick from one corner to the other raster style).

    So, I bundled up my nice shiny module... and ended up never needing it again. :icon_rolleyes:

    Until this year. I finally got another assignment where I needed to help a co-worker with a grid-style operation, with some odd requirements, pulled out my old module, and... wow! It still works, even under KSS 8.5! :dance:

    So, I decided to clean it up a bit, and post it for posterity. Maybe someone will find it useful. :stupid:

    Now, despite my bragging above, while this is production-tested code, I've never had to use it in a full 3D grid, only 2D, and only X&Y. It's been used for "solid" grid patterns, and "spaced" grids (think a chess board, only using the black squares), plus some patterns that were "solid" on one axis and "spaced" on the other. But not anything more exotic. So while I'm confident this is solid, mostly, there are axes on the test volume that are empty. So to speak. :pfeif:

    So, feel free to rip it apart and tell me what I got wrong. :away:

  • Place your Ad here!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now

Advertising from our partners