Beispiel #1
0
        public float[] FindOptimalNumberOfMods(float leftFiller, float rightFiller)
        {
            float numberOfMods   = 0;
            float optimalModSize = 0;
            float remainingWallLength;

            remainingWallLength  = calculateWorkableSpace();
            remainingWallLength -= (leftFiller + rightFiller);

            if (remainingWallLength > Constants.SOFT_MAX_WINDOW_SIZE)
            {
                numberOfMods   = 1;
                optimalModSize = remainingWallLength;

                while (optimalModSize > Constants.SOFT_MAX_WINDOW_SIZE)
                {
                    numberOfMods++;
                    optimalModSize = remainingWallLength / numberOfMods;
                }
            }

            optimalModSize = GlobalFunctions.RoundDownToNearestEighthInch(optimalModSize);

            float extraFiller = remainingWallLength - (optimalModSize * numberOfMods);

            float fillerOne = 2f;
            float fillerTwo = 2f;

            GlobalFunctions.splitFillerToOutside(ref fillerOne, ref fillerTwo, extraFiller);

            return(new float[] { numberOfMods, optimalModSize, extraFiller });
        }
Beispiel #2
0
        public float[] FindOptimalLengthOfWindowModsGivenSpace(float sentSpace, float MIN_MOD_WIDTH, float MAX_MOD_WIDTH)
        {
            int   windowCounter   = 0;
            float finalWindowSize = 0;
            float spaceRemaining  = sentSpace;

            while (spaceRemaining >= MIN_MOD_WIDTH)
            {
                if (spaceRemaining >= MAX_MOD_WIDTH)
                {
                    spaceRemaining -= MAX_MOD_WIDTH;
                    windowCounter++;
                }
                else if (spaceRemaining < MAX_MOD_WIDTH && spaceRemaining > MIN_MOD_WIDTH)
                {
                    spaceRemaining = 0;
                    windowCounter++;
                }
                else if (spaceRemaining == MIN_MOD_WIDTH)
                {
                    spaceRemaining = 0;
                    windowCounter++;
                }
            }

            if (spaceRemaining > 0 && windowCounter > 0)
            {
                //Should never get here? will always hit one of the spaceRemaining=0 above
                windowCounter++;
                finalWindowSize = sentSpace / windowCounter;
                spaceRemaining  = 0;
            }
            else if (spaceRemaining > 0 && windowCounter == 0)
            {
                //Should never get here? will always hit one of the spaceRemaining=0 above
                //add spaceRemaining to filler
                //fillFiller(space, wall, start);
                //spaceRemaining = 0;
            }
            else
            {
                finalWindowSize = sentSpace / windowCounter;
            }

            float roundedWindowSize = GlobalFunctions.RoundDownToNearestEighthInch(finalWindowSize);

            //Set space remaining equal to amount lost via rounding
            //spaceRemaining += finalWindowSize - roundedWindowSize;
            spaceRemaining = sentSpace - (roundedWindowSize * windowCounter);

            //Need to return space * windowcounter, since we lost that amount PER WINDOW
            float[] anArray = { roundedWindowSize, windowCounter, spaceRemaining };
            return(anArray);
        }
Beispiel #3
0
        public float[] FindMaximumNumberOfMods(float leftFiller, float rightFiller)
        {
            float numberOfMods   = 0;
            float optimalModSize = 0;
            float remainingWallLength;

            remainingWallLength  = calculateWorkableSpace();
            remainingWallLength -= (leftFiller + rightFiller);

            numberOfMods   = (float)((int)(remainingWallLength / Constants.SOFT_MIN_MOD_SIZE));
            optimalModSize = remainingWallLength / numberOfMods;

            optimalModSize = GlobalFunctions.RoundDownToNearestEighthInch(optimalModSize);

            float extraFiller = remainingWallLength - (optimalModSize * numberOfMods);

            float fillerOne = 2f;
            float fillerTwo = 2f;

            GlobalFunctions.splitFillerToOutside(ref fillerOne, ref fillerTwo, extraFiller);

            return(new float[] { numberOfMods, optimalModSize, extraFiller });
        }
Beispiel #4
0
        protected void btnFinalButton_Click(object sender, EventArgs e)//
        {
            //Check roof type
            //Get room projection and width from session and set our roofs projection and width to those
            float roofProjection  = Convert.ToSingle(Session["sunroomProjection"]);
            float roofProjection1 = Convert.ToSingle(Session["sunroomProjection"]);
            float roofProjection2 = Convert.ToSingle(Session["sunroomProjection"]);
            float roofWidth       = Convert.ToSingle(Session["sunroomWidth"]);

            //We also get slope of room, and soffit length
            float roofSlope    = Convert.ToSingle(Session["roofSlope"]);
            float soffitLength = Convert.ToSingle(Session["soffitLength"]);

            Session.Add("roofLedgerSetback", hidLedgerSetback.Value);
            Session.Add("roofFrontSetback", hidFrontSetback.Value);
            Session.Add("roofSidesSetback", hidSidesSetback.Value);
            Session.Add("roofJointSetback", hidJointSetback.Value);

            #region Gable System
            //if gable, we need two studio roof systems and additional logic
            if (Session["newProjectRoofType"] == "Dealer Gable" || Session["newProjectRoofType"] == "Sunspace Gable")
            {
                #region Old Symmetrical Gable Code
                ////If they've entered manual dimensions, we don't need to calculate overhang
                //if (hidProjection.Value != "")
                //{
                //    //However, if its smaller than the room, we need to throw an error
                //    if (Convert.ToSingle(hidProjection.Value) >= roofProjection)
                //    {
                //        //Since its valid, just set our sizes to the specified
                //        roofProjection = Convert.ToSingle(hidProjection.Value);
                //        roofWidth = Convert.ToSingle(hidWidth.Value);
                //    }
                //}
                //else
                //{
                //    roofProjection += (Convert.ToSingle(hidOverhang.Value) * 2);
                //    roofWidth += (Convert.ToSingle(hidOverhang.Value) * 2);
                //}

                ////Convert the room projection into actual roof projection
                //roofProjection = (float)Math.Sqrt(Math.Pow(2*roofProjection, 2));
                //roofProjection /= 2; //divide by 2 for each part of a gable

                ////Convert to nearest eighth inch
                //roofProjection *= 8;
                //int intRoofProjection = Convert.ToInt32(roofProjection);
                //roofProjection = intRoofProjection / 8f;
                //roofProjection *= 2; //remultiply to get whole projection

                //Now that we have roof rojection and width, add it to session.
                //Session.Add("roofProjection", (roofProjection));
                //Session.Add("roofWidth", roofWidth);
                #endregion

                List <Wall> listOfWalls = (List <Wall>)Session["listOfWalls"];

                //Loop through walls to find gable post
                for (int i = 0; i < listOfWalls.Count; i++)
                {
                    float     foundBoxHeaderReceiver = 0f;
                    BoxHeader aBoxHeader             = null;

                    for (int j = 0; j < listOfWalls[i].LinearItems.Count; j++)
                    {
                        if (listOfWalls[i].LinearItems[j].ItemType == "BoxHeader")
                        {
                            aBoxHeader = (BoxHeader)listOfWalls[i].LinearItems[j];
                            if (aBoxHeader.IsReceiver == true)
                            {
                                foundBoxHeaderReceiver = aBoxHeader.FixedLocation;
                                break;
                            }
                        }
                    }

                    //If start != end, it's part of a sloped front wall on Dealer Gables
                    if (listOfWalls[i].StartHeight < listOfWalls[i].EndHeight)
                    {
                        //roofProjection1 = Convert.ToSingle(hidOverhang.Value) + listOfWalls[i].Length + 2.125f;
                        //roofProjection2 = Convert.ToSingle(hidOverhang.Value) + listOfWalls[i+1].Length + 2.125f;
                        break;
                    }

                    //If it found a boxheader receiever, then it is the gable-frontwall of a sunspace gable
                    if (foundBoxHeaderReceiver > 0f)
                    {
                        //a^2 + b^2 = c^2, +overhang value, gives projection of a roof panel

                        roofProjection1 = GlobalFunctions.RoundDownToNearestEighthInch(Convert.ToSingle(hidOverhang.Value) + (float)Math.Sqrt((float)Math.Pow((foundBoxHeaderReceiver + (aBoxHeader.Length / 2)), 2) + (float)Math.Pow(listOfWalls[i].GablePeak - listOfWalls[i].StartHeight, 2)));
                        roofProjection2 = GlobalFunctions.RoundDownToNearestEighthInch(Convert.ToSingle(hidOverhang.Value) + (float)Math.Sqrt((float)Math.Pow((listOfWalls[i].Length - (aBoxHeader.Length / 2) - foundBoxHeaderReceiver), 2) + (float)Math.Pow(listOfWalls[i].GablePeak - listOfWalls[i].StartHeight, 2)));
                        break;
                    }
                }

                Session.Add("roofProjection1", (roofProjection1));
                Session.Add("roofProjection2", (roofProjection2));
                Session.Add("roofWidth", roofWidth);

                //A studio roof will only have one list entry, while a gable will have two
                List <RoofModule> gableModules = buildGableRoofModule(roofProjection1, roofProjection2, roofWidth);

                bool isFireProtected = false;
                bool isThermadeck    = false;
                bool hasGutters      = false;
                bool gutterPro       = false;

                if (hidPanelType.Value.Contains("FP") && hidSystem.Value == "Traditional")
                {
                    isFireProtected = true;
                }

                if (hidSystem.Value == "Thermadeck")
                {
                    if (chkBarrier.Checked == true)
                    {
                        isFireProtected = true;
                    }
                    isThermadeck = true;
                }

                if (hidGutterPresence.Value == "Yes")
                {
                    hasGutters = true;
                }

                if (hidGutterPro.Value == "Yes")
                {
                    gutterPro = true;
                }

                string gutterColour = hidGutterColour.Value;
                if (hasGutters == false)
                {
                    gutterColour = "NA";
                }

                if (hidExtraDownspouts.Value == "")
                {
                    hidExtraDownspouts.Value = "0";
                }

                //changeme hardcoded supports to 0
                Roof aRoof = new Roof("Dealer Gable", hidInteriorRoofSkin.Value, hidExteriorRoofSkin.Value, Convert.ToSingle(hidThickness.Value), isFireProtected, isThermadeck, hasGutters, gutterPro, gutterColour, hidStripeColour.Value, hidAcrylicColour.Value, 0, Convert.ToInt32(hidExtraDownspouts.Value), roofProjection, roofWidth, gableModules);
                Session.Add("completedRoof", aRoof);

                Response.Redirect("SkylightWizard.aspx");
            }
            #endregion

            #region Studio System
            //studio system
            else
            {
                //Subtract soffit length as that will be the true start point of the roof
                roofProjection -= Convert.ToSingle(Session["soffitLength"]);

                //If they've entered manual dimensions, we don't need to calculate overhang
                if (hidProjection.Value != "")
                {
                    //However, if its smaller than the room, we need to throw an error
                    if (Convert.ToSingle(hidProjection.Value) >= roofProjection)
                    {
                        //Since its valid, just set our sizes to the specified
                        roofProjection = Convert.ToSingle(hidProjection.Value);
                        roofWidth      = Convert.ToSingle(hidWidth.Value);
                    }
                }
                else
                {
                    roofProjection += (Convert.ToSingle(hidOverhang.Value));
                    roofWidth      += (Convert.ToSingle(hidOverhang.Value) * 2);
                }

                //Convert the room projection into actual roof projection
                float actualSlope = (Convert.ToSingle(Session["roofSlope"])) / 12;
                float roofRise    = actualSlope * roofProjection;

                roofProjection = (float)Math.Sqrt(Math.Pow(roofRise, 2) + Math.Pow(roofProjection, 2));

                //Convert to nearest eighth inch
                roofProjection *= 8;
                int intRoofProjection = Convert.ToInt32(roofProjection);
                roofProjection = intRoofProjection / 8f;

                //Now that we have roof rojection and width, add it to session.
                Session.Add("roofProjection", roofProjection);
                Session.Add("roofWidth", roofWidth);

                //A studio roof will only have one list entry, while a gable will have two
                List <RoofModule> aModuleList = new List <RoofModule>();
                aModuleList.Add(buildStudioRoofModule(roofProjection, roofWidth));

                bool isFireProtected = false;
                bool isThermadeck    = false;
                bool hasGutters      = false;
                bool gutterPro       = false;

                if (hidPanelType.Value.Contains("FP") && hidSystem.Value == "Traditional")
                {
                    isFireProtected = true;
                }

                if (hidSystem.Value == "Thermadeck")
                {
                    if (chkBarrier.Checked == true)
                    {
                        isFireProtected = true;
                    }
                    isThermadeck = true;
                }

                if (hidGutterPresence.Value == "Yes")
                {
                    hasGutters = true;
                }

                if (hidGutterPro.Value == "Yes")
                {
                    gutterPro = true;
                }

                string gutterColour = hidGutterColour.Value;
                if (hasGutters == false)
                {
                    gutterColour = "NA";
                }

                if (hidExtraDownspouts.Value == "")
                {
                    hidExtraDownspouts.Value = "0";
                }

                //changeme hardcoded supports to 0
                Roof aRoof = new Roof("Studio", hidInteriorRoofSkin.Value, hidExteriorRoofSkin.Value, Convert.ToSingle(hidThickness.Value), isFireProtected, isThermadeck, hasGutters, gutterPro, gutterColour, hidStripeColour.Value, hidAcrylicColour.Value, 0, Convert.ToInt32(hidExtraDownspouts.Value), roofProjection, roofWidth, aModuleList);
                Session.Add("completedRoof", aRoof);

                Response.Redirect("SkylightWizard.aspx");
            }
            #endregion
        }
Beispiel #5
0
        public void FillSpaceWithWindows(string windowType, string windowColour, string framingColour, int numberOfVents, float kneewallHeight, string kneewallType, string transomType,
                                         bool sunshade, string valance, string fabric, string openness, string chain, string screenType, double railing)
        {
            float currentLocation = 0f;

            //Loop through linear items using currentLocation to keep track
            for (int i = 0; i <= LinearItems.Count; i++)//
            {
                try
                {
                    //If an item starts at this location, we aren't in a workable area
                    if (LinearItems[i].FixedLocation == currentLocation)
                    {
                        //We set the location equal to the length of the linear item, which is the end of it
                        currentLocation += LinearItems[i].Length;
                    }
                    //Item must start after current
                    else if (LinearItems[i].FixedLocation > currentLocation)
                    {
                        //The space is equal to where the next item starts - current location
                        float space = LinearItems[i].FixedLocation - currentLocation;
                        float numOfWindowsInThisSpace = 1; //If the space is too large for one window mod, we need this many
                        float eachSpace = space;           //If the space is too large for one window mod, we'll have a # of mods of this size

                        float MAX_MOD_WIDTH = 0;
                        float MIN_MOD_WIDTH = 0;

                        switch (windowType)
                        {
                        case "Fixed Vinyl":
                            MIN_MOD_WIDTH = Constants.VINYL_TRAP_MIN_WIDTH_WARRANTY;     //We use the trap version because they can have both
                            MAX_MOD_WIDTH = Constants.VINYL_TRAP_MAX_WIDTH_WARRANTY;
                            break;

                        case "Fixed Glass 2\"":
                            MIN_MOD_WIDTH = Constants.VINYL_TRAP_MIN_WIDTH_WARRANTY;     //We use the trap version because they can have both
                            MAX_MOD_WIDTH = Constants.VINYL_TRAP_MAX_WIDTH_WARRANTY;
                            break;

                        case "Fixed Glass 3\"":
                            MIN_MOD_WIDTH = Constants.VINYL_TRAP_MIN_WIDTH_WARRANTY;     //We use the trap version because they can have both
                            MAX_MOD_WIDTH = Constants.VINYL_TRAP_MAX_WIDTH_WARRANTY;
                            break;

                        case "Vertical 4 Track":
                            MIN_MOD_WIDTH = Constants.V4T_4V_MIN_WIDTH_WARRANTY;     //We use the trap version because they can have both
                            MAX_MOD_WIDTH = Constants.V4T_4V_MAX_WIDTH_WARRANTY;
                            break;

                        case "Horizontal 2 Track":
                        case "Horizontal Roller":
                            MIN_MOD_WIDTH = Constants.HORIZONTAL_ROLLER_MIN_WIDTH_WARRANTY;     //We use the trap version because they can have both
                            MAX_MOD_WIDTH = Constants.HORIZONTAL_ROLLER_MAX_WIDTH_WARRANTY;
                            break;

                        case "Single Slider":
                            MIN_MOD_WIDTH = Constants.SINGLE_SLIDER_MIN_WIDTH_WARRANTY;     //We use the trap version because they can have both
                            MAX_MOD_WIDTH = Constants.SINGLE_SLIDER_MAX_WIDTH_WARRANTY;
                            break;

                        case "Double Slider":
                            MIN_MOD_WIDTH = Constants.DOUBLE_SLIDER_MIN_WIDTH_WARRANTY;     //We use the trap version because they can have both
                            MAX_MOD_WIDTH = Constants.DOUBLE_SLIDER_MAX_WIDTH_WARRANTY;
                            break;

                        case "Open Wall":
                            MIN_MOD_WIDTH = Constants.V4T_4V_MIN_WIDTH_WARRANTY;     //We use the trap version because they can have both
                            MAX_MOD_WIDTH = Constants.V4T_4V_MAX_WIDTH_WARRANTY;
                            break;

                        case "Solid Wall":
                            MIN_MOD_WIDTH = Constants.V4T_4V_MIN_WIDTH_WARRANTY;     //We use the trap version because they can have both
                            MAX_MOD_WIDTH = Constants.V4T_4V_MAX_WIDTH_WARRANTY;
                            break;

                        case "Screen":
                            MIN_MOD_WIDTH = Constants.SCREEN_MIN_WIDTH_WARRANTY;     //We use the trap version because they can have both
                            MAX_MOD_WIDTH = Constants.SCREEN_MAX_WIDTH_WARRANTY;
                            break;
                        }

                        //Find optimal lengths of window mods given space
                        float[] windowSpecifics = FindOptimalLengthOfWindowModsGivenSpace(space, MIN_MOD_WIDTH, MAX_MOD_WIDTH);

                        float height;

                        //Loop mod creation for each window counted in this space
                        for (int windowCounter = 0; windowCounter < windowSpecifics[1]; windowCounter++)
                        {
                            //We have a space, so create a window mod to fill it
                            Mod aMod = new Mod();
                            aMod.FixedLocation = currentLocation;
                            aMod.StartHeight   = GetHeightAtLocation(currentLocation);
                            aMod.EndHeight     = GetHeightAtLocation(currentLocation + windowSpecifics[0]);
                            aMod.ItemType      = "Mod";
                            aMod.Length        = windowSpecifics[0];
                            if (windowCounter == 0)
                            {
                                aMod.Length += windowSpecifics[2];
                            }
                            aMod.ModType          = "Window";
                            aMod.Sunshade         = sunshade;
                            aMod.SunshadeValance  = valance;
                            aMod.SunshadeFabric   = fabric;
                            aMod.SunshadeOpenness = openness;
                            aMod.SunshadeChain    = chain;

                            height = Math.Max(aMod.StartHeight, aMod.EndHeight);

                            //Check for kneewall info
                            if (kneewallHeight > 0)
                            {
                                //Have one
                                Kneewall aKneewall = new Kneewall();
                                aKneewall.FEndHeight = aKneewall.FStartHeight = kneewallHeight;
                                aKneewall.EndHeight  = aKneewall.StartHeight = kneewallHeight - 2.125f;
                                height -= kneewallHeight; //Remove this from usable height, as the kneewall takes it up
                                aKneewall.KneewallType = kneewallType;
                                aKneewall.ItemType     = "Kneewall";
                                aKneewall.FLength      = aMod.Length - 2;
                                aMod.ModularItems.Add(aKneewall);
                            }

                            float highestPunch = 0f;
                            //Kneewall will have been added now, or not, either way we add the window
                            //find highest punch
                            for (int j = 0; j < LinearItems.Count; j++)
                            {
                                if (LinearItems[j].ItemType == "Mod")
                                {
                                    Mod tempMod = (Mod)LinearItems[j];

                                    if (tempMod.ModType == "Door")
                                    {
                                        //check 0 because door will always be first item in door mod
                                        if (((Door)tempMod.ModularItems[0]).Punch > highestPunch)
                                        {
                                            highestPunch = ((Door)tempMod.ModularItems[0]).Punch;
                                        }
                                    }
                                }
                            }

                            //If punch is 0 at this point there are no doors, in such a case, we will set the punch to be a set distance below the min height of the wall
                            //That way we arbitrarily set a location for the transom to start and maintain consistency.
                            if (highestPunch == 0)
                            {
                                highestPunch = GlobalFunctions.RoundDownToNearestEighthInch(Math.Min(StartHeight, EndHeight) - 4.125F - Constants.KNEEWALL_PUNCH); //changeme based on type
                            }
                            //Now we know where the ending height is, so we subtract kneewall to get the height of the window
                            //Punch takes up space too, so subtract it as well
                            float windowHeight = highestPunch - kneewallHeight - Constants.KNEEWALL_PUNCH;
                            //Create the window
                            Window aWindow = new Window();
                            aWindow.FEndHeight  = aWindow.FStartHeight = windowHeight; //CHANGEME hardcoded 2.125
                            aWindow.RightHeight = aWindow.LeftHeight = windowHeight - 2.125f;
                            aWindow.FLength     = aMod.Length - 2;
                            aWindow.Width       = aWindow.FLength - 2.125f; //CHANGEME hardcoded
                            aWindow.Colour      = windowColour;
                            aWindow.FrameColour = framingColour;
                            aWindow.ItemType    = "Window";
                            aWindow.NumVents    = numberOfVents;
                            aWindow.ScreenType  = screenType; //fixt
                            aWindow.WindowStyle = windowType;

                            //Check for spreader bar boolean
                            if (windowType == "Vertical 4 Track" && aWindow.FLength > Constants.V4T_SPREADER_BAR_NEEDED)
                            {
                                aWindow.SpreaderBar = (aWindow.FLength / 2) - (Constants.SPREADER_BAR_SIZE / 2); //Find center of window, then place center of spreader bar at that position (by subtracting half of it)
                            }
                            if (windowType == "Horizontal Roller" && aWindow.FLength > Constants.HORIZONTAL_ROLLER_SPREADER_BAR_NEEDED)
                            {
                                aWindow.SpreaderBar = (aWindow.FEndHeight / 2) - (Constants.SPREADER_BAR_SIZE / 2);
                                aWindow.WindowStyle = "Horizontal Roller XO";
                            }
                            if (windowType == "Vinyl")
                            {
                                if (aWindow.FLength > Constants.TRANSOM_SPREADER_BAR_REQUIRED || aWindow.FEndHeight > Constants.TRANSOM_SPREADER_BAR_REQUIRED || aWindow.FStartHeight > Constants.TRANSOM_SPREADER_BAR_REQUIRED)
                                {
                                    //If length is longer, vertical bar, else horizontal bar
                                    if (aWindow.Width >= aWindow.FEndHeight && aWindow.Width >= aWindow.FStartHeight)
                                    {
                                        aWindow.SpreaderBar = (aWindow.FLength / 2) - (Constants.SPREADER_BAR_SIZE / 2);
                                    }
                                    else
                                    {
                                        aWindow.SpreaderBar = (aWindow.FEndHeight / 2) - (Constants.SPREADER_BAR_SIZE / 2);
                                    }
                                    //If dimensions are equal?
                                }
                            }

                            aWindow.IntegratedRailing = railing;

                            aMod.ModularItems.Add(aWindow);

                            //Now we handle transom
                            float modStartWallHeight = GlobalFunctions.getHeightAtPosition(StartHeight, EndHeight, currentLocation, Length);
                            float modEndWallHeight   = GlobalFunctions.getHeightAtPosition(StartHeight, EndHeight, (currentLocation + aMod.Length), Length);
                            float spaceAbovePunch    = Math.Max(modStartWallHeight, modEndWallHeight) - highestPunch - .25f; //Punch physical space

                            float[] transomInfo = GlobalFunctions.findOptimalHeightsOfWindows(spaceAbovePunch, transomType);

                            if (StartHeight == EndHeight)
                            {
                                //rectangular window
                                for (int currentWindow = 0; currentWindow < transomInfo[0]; currentWindow++)
                                {
                                    //Set window properties
                                    Window aTransom = new Window();
                                    aTransom.FEndHeight  = aTransom.FStartHeight = transomInfo[1];        //Window with frame
                                    aTransom.RightHeight = aTransom.LeftHeight = transomInfo[1] - 2.125f; //Window itself
                                    aTransom.Colour      = windowColour;
                                    aTransom.ItemType    = "Window";
                                    aTransom.FLength     = aMod.Length - 2;
                                    aTransom.Width       = aTransom.FLength - 2.125f;
                                    aTransom.WindowStyle = transomType;
                                    if (currentWindow == 0)
                                    {
                                        aTransom.FEndHeight   += transomInfo[2];
                                        aTransom.FStartHeight += transomInfo[2];
                                        aTransom.RightHeight  += transomInfo[2];
                                        aTransom.LeftHeight   += transomInfo[2];
                                    }

                                    if (aTransom.FLength > Constants.TRANSOM_SPREADER_BAR_REQUIRED || aTransom.FEndHeight > Constants.TRANSOM_SPREADER_BAR_REQUIRED || aTransom.FStartHeight > Constants.TRANSOM_SPREADER_BAR_REQUIRED)
                                    {
                                        //If length is longer, vertical bar, else horizontal bar
                                        if (aTransom.Width > aTransom.FEndHeight && aTransom.Width > aTransom.FStartHeight)
                                        {
                                            aTransom.SpreaderBar = (aTransom.FLength / 2) - (Constants.SPREADER_BAR_SIZE / 2);
                                        }
                                        else
                                        {
                                            aTransom.SpreaderBar = (aTransom.FEndHeight / 2) - (Constants.SPREADER_BAR_SIZE / 2);
                                        }
                                        //If dimensions are equal?
                                    }
                                    aMod.ModularItems.Add(aTransom);
                                }
                            }
                            else
                            {
                                //trapezoid
                                float nextTransomHeight;

                                //If start wall is higher, lower end height
                                if (modStartWallHeight == Math.Max(modStartWallHeight, modEndWallHeight))
                                {
                                    nextTransomHeight = transomInfo[1];
                                }
                                else
                                {
                                    nextTransomHeight = transomInfo[1] - (Math.Max(modStartWallHeight, modEndWallHeight) - Math.Min(modStartWallHeight, modEndWallHeight));
                                }

                                for (int currentWindow = 0; currentWindow < transomInfo[0]; currentWindow++)
                                {
                                    //Set window properties
                                    Window aTransom = new Window();
                                    aTransom.Colour      = windowColour;
                                    aTransom.ItemType    = "Window";
                                    aTransom.FLength     = aMod.Length - 2;
                                    aTransom.Width       = aMod.Length - 2 - 2.125f;
                                    aTransom.WindowStyle = transomType;

                                    aTransom.FStartHeight = nextTransomHeight;
                                    aTransom.LeftHeight   = aTransom.FStartHeight - 2.125f;
                                    //If start wall is higher, lower end height
                                    if (modStartWallHeight == Math.Max(modStartWallHeight, modEndWallHeight))
                                    {
                                        aTransom.FEndHeight = aTransom.FStartHeight - (modStartWallHeight - modEndWallHeight);
                                    }
                                    else
                                    {
                                        aTransom.FEndHeight = aTransom.FStartHeight + (modEndWallHeight - modStartWallHeight);
                                    }

                                    aTransom.RightHeight = aTransom.FEndHeight - 2.125f;
                                    nextTransomHeight    = aTransom.FEndHeight;

                                    //Add remaining area to first window
                                    if (currentWindow == 0)
                                    {
                                        aTransom.FEndHeight   += transomInfo[2];
                                        aTransom.FStartHeight += transomInfo[2];
                                        aTransom.RightHeight  += transomInfo[2];
                                        aTransom.LeftHeight   += transomInfo[2];
                                    }

                                    aTransom.FStartHeight = GlobalFunctions.RoundDownToNearestEighthInch(aTransom.FStartHeight);
                                    aTransom.FEndHeight   = GlobalFunctions.RoundDownToNearestEighthInch(aTransom.FEndHeight);
                                    aTransom.LeftHeight   = GlobalFunctions.RoundDownToNearestEighthInch(aTransom.LeftHeight);
                                    aTransom.RightHeight  = GlobalFunctions.RoundDownToNearestEighthInch(aTransom.RightHeight);

                                    ////If last window, we need to change a height to make it sloped
                                    //if (currentWindow == transomInfo[0] - 1)
                                    //{
                                    //    //If start wall is higher, we lower end height
                                    //    if (modStartWallHeight == Math.Max(modStartWallHeight, modEndWallHeight))
                                    //    {
                                    //        aTransom.FEndHeight -= (modStartWallHeight - modEndWallHeight);
                                    //        aTransom.RightHeight -= (modStartWallHeight - modEndWallHeight);
                                    //    }
                                    //    //Otherwise we lower start height
                                    //    else
                                    //    {
                                    //        aTransom.FStartHeight -= (modEndWallHeight - modStartWallHeight);
                                    //        aTransom.LeftHeight -= (modEndWallHeight - modStartWallHeight);
                                    //    }
                                    //}
                                    aMod.ModularItems.Add(aTransom);
                                }
                            }

                            //float[] windowInfo = GlobalFunctions.findOptimalHeightsOfWindows
                            //Find where to place the mod, and place it
                            for (int j = 0; j < LinearItems.Count; j++)
                            {
                                if (LinearItems[j].FixedLocation > aMod.FixedLocation)
                                {
                                    //j is past, so we insert into j-1 and exit the loop
                                    LinearItems.Insert(j, aMod);
                                    break;
                                }
                            }
                            //Sets currentlocation to the ending location of current linear item
                            currentLocation = currentLocation + aMod.Length;
                        }
                    }
                }
                catch (Exception ex)
                {
                    //If caught, it's because we tried to touch the next linear item but it was past the last
                    //Check currentLocation to see if there is still space left
                }
            }
        }