Chasing my tail on an add-in with a parametric model

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Despite poking around in the forum quite a bit and applying a bit of Google-fu, I'm stuck. Any guidance would be very much appreciated.
I'm building an add-in to automate the creation of "finger joints" in sheet material for use with a laser cutter. The workflow is to have the user select one or more rectangular faces that have their short dimension equal to the material thickness. With the face(s) selected, and the width of a finger set in the UI, clicking Ok causes the script cut the gaps between the fingers on each of the faces. This all works splendidly, even with a fully parametric model, with one exception. I simply cannot figure out how to set things up so that the correct number of gaps are cut. The reason is that the number depends on the length of the face, and that's subject to change if the user adjusts the UserParameters.
In brief, here's how the add-in execution logic works: It iterates over the selected faces. For each face it creates a sketch on the face and adds a 2-point rectangle the width of the face and as long as the gap between the fingers. This is constrained to the correct position on the face. Next a gap is cut (extruded) into the face using the rectangle. Finally, the resulting features are replicated along the face using a rectangular pattern.
The trouble is that the position of the first cut and the quantity the pattern should create depend on the current length of the face, and that can change as the user makes changes to the user parameters. I can, of course, put a driven dimension on the length of the face, but I can't see how to use it in a constraint or with the rectangular pattern. There's a similar problem with the current thickness of the material since that, too, could be some unknown function of some unknown user parameters.
It could be something simple I'm missing, or it could be I've approached this whole thing in a way that won't work. Or maybe it's just not possible to do what I'd like, though that seems unlikely. As I said, any guidance would be much appreciated.