Jump to content
Server Maintenance This Week. ×

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


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

Recommended Posts

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!

Link to comment
Share on other sites

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
Link to comment
Share on other sites

This topic is 4529 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.