public void FrontSuspensionType(SuspensionCoordinatesFrontRightGUI _scfrGUI) { #region Determining the Suspension Type using the GUI Object FrontSymmetry = _scfrGUI.FrontSymmetryGUI; DoubleWishboneIdentifierFront = _scfrGUI.DoubleWishboneIdentifierFront; McPhersonIdentifierFront = _scfrGUI.McPhersonIdentifierFront; PushrodIdentifierFront = _scfrGUI.PushrodIdentifierFront; PullrodIdentifierFront = _scfrGUI.PullrodIdentifierFront; UARBIdentifierFront = _scfrGUI.UARBIdentifierFront; TARBIdentifierFront = _scfrGUI.TARBIdentifierFront; #endregion }
public void CreateNewSCFR(int i_create_scfr, SuspensionCoordinatesFrontRightGUI create_scfrGUI_list) { ///<<summary> ///This section of the code creates a new SCFR and addes it to the List of SCFR objects ///</summary> #region Adding new SCFR object to the list of SCFR objects SuspensionCoordinatesFrontRightGUI scfrGUI = create_scfrGUI_list; Assy_List_SCFR.Insert(i_create_scfr, new SuspensionCoordinatesFrontRight(scfrGUI)); Assy_List_SCFR[i_create_scfr].FrontSuspensionType(scfrGUI); Assy_List_SCFR[i_create_scfr]._SCName = "Front Right Coordinates " + Convert.ToString(i_create_scfr + 1); Assy_List_SCFR[i_create_scfr].SCFR_ID = i_create_scfr + 1; Assy_List_SCFR[i_create_scfr]._UndocommandsSCFR = new Stack <ICommand>(); Assy_List_SCFR[i_create_scfr]._RedocommandsSCFR = new Stack <ICommand>(); #endregion }
public void Undo_ModifyObjectData(int l_unexcute_scfr, ICommand command) { ///<summary> /// This code is to undo the modification action which the user has performed /// </summary> #region Undoing the modification try { SuspensionCoordinatesFrontRight _scfr_forUndo = (SuspensionCoordinatesFrontRight)command; ICommand cmd = Assy_List_SCFR[l_unexcute_scfr]; Assy_List_SCFR[l_unexcute_scfr]._RedocommandsSCFR.Push(cmd); Assy_List_SCFR[l_unexcute_scfr] = _scfr_forUndo; PopulateDataTable(l_unexcute_scfr); SuspensionCoordinatesFrontRightGUI.DisplaySCFRItem(Assy_List_SCFR[l_unexcute_scfr]); #region Calling Undo method for Opposite Suspension if symmetric if (SuspensionCoordinatesFrontRight.Assy_List_SCFR[l_unexcute_scfr].FrontSymmetry == true && IsUndoRedoCalledByLeft == false) { SuspensionCoordinatesFront.IsUndoRedoCalledByRight_IdentifierMethod(true);// This method sets the IsUndoRedoCalledByRight variable to true and prevents an infinte loop UndoRedo undoRedo = new UndoRedo(); undoRedo.Identifier(SuspensionCoordinatesFront.Assy_List_SCFL[l_unexcute_scfr]._UndocommandsSCFL, SuspensionCoordinatesFront.Assy_List_SCFL[l_unexcute_scfr]._RedocommandsSCFL, l_unexcute_scfr + 1, SuspensionCoordinatesFront.Assy_List_SCFL[l_unexcute_scfr].SCFLIsModified); undoRedo.Undo(1); SuspensionCoordinatesFront.IsUndoRedoCalledByRight_IdentifierMethod(false);// This method sets the IsUndoRedoCalledByRight variable to false and allows the left suspenson coordinate to be undone } #endregion Kinematics_Software_New.EditFrontCAD(l_unexcute_scfr); Kinematics_Software_New.SCFR_ModifyInVehicle(l_unexcute_scfr, Assy_List_SCFR[l_unexcute_scfr]); } catch (Exception) { } #endregion }
public void ModifyObjectData(int l_modify_scfr, object modify_scfr_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 SuspensionCoordinatesFrontRight _scfr_forRedo = (SuspensionCoordinatesFrontRight)modify_scfr_list; ICommand cmd = Assy_List_SCFR[l_modify_scfr]; Assy_List_SCFR[l_modify_scfr]._UndocommandsSCFR.Push(cmd); Assy_List_SCFR[l_modify_scfr] = _scfr_forRedo; Assy_List_SCFR[l_modify_scfr].SCFRIsModified = true; PopulateDataTable(l_modify_scfr); SuspensionCoordinatesFrontRightGUI.DisplaySCFRItem(Assy_List_SCFR[l_modify_scfr]); #region Calling Redo method for Opposite Suspension if symmetric if (SuspensionCoordinatesFrontRight.Assy_List_SCFR[l_modify_scfr].FrontSymmetry == true && IsUndoRedoCalledByLeft == false) { SuspensionCoordinatesFront.IsUndoRedoCalledByRight_IdentifierMethod(true); UndoRedo undoRedo = new UndoRedo(); undoRedo.Identifier(SuspensionCoordinatesFront.Assy_List_SCFL[l_modify_scfr]._UndocommandsSCFL, SuspensionCoordinatesFront.Assy_List_SCFL[l_modify_scfr]._RedocommandsSCFL, l_modify_scfr + 1, SuspensionCoordinatesFront.Assy_List_SCFL[l_modify_scfr].SCFLIsModified); undoRedo.Redo(1); SuspensionCoordinatesFront.IsUndoRedoCalledByRight_IdentifierMethod(false);// This method sets the IsUndoRedoCalledByRight variable to false and allows the left suspenson coordinate to be undone } #endregion Kinematics_Software_New.EditFrontCAD(l_modify_scfr); Kinematics_Software_New.SCFR_ModifyInVehicle(l_modify_scfr, Assy_List_SCFR[l_modify_scfr]); #endregion }
public void EditFrontRightSuspension(int l_edit_scfr, SuspensionCoordinatesFrontRightGUI _scfrGUI) { ICommand cmd = Assy_List_SCFR[l_edit_scfr]; Assy_List_SCFR[l_edit_scfr]._UndocommandsSCFR.Push(cmd); #region Front Right Coordinates editing SuspensionCoordinatesFrontRight scfr_list = new SuspensionCoordinatesFrontRight(_scfrGUI); scfr_list._UndocommandsSCFR = Assy_List_SCFR[l_edit_scfr]._UndocommandsSCFR; scfr_list._RedocommandsSCFR = Assy_List_SCFR[l_edit_scfr]._RedocommandsSCFR; scfr_list._SCName = Assy_List_SCFR[l_edit_scfr]._SCName; Assy_List_SCFR[l_edit_scfr] = scfr_list; Assy_List_SCFR[l_edit_scfr].SCFRDataTable = scfr_list.SCFRDataTable; Assy_List_SCFR[l_edit_scfr].SCFR_ID = l_edit_scfr + 1; Assy_List_SCFR[l_edit_scfr].FrontSuspensionType(_scfrGUI); Assy_List_SCFR[l_edit_scfr].SCFRIsModified = true; PopulateDataTable(l_edit_scfr); #endregion _RedocommandsSCFR.Clear(); }
public void EditFrontRightCoordinatesGUI(Kinematics_Software_New _r1, SuspensionCoordinatesFrontRightGUI _scfrGUI) { r1 = _r1; #region Editing the Front Left Suspension Coordinates GUI Class using its own Data Table which is modified through the User Interface's GridControl #region Editing the Coordinates if the Suspension Type is Double Wishbone if (_scfrGUI.DoubleWishboneIdentifierFront == 1) { #region DOUBLE WISHBONE #region Fixed Points DOUBLE WISHBONE // Coordinates of Fixed Point D D1x = SCFRDataTableGUI.Rows[0].Field <double>(1); D1y = SCFRDataTableGUI.Rows[0].Field <double>(2); D1z = SCFRDataTableGUI.Rows[0].Field <double>(3); // Coordinates of Fixed Point C C1x = SCFRDataTableGUI.Rows[1].Field <double>(1); C1y = SCFRDataTableGUI.Rows[1].Field <double>(2); C1z = SCFRDataTableGUI.Rows[1].Field <double>(3); // Coordinates of Fixed Point A A1x = SCFRDataTableGUI.Rows[2].Field <double>(1); A1y = SCFRDataTableGUI.Rows[2].Field <double>(2); A1z = SCFRDataTableGUI.Rows[2].Field <double>(3); // Coordinates of Fixed Point B B1x = SCFRDataTableGUI.Rows[3].Field <double>(1); B1y = SCFRDataTableGUI.Rows[3].Field <double>(2); B1z = SCFRDataTableGUI.Rows[3].Field <double>(3); // Initial Coordinates of Moving Point I I1x = SCFRDataTableGUI.Rows[4].Field <double>(1); I1y = SCFRDataTableGUI.Rows[4].Field <double>(2); I1z = SCFRDataTableGUI.Rows[4].Field <double>(3); // Initial Coordinates of Moving Point Q Q1x = SCFRDataTableGUI.Rows[5].Field <double>(1); Q1y = SCFRDataTableGUI.Rows[5].Field <double>(2); Q1z = SCFRDataTableGUI.Rows[5].Field <double>(3); // Coordinates of Fixed Point N N1x = SCFRDataTableGUI.Rows[6].Field <double>(1); N1y = SCFRDataTableGUI.Rows[6].Field <double>(2); N1z = SCFRDataTableGUI.Rows[6].Field <double>(3); // Coordinates of Fixed Point JO JO1x = SCFRDataTableGUI.Rows[7].Field <double>(1); JO1y = SCFRDataTableGUI.Rows[7].Field <double>(2); JO1z = SCFRDataTableGUI.Rows[7].Field <double>(3); // Ride Height Reference Points RideHeightRefx = SCFRDataTableGUI.Rows[8].Field <double>(1); RideHeightRefy = SCFRDataTableGUI.Rows[8].Field <double>(2); RideHeightRefz = SCFRDataTableGUI.Rows[8].Field <double>(3); if (_scfrGUI.TARBIdentifierFront == 1) { // Initial Coordinates of Fixed Point R (Only active when the it is T ARB) R1x = SCFRDataTableGUI.Rows[19].Field <double>(1); R1y = SCFRDataTableGUI.Rows[19].Field <double>(2); R1z = SCFRDataTableGUI.Rows[19].Field <double>(3); } #endregion #region Moving Points DOUBLE WISHBONE // Initial Coordinates of Moving Point J J1x = SCFRDataTableGUI.Rows[9].Field <double>(1); J1y = SCFRDataTableGUI.Rows[9].Field <double>(2); J1z = SCFRDataTableGUI.Rows[9].Field <double>(3); // Initial Coordinates of Moving Point H H1x = SCFRDataTableGUI.Rows[10].Field <double>(1); H1y = SCFRDataTableGUI.Rows[10].Field <double>(2); H1z = SCFRDataTableGUI.Rows[10].Field <double>(3); // Initial Coordinates of Moving Point O O1x = SCFRDataTableGUI.Rows[11].Field <double>(1); O1y = SCFRDataTableGUI.Rows[11].Field <double>(2); O1z = SCFRDataTableGUI.Rows[11].Field <double>(3); // Initial Coordinates of Moving Point G G1x = SCFRDataTableGUI.Rows[12].Field <double>(1); G1y = SCFRDataTableGUI.Rows[12].Field <double>(2); G1z = SCFRDataTableGUI.Rows[12].Field <double>(3); // Initial Coordinates of Moving Point F F1x = SCFRDataTableGUI.Rows[13].Field <double>(1); F1y = SCFRDataTableGUI.Rows[13].Field <double>(2); F1z = SCFRDataTableGUI.Rows[13].Field <double>(3); // Initial Coordinates of Moving Point E E1x = SCFRDataTableGUI.Rows[14].Field <double>(1); E1y = SCFRDataTableGUI.Rows[14].Field <double>(2); E1z = SCFRDataTableGUI.Rows[14].Field <double>(3); // Initial Coordinates of Moving Point P P1x = SCFRDataTableGUI.Rows[15].Field <double>(1); P1y = SCFRDataTableGUI.Rows[15].Field <double>(2); P1z = SCFRDataTableGUI.Rows[15].Field <double>(3); // Initial Coordinates of Moving Point K K1x = SCFRDataTableGUI.Rows[16].Field <double>(1); K1y = SCFRDataTableGUI.Rows[16].Field <double>(2); K1z = SCFRDataTableGUI.Rows[16].Field <double>(3); // Initial Coordinates of Moving Point M M1x = SCFRDataTableGUI.Rows[17].Field <double>(1); M1y = SCFRDataTableGUI.Rows[17].Field <double>(2); M1z = SCFRDataTableGUI.Rows[17].Field <double>(3); // Coordinates of Moving Contact Patch Point W W1x = SCFRDataTableGUI.Rows[18].Field <double>(1); W1y = SCFRDataTableGUI.Rows[18].Field <double>(2); W1z = SCFRDataTableGUI.Rows[18].Field <double>(3); #endregion #endregion } #endregion #region Editing the Coordinates if the Suspension Type is McPherson if (_scfrGUI.McPhersonIdentifierFront == 1) { #region MCPHERSON #region Fixed Points MCPHERSON // Coordinates of Fixed Point D D1x = SCFRDataTableGUI.Rows[0].Field <double>(1); D1y = SCFRDataTableGUI.Rows[0].Field <double>(2); D1z = SCFRDataTableGUI.Rows[0].Field <double>(3); // Coordinates of Fixed Point C C1x = SCFRDataTableGUI.Rows[1].Field <double>(1); C1y = SCFRDataTableGUI.Rows[1].Field <double>(2); C1z = SCFRDataTableGUI.Rows[1].Field <double>(3); // Initial Coordinates of Moving Point Q Q1x = SCFRDataTableGUI.Rows[2].Field <double>(1); Q1y = SCFRDataTableGUI.Rows[2].Field <double>(2); Q1z = SCFRDataTableGUI.Rows[2].Field <double>(3); // Coordinates of Fixed Point N N1x = SCFRDataTableGUI.Rows[3].Field <double>(1); N1y = SCFRDataTableGUI.Rows[3].Field <double>(2); N1z = SCFRDataTableGUI.Rows[3].Field <double>(3); // Coordinates of Fixed Point JO JO1x = SCFRDataTableGUI.Rows[4].Field <double>(1); JO1y = SCFRDataTableGUI.Rows[4].Field <double>(2); JO1z = SCFRDataTableGUI.Rows[4].Field <double>(3); // Ride Height Reference Coordinates RideHeightRefx = SCFRDataTableGUI.Rows[5].Field <double>(1); RideHeightRefy = SCFRDataTableGUI.Rows[5].Field <double>(2); RideHeightRefz = SCFRDataTableGUI.Rows[5].Field <double>(3); // Coordinates of Fixed Point JO J1x = SCFRDataTableGUI.Rows[6].Field <double>(1); J1y = SCFRDataTableGUI.Rows[6].Field <double>(2); J1z = SCFRDataTableGUI.Rows[6].Field <double>(3); #endregion #region Moving Points MCPHERSON // Initial Coordinates of Moving Point E E1x = SCFRDataTableGUI.Rows[7].Field <double>(1); E1y = SCFRDataTableGUI.Rows[7].Field <double>(2); E1z = SCFRDataTableGUI.Rows[7].Field <double>(3); // Initial Coordinates of Moving Point P P1x = SCFRDataTableGUI.Rows[8].Field <double>(1); P1y = SCFRDataTableGUI.Rows[8].Field <double>(2); P1z = SCFRDataTableGUI.Rows[8].Field <double>(3); // Initial Coordinates of Moving Point K K1x = SCFRDataTableGUI.Rows[9].Field <double>(1); K1y = SCFRDataTableGUI.Rows[9].Field <double>(2); K1z = SCFRDataTableGUI.Rows[9].Field <double>(3); // Initial Coordinates of Moving Point M M1x = SCFRDataTableGUI.Rows[10].Field <double>(1); M1y = SCFRDataTableGUI.Rows[10].Field <double>(2); M1z = SCFRDataTableGUI.Rows[10].Field <double>(3); // Coordinates of Moving Contact Patch Point W W1x = SCFRDataTableGUI.Rows[11].Field <double>(1); W1y = SCFRDataTableGUI.Rows[11].Field <double>(2); W1z = SCFRDataTableGUI.Rows[11].Field <double>(3); #endregion #endregion } #endregion #endregion }
public SuspensionCoordinatesFrontRight(SuspensionCoordinatesFrontRightGUI _scfrGUI) { SCFRDataTable = _scfrGUI.SCFRDataTableGUI; #region Front Right Cooridinates Initialization #region Fixed Points FRONT Right Initialization - Double Wishbone & McPherson // Coordinates of Fixed Point A A1x = _scfrGUI.A1y; A1y = _scfrGUI.A1z; A1z = _scfrGUI.A1x; // Coordinates of Fixed Point B B1x = _scfrGUI.B1y; B1y = _scfrGUI.B1z; B1z = _scfrGUI.B1x; // Coordinates of Fixed Point C C1x = _scfrGUI.C1y; C1y = _scfrGUI.C1z; C1z = _scfrGUI.C1x; // Coordinates of Fixed Point D D1x = _scfrGUI.D1y; D1y = _scfrGUI.D1z; D1z = _scfrGUI.D1x; // Initial Coordinates of Moving Point I I1x = _scfrGUI.I1y; I1y = _scfrGUI.I1z; I1z = _scfrGUI.I1x; // Initial Coordinates of Moving Point Jo JO1x = _scfrGUI.JO1y; JO1y = _scfrGUI.JO1z; JO1z = _scfrGUI.JO1x; // Initial Coordinates of Fixed (For now when there is no steering) Point N N1x = _scfrGUI.N1y; N1y = _scfrGUI.N1z; N1z = _scfrGUI.N1x; // Coordinates of Fixed Point Q Q1x = _scfrGUI.Q1y; Q1y = _scfrGUI.Q1z; Q1z = _scfrGUI.Q1x; // Coordinates of Fixed Point R R1x = _scfrGUI.R1y; R1y = _scfrGUI.R1z; R1z = _scfrGUI.R1x; #endregion #region Moving Points FRONT Right Initialization - Double Wishbone & McPherson // Initial Coordinates of Moving Point J J1x = _scfrGUI.J1y; J1y = _scfrGUI.J1z; J1z = _scfrGUI.J1x; // Initial Coordinates of Moving Point H H1x = _scfrGUI.H1y; H1y = _scfrGUI.H1z; H1z = _scfrGUI.H1x; // Initial Coordinates of Moving Point G G1x = _scfrGUI.G1y; G1y = _scfrGUI.G1z; G1z = _scfrGUI.G1x; // Initial Coordinates of Moving Point F F1x = _scfrGUI.F1y; F1y = _scfrGUI.F1z; F1z = _scfrGUI.F1x; // Initial Coordinates of Moving Point E E1x = _scfrGUI.E1y; E1y = _scfrGUI.E1z; E1z = _scfrGUI.E1x; // Initial Coordinates of Moving Point K K1x = _scfrGUI.K1y; //IN THE HELPFILE CLEAFLY MENTION THAT THE X COORDINATE IS TO BE INPUT AS CONTACT K1y = _scfrGUI.K1z; //PATCH CENTRE - 1/2 TIRE WIDTH K1z = _scfrGUI.K1x; // Initial Coordinates of Moving Point L L1x = _scfrGUI.K1y + 157.48; //IN THE HELPFILE CLEAFLY MENTION THAT THE X COORDINATE IS TO BE INPUT AS CONTACT L1y = _scfrGUI.K1z; //PATCH CENTRE - 1/2 TIRE WIDTH L1z = _scfrGUI.K1x; // Initial Coordinates of Moving Point M M1x = _scfrGUI.M1y; M1y = _scfrGUI.M1z; M1z = _scfrGUI.M1x; // Initial Coordinates of Moving Point O O1x = _scfrGUI.O1y; O1y = _scfrGUI.O1z; O1z = _scfrGUI.O1x; // Initial Coordinates of Moving Point P P1x = _scfrGUI.P1y; P1y = _scfrGUI.P1z; P1z = _scfrGUI.P1x; // Coordinates of Moving Contact Patch Point W W1x = _scfrGUI.W1y; W1y = _scfrGUI.W1z; W1z = _scfrGUI.W1x; // Ride Height Reference Points RideHeightRefx = _scfrGUI.RideHeightRefy; RideHeightRefy = _scfrGUI.RideHeightRefz; RideHeightRefz = _scfrGUI.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 /////<remarks>This list is going to be populated from the index number 1 as the delta of Wheel Deflection is 0 for the 0th Index</remarks> //WheelDeflection_Steering.Insert(0, 0); #endregion }