Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Need recursion to divide a span until less than a given value


This topic is 4750 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hello all,

I need to divide the span of an opening until the span is less than a given value, each time subtracting the width of the divider.

This is somewhat similar to building a wall and putting in 2x4s until the largest gap is no larger than x. Unlike a wall though, the value isn't based on the center of the 2x4 but on the span between them.

The given parameters and example values are:

span = from 0" to 200"

maxGap = 24"

dividerWidth = 4"

So the span (200") will have one divider (4") inserted, leaving two even gaps of 98" each. One more divider will be added incrementally until the evenly sized gaps between dividers is less than the maxGap (24")

Thanks for your help!

Posted

Recursion is not necessary.

Number fields: Span, maxGap, and dividerWidth.

Calculation fields:

Divisions = If(not IsEmpty(span) and not IsEmpty(maxGap) and not IsEmpty(dividerWidth); Ceiling(span/(maxGap+dividerWidth));"")

DividerCount = Divisions - 1

Gap = (span - (dividerWidth*dividerCount))/Divisions

  • Like 1
Posted

Wow!

Thank you very much doughemi. That's a very complete, concise and comprehensive answer. And just what I needed.

This topic is 4750 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.