Centering copies of a component dynamically

I was messing around with the idea of making a dynamic wire mesh panel for sending to the fabricator. Basically, it would allow me to type in the dimensions of the panel and the appropriate spacing, and the lines would populate at the proper intervals.

I have the edge wire figured out, and I know how to make copies of the wire so they populate every 4".

What I’d like to be able to figure out is how to center the inner wires so that if they aren’t divisible by 4", they would split the difference evenly.

I’m sure it has something to do with the component’s starting position, but I can’t figure out the math to make the starting position equidistant from the edge.

I haven’t started building the component yet, but I’ve attached a jpg of what the panels look like.

1 Like

DCs are fiendish things and they have caused me a lot of hair tearing, but does this idea have any legs?

I would be inclined to make the screen in two parts so that one is a mirror copy of the other. That way you know that the closing dimension of the last column of the screen will be the same.

Wow! That’s a nice handrail. Great job!
Does this help?

I don’t think making it equidistant is necessarily the hard part, more how to make the first inner wire a variable distance.

Let’s say you had a distance of 1350mm from the centreline to the edge of your panel and your wires are at 100mm centres. Your formula would start by dividing the distance by 100, giving you 13.5. You would round that down to give the number of wires required and space them at 100mm, leaving a final gap of 50mm. No?

Can you use the round down function in DC? I see a Round function, but I wasn’t sure if that would work all the time.

I thought I had deleted that post! It has an obvious error in it.

I think you can use the rounding function.

My error is that if you are making a half panel it would only work if you have an even number of gaps. For an uneven number you would have to start with a half gap. But you can see the way I am thinking.

Maybe the answer is to start by working out what the combined gap is. Dividing it in half gives the offset to begin with. Then you populate with the right number of vertical wires at 4" spacing and you should end up with te same closing gap as you started with. Thinking aloud a bit here!

Figured it out! Changing the lenY of “Top” will auto-scale the verticals over the span with the proper spacing.
Any recommendation for improvements are welcome.
Infill panel.skp (260.9 KB)

So I finished making this. The problem that I’m having is that when the distribution is equally 2", the formula adds an extra inner wire.

Any thoughts?

Infill panel.skp (278.2 KB)

Would something like this (attached) work?

So, this works for 12", but not for 13", 17", and so on.

I fixed it!

I added an OR function that included Remainder=1, which was the outlier.

What if we try: “Remainder <2” instead of “=0”. This would be a similar logic used for the “Extra” Variable. Please let me know.