public void RearSuspensionTyppe(SuspensionCoordinatesRearRightGUI _scrrGUI)
        {
            #region Determining the Suspension Type using the GUI Object
            RearSymmetry = _scrrGUI.RearSymmetryGUI;

            DoubleWishboneIdentifierRear = _scrrGUI.DoubleWishboneIdentifierRear;
            McPhersonIdentifierRear      = _scrrGUI.McPhersonIdentifierRear;

            PushrodIdentifierRear = _scrrGUI.PushrodIdentifierRear;
            PullrodIdentifierRear = _scrrGUI.PullrodIdentifierRear;

            UARBIdentifierRear = _scrrGUI.UARBIdentifierRear;
            TARBIdentifierRear = _scrrGUI.TARBIdentifierRear;
            #endregion
        }
        public void CreateNewSCRR(int i_create_scrr, SuspensionCoordinatesRearRightGUI create_scrrGUI_list)
        {
            ///<<summary>
            ///This section of the code creates a new SCRR and addes it to the List of SCRR objects
            ///</summary>

            #region Adding a new SCRR obbject to the list of SCRR objects
            SuspensionCoordinatesRearRightGUI scrrGUI = create_scrrGUI_list;
            Assy_List_SCRR.Insert(i_create_scrr, new SuspensionCoordinatesRearRight(scrrGUI));
            Assy_List_SCRR[i_create_scrr].RearSuspensionTyppe(scrrGUI);
            Assy_List_SCRR[i_create_scrr]._SCName           = "Rear Right Coordinates " + Convert.ToString(i_create_scrr + 1);
            Assy_List_SCRR[i_create_scrr].SCRR_ID           = i_create_scrr + 1;
            Assy_List_SCRR[i_create_scrr]._UndocommandsSCRR = new Stack <ICommand>();
            Assy_List_SCRR[i_create_scrr]._RedocommandsSCRR = new Stack <ICommand>();
            #endregion
        }
        public void Undo_ModifyObjectData(int l_unexcute_scrr, ICommand command)
        {
            ///<summary>
            /// This code is to undo the modification action which the user has performed
            /// </summary>


            #region Undoing the modification
            try
            {
                SuspensionCoordinatesRearRight _scrr_forUndo = (SuspensionCoordinatesRearRight)command;

                ICommand cmd = Assy_List_SCRR[l_unexcute_scrr];
                Assy_List_SCRR[l_unexcute_scrr]._RedocommandsSCRR.Push(cmd);

                Assy_List_SCRR[l_unexcute_scrr] = _scrr_forUndo;

                PopulateDataTable(l_unexcute_scrr);

                SuspensionCoordinatesRearRightGUI.DisplaySCRRItem(Assy_List_SCRR[l_unexcute_scrr]);

                #region Calling Undo method for Opposite Suspension if symmetric
                if (Assy_List_SCRR[l_unexcute_scrr].RearSymmetry == true && IsUndoRedoCalledByLeft == false)
                {
                    SuspensionCoordinatesRear.IsUndoRedoCalledByRight_IdentifierMethod(true);// This method sets the IsUndoRedoCalledByRight variable to true and prevents an infinte loop
                    UndoRedo undoRedo = new UndoRedo();
                    undoRedo.Identifier(SuspensionCoordinatesRear.Assy_List_SCRL[l_unexcute_scrr]._UndocommandsSCRL, SuspensionCoordinatesRear.Assy_List_SCRL[l_unexcute_scrr]._RedocommandsSCRL,
                                        l_unexcute_scrr + 1, SuspensionCoordinatesRear.Assy_List_SCRL[l_unexcute_scrr].SCRLIsModified);
                    undoRedo.Undo(1);
                    SuspensionCoordinatesRear.IsUndoRedoCalledByRight_IdentifierMethod(false);// This method sets the IsUndoRedoCalledByRight variable to false and allows the left suspenson coordinate to be undone
                }
                #endregion

                Kinematics_Software_New.EditRearCAD(l_unexcute_scrr);

                Kinematics_Software_New.SCRR_ModifyInVehicle(l_unexcute_scrr, Assy_List_SCRR[l_unexcute_scrr]);
            }
            catch (Exception) { }
            #endregion
        }
        public void ModifyObjectData(int l_modify_scrr, object modify_scrr_list, bool redo_Identifier)
        {
            ///<summary>
            ///In this section of the code, the Suspension is bring modified and it is placed under the method called ModifyObjectData because it is an Undoable operation
            ///</summary>

            #region Redoing the modification
            SuspensionCoordinatesRearRight _scrr_forRedo = (SuspensionCoordinatesRearRight)modify_scrr_list;

            ICommand cmd = Assy_List_SCRR[l_modify_scrr];
            Assy_List_SCRR[l_modify_scrr]._UndocommandsSCRR.Push(cmd);

            Assy_List_SCRR[l_modify_scrr] = _scrr_forRedo;

            PopulateDataTable(l_modify_scrr);

            Assy_List_SCRR[l_modify_scrr].SCRRIsModified = true;

            SuspensionCoordinatesRearRightGUI.DisplaySCRRItem(Assy_List_SCRR[l_modify_scrr]);

            #region Calling Redo method for Opposite Suspension if symmetric
            if (Assy_List_SCRR[l_modify_scrr].RearSymmetry == true && IsUndoRedoCalledByLeft == false)
            {
                SuspensionCoordinatesRear.IsUndoRedoCalledByRight_IdentifierMethod(true);// This method sets the IsUndoRedoCalledByRight variable to true and prevents an infinte loop
                UndoRedo undoRedo = new UndoRedo();
                undoRedo.Identifier(SuspensionCoordinatesRear.Assy_List_SCRL[l_modify_scrr]._UndocommandsSCRL, SuspensionCoordinatesRear.Assy_List_SCRL[l_modify_scrr]._RedocommandsSCRL,
                                    l_modify_scrr + 1, SuspensionCoordinatesRear.Assy_List_SCRL[l_modify_scrr].SCRLIsModified);
                undoRedo.Redo(1);
                SuspensionCoordinatesRear.IsUndoRedoCalledByRight_IdentifierMethod(false);// This method sets the IsUndoRedoCalledByRight variable to false and allows the left suspenson coordinate to be undone
            }
            #endregion

            Kinematics_Software_New.EditRearCAD(l_modify_scrr);

            Kinematics_Software_New.SCRR_ModifyInVehicle(l_modify_scrr, Assy_List_SCRR[l_modify_scrr]);


            #endregion
        }
        public void EditRearSuspension(int l_edit_scrr, SuspensionCoordinatesRearRightGUI _scrrGUI)
        {
            ICommand cmd = Assy_List_SCRR[l_edit_scrr];

            Assy_List_SCRR[l_edit_scrr]._UndocommandsSCRR.Push(cmd);

            #region Rear Right Cooridinates Editing
            SuspensionCoordinatesRearRight scrr_list = new SuspensionCoordinatesRearRight(_scrrGUI);
            scrr_list._UndocommandsSCRR = Assy_List_SCRR[l_edit_scrr]._UndocommandsSCRR;
            scrr_list._RedocommandsSCRR = Assy_List_SCRR[l_edit_scrr]._RedocommandsSCRR;
            scrr_list._SCName           = Assy_List_SCRR[l_edit_scrr]._SCName;

            Assy_List_SCRR[l_edit_scrr] = scrr_list;
            Assy_List_SCRR[l_edit_scrr].SCRRDataTable = scrr_list.SCRRDataTable;
            Assy_List_SCRR[l_edit_scrr].SCRR_ID       = l_edit_scrr + 1;
            Assy_List_SCRR[l_edit_scrr].RearSuspensionTyppe(_scrrGUI);
            Assy_List_SCRR[l_edit_scrr].SCRRIsModified = true;

            PopulateDataTable(l_edit_scrr);

            #endregion

            _RedocommandsSCRR.Clear();
        }
Esempio n. 6
0
        public void EditRearSuspensionGUI(Kinematics_Software_New _r1, SuspensionCoordinatesRearRightGUI _scrrGUI)
        {
            r1 = _r1;

            #region Editing the Rear Right Suspension Coordinates GUI Class using User Interface Object

            #region Editing the Coordinates if the Suspension Type is Double Wishbone
            if (_scrrGUI.DoubleWishboneIdentifierRear == 1)
            {
                #region DOUBLE WISHBONE

                #region Fixed Points DOUBLE WISHBONE
                //  Coordinates of Fixed Point D

                D1x = SCRRDataTableGUI.Rows[0].Field <double>(1);
                D1y = SCRRDataTableGUI.Rows[0].Field <double>(2);
                D1z = SCRRDataTableGUI.Rows[0].Field <double>(3);


                //  Coordinates of Fixed Point C

                C1x = SCRRDataTableGUI.Rows[1].Field <double>(1);
                C1y = SCRRDataTableGUI.Rows[1].Field <double>(2);
                C1z = SCRRDataTableGUI.Rows[1].Field <double>(3);


                //  Coordinates of Fixed Point A

                A1x = SCRRDataTableGUI.Rows[2].Field <double>(1);
                A1y = SCRRDataTableGUI.Rows[2].Field <double>(2);
                A1z = SCRRDataTableGUI.Rows[2].Field <double>(3);


                //  Coordinates of Fixed Point B

                B1x = SCRRDataTableGUI.Rows[3].Field <double>(1);
                B1y = SCRRDataTableGUI.Rows[3].Field <double>(2);
                B1z = SCRRDataTableGUI.Rows[3].Field <double>(3);


                // Initial Coordinates of Moving Point I

                I1x = SCRRDataTableGUI.Rows[4].Field <double>(1);
                I1y = SCRRDataTableGUI.Rows[4].Field <double>(2);
                I1z = SCRRDataTableGUI.Rows[4].Field <double>(3);


                // Initial Coordinates of Moving Point Q

                Q1x = SCRRDataTableGUI.Rows[5].Field <double>(1);
                Q1y = SCRRDataTableGUI.Rows[5].Field <double>(2);
                Q1z = SCRRDataTableGUI.Rows[5].Field <double>(3);


                //  Coordinates of Fixed Point N

                N1x = SCRRDataTableGUI.Rows[6].Field <double>(1);
                N1y = SCRRDataTableGUI.Rows[6].Field <double>(2);
                N1z = SCRRDataTableGUI.Rows[6].Field <double>(3);


                // Coordinates of Fixed Point JO

                JO1x = SCRRDataTableGUI.Rows[7].Field <double>(1);
                JO1y = SCRRDataTableGUI.Rows[7].Field <double>(2);
                JO1z = SCRRDataTableGUI.Rows[7].Field <double>(3);

                //  Ride Height Reference Points

                RideHeightRefx = SCRRDataTableGUI.Rows[8].Field <double>(1);
                RideHeightRefy = SCRRDataTableGUI.Rows[8].Field <double>(2);
                RideHeightRefz = SCRRDataTableGUI.Rows[8].Field <double>(3);

                if (_scrrGUI.TARBIdentifierRear == 1)
                {
                    // Initial Coordinates of Fixed Point R  (Only active when the it is T ARB)

                    R1x = SCRRDataTableGUI.Rows[19].Field <double>(1);
                    R1y = SCRRDataTableGUI.Rows[19].Field <double>(2);
                    R1z = SCRRDataTableGUI.Rows[19].Field <double>(3);
                }

                #endregion

                #region Moving Points DOUBLE WISHBONE
                // Initial Coordinates of Moving Point J

                J1x = SCRRDataTableGUI.Rows[9].Field <double>(1);
                J1y = SCRRDataTableGUI.Rows[9].Field <double>(2);
                J1z = SCRRDataTableGUI.Rows[9].Field <double>(3);


                // Initial Coordinates of Moving Point H

                H1x = SCRRDataTableGUI.Rows[10].Field <double>(1);
                H1y = SCRRDataTableGUI.Rows[10].Field <double>(2);
                H1z = SCRRDataTableGUI.Rows[10].Field <double>(3);


                // Initial Coordinates of Moving Point O

                O1x = SCRRDataTableGUI.Rows[11].Field <double>(1);
                O1y = SCRRDataTableGUI.Rows[11].Field <double>(2);
                O1z = SCRRDataTableGUI.Rows[11].Field <double>(3);


                // Initial Coordinates of Moving Point G

                G1x = SCRRDataTableGUI.Rows[12].Field <double>(1);
                G1y = SCRRDataTableGUI.Rows[12].Field <double>(2);
                G1z = SCRRDataTableGUI.Rows[12].Field <double>(3);


                // Initial Coordinates of Moving Point F

                F1x = SCRRDataTableGUI.Rows[13].Field <double>(1);
                F1y = SCRRDataTableGUI.Rows[13].Field <double>(2);
                F1z = SCRRDataTableGUI.Rows[13].Field <double>(3);


                // Initial Coordinates of Moving Point E

                E1x = SCRRDataTableGUI.Rows[14].Field <double>(1);
                E1y = SCRRDataTableGUI.Rows[14].Field <double>(2);
                E1z = SCRRDataTableGUI.Rows[14].Field <double>(3);


                // Initial Coordinates of Moving Point P

                P1x = SCRRDataTableGUI.Rows[15].Field <double>(1);
                P1y = SCRRDataTableGUI.Rows[15].Field <double>(2);
                P1z = SCRRDataTableGUI.Rows[15].Field <double>(3);


                // Initial Coordinates of Moving Point K

                K1x = SCRRDataTableGUI.Rows[16].Field <double>(1);
                K1y = SCRRDataTableGUI.Rows[16].Field <double>(2);
                K1z = SCRRDataTableGUI.Rows[16].Field <double>(3);


                // Initial Coordinates of Moving Point M

                M1x = SCRRDataTableGUI.Rows[17].Field <double>(1);
                M1y = SCRRDataTableGUI.Rows[17].Field <double>(2);
                M1z = SCRRDataTableGUI.Rows[17].Field <double>(3);


                //  Coordinates of Moving Contact Patch Point W

                W1x = SCRRDataTableGUI.Rows[18].Field <double>(1);
                W1y = SCRRDataTableGUI.Rows[18].Field <double>(2);
                W1z = SCRRDataTableGUI.Rows[18].Field <double>(3);

                #endregion

                #endregion
            }
            #endregion

            #region Editing the Coordinates if the Suspension Type is McPherson
            if (_scrrGUI.McPhersonIdentifierRear == 1)
            {
                #region MCPHERSON

                #region Fixed Points MCPHERSON
                //  Coordinates of Fixed Point D

                D1x = SCRRDataTableGUI.Rows[0].Field <double>(1);
                D1y = SCRRDataTableGUI.Rows[0].Field <double>(2);
                D1z = SCRRDataTableGUI.Rows[0].Field <double>(3);


                //  Coordinates of Fixed Point C

                C1x = SCRRDataTableGUI.Rows[1].Field <double>(1);
                C1y = SCRRDataTableGUI.Rows[1].Field <double>(2);
                C1z = SCRRDataTableGUI.Rows[1].Field <double>(3);


                // Initial Coordinates of Moving Point Q

                Q1x = SCRRDataTableGUI.Rows[2].Field <double>(1);
                Q1y = SCRRDataTableGUI.Rows[2].Field <double>(2);
                Q1z = SCRRDataTableGUI.Rows[2].Field <double>(3);


                //  Coordinates of Fixed Point N

                N1x = SCRRDataTableGUI.Rows[3].Field <double>(1);
                N1y = SCRRDataTableGUI.Rows[3].Field <double>(2);
                N1z = SCRRDataTableGUI.Rows[3].Field <double>(3);


                // Coordinates of Fixed Point JO

                JO1x = SCRRDataTableGUI.Rows[4].Field <double>(1);
                JO1y = SCRRDataTableGUI.Rows[4].Field <double>(2);
                JO1z = SCRRDataTableGUI.Rows[4].Field <double>(3);

                // Ride Height Reference Coordinates

                RideHeightRefx = SCRRDataTableGUI.Rows[5].Field <double>(1);
                RideHeightRefy = SCRRDataTableGUI.Rows[5].Field <double>(2);
                RideHeightRefz = SCRRDataTableGUI.Rows[5].Field <double>(3);

                // Coordinates of Fixed Point JO

                J1x = SCRRDataTableGUI.Rows[6].Field <double>(1);
                J1y = SCRRDataTableGUI.Rows[6].Field <double>(2);
                J1z = SCRRDataTableGUI.Rows[6].Field <double>(3);

                #endregion

                #region Moving Points MCPHERSON
                // Initial Coordinates of Moving Point E

                E1x = SCRRDataTableGUI.Rows[7].Field <double>(1);
                E1y = SCRRDataTableGUI.Rows[7].Field <double>(2);
                E1z = SCRRDataTableGUI.Rows[7].Field <double>(3);

                // Initial Coordinates of Moving Point P

                P1x = SCRRDataTableGUI.Rows[8].Field <double>(1);
                P1y = SCRRDataTableGUI.Rows[8].Field <double>(2);
                P1z = SCRRDataTableGUI.Rows[8].Field <double>(3);


                // Initial Coordinates of Moving Point K

                K1x = SCRRDataTableGUI.Rows[9].Field <double>(1);
                K1y = SCRRDataTableGUI.Rows[9].Field <double>(2);
                K1z = SCRRDataTableGUI.Rows[9].Field <double>(3);


                // Initial Coordinates of Moving Point M

                M1x = SCRRDataTableGUI.Rows[10].Field <double>(1);
                M1y = SCRRDataTableGUI.Rows[10].Field <double>(2);
                M1z = SCRRDataTableGUI.Rows[10].Field <double>(3);


                //  Coordinates of Moving Contact Patch Point W

                W1x = SCRRDataTableGUI.Rows[11].Field <double>(1);
                W1y = SCRRDataTableGUI.Rows[11].Field <double>(2);
                W1z = SCRRDataTableGUI.Rows[11].Field <double>(3);
                #endregion

                #endregion
            }
            #endregion

            #endregion
        }
        public SuspensionCoordinatesRearRight(SuspensionCoordinatesRearRightGUI _scrrGUI)
        {
            SCRRDataTable = _scrrGUI.SCRRDataTableGUI;

            #region Rear Right Cooridinates Initialization

            #region Fixed Points REAR RIGHT Initialization - Double Wishbone & McPherson
            //  Coordinates of Fixed Point A
            A1x = _scrrGUI.A1y;
            A1y = _scrrGUI.A1z;
            A1z = _scrrGUI.A1x;

            //  Coordinates of Fixed Point B
            B1x = _scrrGUI.B1y;
            B1y = _scrrGUI.B1z;
            B1z = _scrrGUI.B1x;

            //  Coordinates of Fixed Point C
            C1x = _scrrGUI.C1y;
            C1y = _scrrGUI.C1z;
            C1z = _scrrGUI.C1x;

            //  Coordinates of Fixed Point D
            D1x = _scrrGUI.D1y;
            D1y = _scrrGUI.D1z;
            D1z = _scrrGUI.D1x;

            // Initial Coordinates of Moving Point I
            I1x = _scrrGUI.I1y;
            I1y = _scrrGUI.I1z;
            I1z = _scrrGUI.I1x;

            // Initial Coordinates of Moving Point Jo
            JO1x = _scrrGUI.JO1y;
            JO1y = _scrrGUI.JO1z;
            JO1z = _scrrGUI.JO1x;

            // Initial Coordinates of Fixed (For now when there is no steering) Point N
            N1x = _scrrGUI.N1y;
            N1y = _scrrGUI.N1z;
            N1z = _scrrGUI.N1x;

            //  Coordinates of Fixed Point Q
            Q1x = _scrrGUI.Q1y;
            Q1y = _scrrGUI.Q1z;
            Q1z = _scrrGUI.Q1x;

            // Coordinates of Fixed Point R
            R1x = _scrrGUI.R1y;
            R1y = _scrrGUI.R1z;
            R1z = _scrrGUI.R1x;

            #endregion

            #region Moving Points REAR RIGHT Initialization - Double Wishbone & McPherson
            // Initial Coordinates of Moving Point J
            J1x = _scrrGUI.J1y;
            J1y = _scrrGUI.J1z;
            J1z = _scrrGUI.J1x;

            // Initial Coordinates of Moving Point H
            H1x = _scrrGUI.H1y;
            H1y = _scrrGUI.H1z;
            H1z = _scrrGUI.H1x;

            // Initial Coordinates of Moving Point G
            G1x = _scrrGUI.G1y;
            G1y = _scrrGUI.G1z;
            G1z = _scrrGUI.G1x;

            // Initial Coordinates of Moving Point F
            F1x = _scrrGUI.F1y;
            F1y = _scrrGUI.F1z;
            F1z = _scrrGUI.F1x;

            // Initial Coordinates of Moving Point E
            E1x = _scrrGUI.E1y;
            E1y = _scrrGUI.E1z;
            E1z = _scrrGUI.E1x;

            // Initial Coordinates of Moving Point K
            K1x = _scrrGUI.K1y; //IN THE HELPFILE CLEAFLY MENTION THAT THE X COORDINATE IS TO BE INPUT AS CONTACT
            K1y = _scrrGUI.K1z; //PATCH CENTRE - 1/2 TIRE WIDTH
            K1z = _scrrGUI.K1x;

            // Initial Coordinates of Moving Point L
            L1x = _scrrGUI.K1y + 157.48; //IN THE HELPFILE CLEAFLY MENTION THAT THE X COORDINATE IS TO BE INPUT AS CONTACT
            L1y = _scrrGUI.K1z;          //PATCH CENTRE - 1/2 TIRE WIDTH
            L1z = _scrrGUI.K1x;

            // Initial Coordinates of Moving Point M
            M1x = _scrrGUI.M1y;
            M1y = _scrrGUI.M1z;
            M1z = _scrrGUI.M1x;

            // Initial Coordinates of Moving Point O
            O1x = _scrrGUI.O1y;
            O1y = _scrrGUI.O1z;
            O1z = _scrrGUI.O1x;

            // Initial Coordinates of Moving Point P
            P1x = _scrrGUI.P1y;
            P1y = _scrrGUI.P1z;
            P1z = _scrrGUI.P1x;

            //  Coordinates of Moving Contact Patch Point W
            W1x = _scrrGUI.W1y;
            W1y = _scrrGUI.W1z;
            W1z = _scrrGUI.W1x;

            //  Ride Height Reference Points
            RideHeightRefx = _scrrGUI.RideHeightRefy;
            RideHeightRefy = _scrrGUI.RideHeightRefz;
            RideHeightRefz = _scrrGUI.RideHeightRefx;
            #endregion

            #region Link Lengths Calculations
            //Link Lengths
            LowerFrontLength   = (Math.Sqrt(Math.Pow(D1x - E1x, 2) + Math.Pow(D1y - E1y, 2) + Math.Pow(D1z - E1z, 2)));
            LowerRearLength    = (Math.Sqrt(Math.Pow(C1x - E1x, 2) + Math.Pow(C1y - E1y, 2) + Math.Pow(C1z - E1z, 2)));
            UpperFrontLength   = (Math.Sqrt(Math.Pow(A1x - F1x, 2) + Math.Pow(A1y - F1y, 2) + Math.Pow(A1z - F1z, 2)));
            UpperRearLength    = (Math.Sqrt(Math.Pow(B1x - F1x, 2) + Math.Pow(B1y - F1y, 2) + Math.Pow(B1z - F1z, 2)));
            PushRodLength      = (Math.Sqrt(Math.Pow(H1x - G1x, 2) + Math.Pow(H1y - G1y, 2) + Math.Pow(H1z - G1z, 2)));
            PushRodLength_1    = (Math.Sqrt(Math.Pow(H1x - G1x, 2) + Math.Pow(H1y - G1y, 2) + Math.Pow(H1z - G1z, 2)));
            ToeLinkLength      = (Math.Sqrt(Math.Pow(N1x - M1x, 2) + Math.Pow(N1y - M1y, 2) + Math.Pow(N1z - M1z, 2)));
            DamperLength       = (Math.Sqrt(Math.Pow(J1x - JO1x, 2) + Math.Pow(J1y - JO1y, 2) + Math.Pow(J1z - JO1z, 2)));
            ARBDroopLinkLength = (Math.Sqrt(Math.Pow(O1x - P1x, 2) + Math.Pow(O1y - P1y, 2) + Math.Pow(O1z - P1z, 2)));
            ARBBladeLength     = (Math.Sqrt(Math.Pow(P1x - Q1x, 2) + Math.Pow(P1y - Q1y, 2) + Math.Pow(P1z - Q1z, 2)));
            #endregion

            #endregion
        }