I have calculated a required diameter. I need to lookup the next available size of pipe that's greater than the required value. In Excel, I would use VLOOKUP with EXACT set to false. Does anybody have a handy algorithm for use with size_lookup?
I have calculated a required diameter. I need to lookup the next available size of pipe that's greater than the required value. In Excel, I would use VLOOKUP with EXACT set to false. Does anybody have a handy algorithm for use with size_lookup?
Next available? So simply rounding up wont do you any good. You could add extra lines in the table for every whole number between valid values and round up your input value. You could also modify your input value, like: newinput=
If(originalinput<6,6,if(originalinput<9,9,if(origi nalinput<13,13,17))) where 6,9,13 and 17 are valid lookup values in your table.
ekkonap, you have indeed come up with a better way. I did this:
IF (AND(C D2 01 > 0, NOT(C D2 01 > 250)),16,IF (AND(C D2 01 > 250, NOT(C D2 01 > 438)),21,IF (AND(C D2 01 > 438,
...etc. which enumerates the intervals, but your way reduces the search space each iteration. Thanks!
Is this for Fittings?
Personally I cant stand lookup tables and find using formulas for all sizes to be much more reliable (And formulas should work for any possible size).
You can use nested IF statements as Ekko suggests, but what also works very well is to calculate all sizes using formulas based on the Nominal Diameter of the pipe (Which will always be one of the standard pipe sizes available in Revit).
Use a 'Y = aX + b' formula for a straight line and set the a and b constants to fit the standard/manufacturers data.
This is easy to do in excel, just graph Nominal Diameter against the dimension you want to set and get the constants from a linear regression line.
(Or use Y = aX^2 + bX + c if a linear relationship between sizes is not accurate enough)
This way the fitting works for any (new) possible pipe size and is automatically interpolated to fit. If the pipe sizes in the project are correct then the calculated sizes should also be standard dimensions.
For some sizes the result may be a few millimeters out, but you can use roundup or accept that it is within construction tolerances anyway.
The constants can be set per type, so it is also possible to make a standard fitting family that sizes correctly for multiple material thicknesses or bend radiuses etc, just by setting different values of a and b for the formulas.
I find that this makes very robust, reliable families, which can easily be adapted to new pipe types using Edit Type instead of making new families.
Last edited by josephpeel; January 6th, 2019 at 08:45 PM.
Joseph, not for fittings, but for calculating the pipesin several conduit groupsneeded to accommodate the net cross-sectional area of a mix of AV wires of different EMI susceptibilities. Since the wires themselves change from project to project, I have tables of wire type parameters, notably diameter, that can be updated fairly easily. I'm leery about hard-coding values.
I don't use the Revit conduits - not enough parameters and my discipline isn't responsible to install the pipe, but only to specify some parameters for installation by others. I revisit the idea every few months, though. Thanks for the help.