It's a very simple app, and took about 10 minutes to write, but here's the interesting parts in case anyone is interested:
and
/// <summary>
/// Determines the number of balusters needed based on the top railing width
/// </summary>
/// <returns>Baluster count</returns>
public int CalculateBalustersNeeded() {
int numberOfBalusters = Convert.ToInt32(Math.Ceiling(
(this.topRailingWidth - this.spacing) / (this.balusterWidth + this.spacing)));
return numberOfBalusters;
}
Nothing too exciting, really. And Excel probably would have been a better choice than a console app. But since it's all done with more or less "proper" objects (these methods are part of a "RailingSection" class generic collection that's part of a "Deck" object), I can now easily expand this into a full-blown deck design software package. Right. I guess I just can't get enough of coding at work...
/// <summary>
/// Determines the spacing between the post and the baluster.
/// </summary>
/// <param name="balusterCount"># of balusters used.</param>
/// <returns>Spacing at each end in inches</returns>
public float CalculateEndSpacing(int balusterCount) {
//all balusters + spacing without end spacing
float totalUnitWidth = (balusterCount * this.balusterWidth)
+ (this.spacing * (balusterCount - 1));
float endSpacing = (this.topRailingWidth - totalUnitWidth) / 2;
return endSpacing;
}
UPDATE (6/13): Wow, this post is getting a lot of hits by people searching for a baluster calculator - here's the compiled EXE file: BalusterCalc.exe. You'll need the .NET framework 2.0 or higher to run it.
No comments:
Post a Comment