Ejemplo n.º 1
0
        private void OutputDrawer(CAD vehicleCADDrawer_Output, int VehicleIndex, int OutputIndex, bool _importCAD, bool _plotWheel)
        {
            try
            {
                //vehicleCADDrawer_Output = new CAD();

                vehicleCADDrawer_Output.GetCoG(Vehicle.List_Vehicle[VehicleIndex].chassis_vehicle);



                ///<remarks> Plotting the Front Left Outputs. CP Forces which are calculated are passed so that the arrows can be plotted for them <seealso cref="CAD.PlotArrows(double, double, double, double, double, double, bool)"/></remarks>
                vehicleCADDrawer_Output.SuspensionPlotterInvoker(Vehicle.List_Vehicle[VehicleIndex].oc_FL[OutputIndex].scmOP, 1, Vehicle.List_Vehicle[VehicleIndex].oc_FL[OutputIndex].waOP, false, _plotWheel, Vehicle.List_Vehicle[VehicleIndex].oc_FL[OutputIndex],
                                                                 Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.TotalLoad_FL_Fx, Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.TotalLoad_FL_Fy + Vehicle.List_Vehicle[VehicleIndex].oc_FL[OutputIndex].CW, Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.TotalLoad_FL_Fz);

                ///<remarks> Plotting the Front Right Outputs. CP Forces which are calculated are passed so that the arrows can be plotted for them <seealso cref="CAD.PlotArrows(double, double, double, double, double, double, bool)"/></remarks>
                vehicleCADDrawer_Output.SuspensionPlotterInvoker(Vehicle.List_Vehicle[VehicleIndex].oc_FR[OutputIndex].scmOP, 2, Vehicle.List_Vehicle[VehicleIndex].oc_FR[OutputIndex].waOP, false, _plotWheel, Vehicle.List_Vehicle[VehicleIndex].oc_FR[OutputIndex],
                                                                 Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.TotalLoad_FR_Fx, Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.TotalLoad_FR_Fy + Vehicle.List_Vehicle[VehicleIndex].oc_FR[OutputIndex].CW, Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.TotalLoad_FR_Fz);

                ///<remarks> Plotting the Rear Left Outputs. CP Forces which are calculated are passed so that the arrows can be plotted for them <seealso cref="CAD.PlotArrows(double, double, double, double, double, double, bool)"/></remarks>
                vehicleCADDrawer_Output.SuspensionPlotterInvoker(Vehicle.List_Vehicle[VehicleIndex].oc_RL[OutputIndex].scmOP, 3, Vehicle.List_Vehicle[VehicleIndex].oc_RL[OutputIndex].waOP, false, _plotWheel, Vehicle.List_Vehicle[VehicleIndex].oc_RL[OutputIndex],
                                                                 Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.TotalLoad_RL_Fx, Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.TotalLoad_RL_Fy + Vehicle.List_Vehicle[VehicleIndex].oc_RL[OutputIndex].CW, Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.TotalLoad_RL_Fz);

                ///<remarks> Plotting the Rear Right Outputs. CP Forces which are calculated are passed so that the arrows can be plotted for them <seealso cref="CAD.PlotArrows(double, double, double, double, double, double, bool)"/></remarks>
                vehicleCADDrawer_Output.SuspensionPlotterInvoker(Vehicle.List_Vehicle[VehicleIndex].oc_RR[OutputIndex].scmOP, 4, Vehicle.List_Vehicle[VehicleIndex].oc_RR[OutputIndex].waOP, false, _plotWheel, Vehicle.List_Vehicle[VehicleIndex].oc_RR[OutputIndex],
                                                                 Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.TotalLoad_RR_Fx, Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.TotalLoad_RR_Fy + Vehicle.List_Vehicle[VehicleIndex].oc_RR[OutputIndex].CW, Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.TotalLoad_RR_Fz);


                vehicleCADDrawer_Output.ARBConnector(vehicleCADDrawer_Output.CoordinatesFL.InboardPickUp, vehicleCADDrawer_Output.CoordinatesFR.InboardPickUp);


                vehicleCADDrawer_Output.SteeringCSystemPlotter(Vehicle.List_Vehicle[VehicleIndex].oc_FL[OutputIndex].scmOP, Vehicle.List_Vehicle[VehicleIndex].oc_FR[OutputIndex].scmOP, vehicleCADDrawer_Output.CoordinatesFL.InboardPickUp, vehicleCADDrawer_Output.CoordinatesFR.InboardPickUp);


                vehicleCADDrawer_Output.ARBConnector(vehicleCADDrawer_Output.CoordinatesRL.InboardPickUp, vehicleCADDrawer_Output.CoordinatesRR.InboardPickUp);

                Vector3D ForcePLeft, ForceQLeft, ForcePRight, ForceQRight = new Vector3D();
                ///<summary>Obtaining the Forces in the FL, FR, RL, RR Steering Rack Points of the FRONT</summary>
                GetAttachmentPointForces(Vehicle.List_Vehicle[VehicleIndex].oc_FL[OutputIndex], Vehicle.List_Vehicle[VehicleIndex].oc_FR[OutputIndex], out ForcePLeft, out ForceQLeft, out ForcePRight, out ForceQRight, true, false);
                CADVehicleOutputs.PlotLoadCase(Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.FL_BearingCoordinates, Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.FR_BearingCoordinates, false, true, false, ForcePLeft, ForceQLeft, ForcePRight, ForceQRight);

                ///<summary>Obtaining the Forces in the FL, FR, RL, RR ARB Points of the FRONT</summary>
                GetAttachmentPointForces(Vehicle.List_Vehicle[VehicleIndex].oc_FL[OutputIndex], Vehicle.List_Vehicle[VehicleIndex].oc_FR[OutputIndex], out ForcePLeft, out ForceQLeft, out ForcePRight, out ForceQRight, false, false);
                CADVehicleOutputs.PlotLoadCase(Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.FL_BearingCoordinates, Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.FR_BearingCoordinates, false, false, false, ForcePLeft, ForceQLeft, ForcePRight, ForceQRight);

                ///<summary>Obtaining the Forces in the FL, FR, RL, RR Steering Rack Points of the REAR</summary>
                GetAttachmentPointForces(Vehicle.List_Vehicle[VehicleIndex].oc_RL[OutputIndex], Vehicle.List_Vehicle[VehicleIndex].oc_RR[OutputIndex], out ForcePLeft, out ForceQLeft, out ForcePRight, out ForceQRight, false, false);
                CADVehicleOutputs.PlotLoadCase(Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.RL_BearingCoordinates, Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.RR_BearingCoordinates, false, true, false, ForcePLeft, ForceQLeft, ForcePRight, ForceQRight);

                ///<summary>Using manipulation to obtain the forces on the Left and Right Steering Column Attachment Points</summary>
                GetAttachmentPointForces(Vehicle.List_Vehicle[VehicleIndex].oc_FL[OutputIndex], Vehicle.List_Vehicle[VehicleIndex].oc_FR[OutputIndex], out ForcePLeft, out ForceQLeft, out ForcePRight, out ForceQRight, false, true);
                CADVehicleOutputs.PlotLoadCase(Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.SteeringColumnBearing, Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.SteeringColumnBearing, false, true, true, ForcePLeft, new Vector3D(), ForcePRight, new Vector3D());

                vehicleCADDrawer_Output.PlotLoadCaseInputForces(Vehicle.List_Vehicle[this._VehicleID - 1].chassis_vehicle, Vehicle.List_Vehicle[this._VehicleID - 1].vehicleLoadCase);

                vehicleCADDrawer_Output.PlotMomentArrows(Vehicle.List_Vehicle[VehicleIndex].oc_FL[OutputIndex].scmOP.W1x, Vehicle.List_Vehicle[VehicleIndex].oc_FL[OutputIndex].scmOP.W1y, Vehicle.List_Vehicle[VehicleIndex].oc_FL[OutputIndex].scmOP.W1z,
                                                         Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.NSM_FL_Mx, Vehicle.List_Vehicle[VehicleIndex].vehicleLoadCase.NSM_FL_Mz);

                ///<remarks>Order of Painting is Important</remarks>
                ///<summary>Creating a temporary Output Class Variable which will hold the Max and Min Values collated from ALL THE 4 CORNERS</summary>
                OutputClass MasterOC = new OutputClass();
                MasterOC = MasterOC.PopulateForceLists(Vehicle.List_Vehicle[VehicleIndex].oc_FL[OutputIndex], Vehicle.List_Vehicle[VehicleIndex].oc_FR[OutputIndex], Vehicle.List_Vehicle[VehicleIndex].oc_RL[OutputIndex], Vehicle.List_Vehicle[VehicleIndex].oc_RR[OutputIndex]);

                ///<summary>Calling the <see cref="LegendEditor"/> and initializing it and then calling the <see cref="CAD.PostProcessing(LegendEditor, OutputClass, Color, Color, GradientStyle, int, double)"/> method which draws the DataTable for the Legend and the Legend too </summary>
                LoadCaseLegend.InitializeLegendEditor(MasterOC, CADVehicleOutputs);

                ///<summary>This Loop exists to allow the imported files to be translated around the Suspension  </summary>
                if (_importCAD && OutputIGESPlotted && TranslateChassisToGround)
                {
                    r1 = Kinematics_Software_New.AssignFormVariable();

                    int opIndex = 0;

                    int motionInd = Vehicle.List_Vehicle[_VehicleID - 1].vehicle_Motion.MotionID - 1;

                    opIndex = MotionGUI.List_MotionGUI[motionInd].bandedGridView_Motion.FocusedRowHandle;

                    ImportedCADTranslationHistory.Add(-Vehicle.List_Vehicle[_VehicleID - 1].oc_FL[opIndex].FinalRideHeight_1);

                    for (int i = 0; i < vehicleCADDrawer_Output.viewportLayout1.Entities.Count; i++)
                    {
                        if (vehicleCADDrawer_Output.viewportLayout1.Entities[i] is BlockReference)
                        {
                            BlockReference br = vehicleCADDrawer_Output.viewportLayout1.Entities[i] as BlockReference;
                            br.Translate(0, -(ImportedCADTranslationHistory[ImportedCADTranslationHistory.Count - 1] - ImportedCADTranslationHistory[ImportedCADTranslationHistory.Count - 2]), 0);
                        }
                    }
                }

                devDept.Eyeshot.RegenOptions ro = new devDept.Eyeshot.RegenOptions();
                vehicleCADDrawer_Output.viewportLayout1.Entities.Regen(ro);
                vehicleCADDrawer_Output.viewportLayout1.Invalidate();
            }
            catch (Exception E)
            {
                MessageBox.Show(E.Message);
                // Keeping this code in try and catch block will help during Open operation. If the method is called without a Vehicle or VehicleGUI item being present, then the software won't crasha
            }
        }
Ejemplo n.º 2
0
        private void InputDrawer(CAD vehicleCADDrawer_Input, int Index_Input, bool _motionExists, bool _importCAD, bool _plotWheel)
        {
            try
            {
                double CPForceX = 0, CPForceY = 0, CPForceZ = 0;

                ///<remarks>
                ///The If Loop is needed becsuse now the Vehicle can be created without the creation of the Input items.
                ///It may happen that the Suspension is not created but the <see cref="ImportCADForm.simpleButtonBrowse_Click(object, EventArgs)"/> is fired.
                ///In this case, the if method (<see cref="Kinematics_Software_New.EditVehicleCAD(CAD, int, bool, bool, bool)"/>) is called then it will fail because there is no Suspension Item created and hence <see cref="VehicleGUI.InputDrawer(CAD, int, bool, bool, bool)"/>
                ///will fail because there is no Suspension.
                ///But, the <see cref="CAD.ImportCAD(ref bool, ref bool)"/> method must be executed becase when the see cref="ImportCADForm.simpleButtonBrowse_Click(object, EventArgs)"/> is fired an Import must have heppened (Check is in place to ensure Import has happened)
                /// </remarks>
                if (Vehicle.List_Vehicle[Index_Input].sc_FL != null)
                {
                    vehicleCADDrawer_Input.GetCoG(Vehicle.List_Vehicle[Index_Input].chassis_vehicle);

                    GetCPForce(Vehicle.List_Vehicle[Index_Input].vehicleLoadCase, out CPForceX, out CPForceY, out CPForceZ, 1);
                    vehicleCADDrawer_Input.SuspensionPlotterInvoker(Vehicle.List_Vehicle[Index_Input].sc_FL, 1, Vehicle.List_Vehicle[Index_Input].wa_FL, true, _plotWheel, null, CPForceX, CPForceY, CPForceZ);

                    GetCPForce(Vehicle.List_Vehicle[Index_Input].vehicleLoadCase, out CPForceX, out CPForceY, out CPForceZ, 2);
                    vehicleCADDrawer_Input.SuspensionPlotterInvoker(Vehicle.List_Vehicle[Index_Input].sc_FR, 2, Vehicle.List_Vehicle[Index_Input].wa_FR, true, _plotWheel, null, CPForceX, CPForceY, CPForceZ);

                    GetCPForce(Vehicle.List_Vehicle[Index_Input].vehicleLoadCase, out CPForceX, out CPForceY, out CPForceZ, 3);
                    vehicleCADDrawer_Input.SuspensionPlotterInvoker(Vehicle.List_Vehicle[Index_Input].sc_RL, 3, Vehicle.List_Vehicle[Index_Input].wa_RL, true, _plotWheel, null, CPForceX, CPForceY, CPForceZ);

                    GetCPForce(Vehicle.List_Vehicle[Index_Input].vehicleLoadCase, out CPForceX, out CPForceY, out CPForceZ, 4);
                    vehicleCADDrawer_Input.SuspensionPlotterInvoker(Vehicle.List_Vehicle[Index_Input].sc_RR, 4, Vehicle.List_Vehicle[Index_Input].wa_RR, true, _plotWheel, null, CPForceX, CPForceY, CPForceZ);


                    vehicleCADDrawer_Input.ARBConnector(vehicleCADDrawer_Input.CoordinatesFL.InboardPickUp, vehicleCADDrawer_Input.CoordinatesFR.InboardPickUp);


                    vehicleCADDrawer_Input.SteeringCSystemPlotter(Vehicle.List_Vehicle[Index_Input].sc_FL, Vehicle.List_Vehicle[Index_Input].sc_FR, vehicleCADDrawer_Input.CoordinatesFL.InboardPickUp, vehicleCADDrawer_Input.CoordinatesFR.InboardPickUp);


                    vehicleCADDrawer_Input.ARBConnector(vehicleCADDrawer_Input.CoordinatesRL.InboardPickUp, vehicleCADDrawer_Input.CoordinatesRR.InboardPickUp);

                    vehicleCADDrawer_Input.SetupViewPort();
                }

                if (_importCAD && !FileHasBeenImported)
                {
                    ///<summary>
                    ///Calling the <see cref="CAD.ImportCAD(ref bool)"/> function. This function requires a string of the file name to be passed. But this string is used only in 2 conditions.
                    ///1. If the Output Vehicle is calling the import function
                    ///2. If the Input and Output Vehicles are calling the function during an Open operation
                    ///These are the only 2 conditions when the controlling IF loop will allow access to section of the code which requires the string to be passed. Hence passing null here as the below lines of code will not trigger the IF loop under norm
                    ///conditions and THIS IF LOOP will not be triggerd when Open operations is going on
                    /// </summary>
                    //vehicleCADDrawer_Input.ImportedCADPlotter(ref FileHasBeenImported, ref CadIsTobeImported, false, vehicleCADDrawer_Input.openFileDialog1.FileName/*, CADVehicleInputs.importedFile*/);
                    //IGESFIleName = vehicleCADDrawer_Input.openFileDialog1.FileName;
                }

                ///<summary>
                ///Since the Vehicle is allowed to be created without the creation of the Input Items it may happen that (since Suspension doesn't exist yet) the <see cref="VehicleGUI.Vehicle_MotionExists"/> is not yet assigned.
                /// So the <see cref="Vehicle.sc_FL"/> is evalutated to check if it is null. Only if it is not null can the decision regarding whether or not Motion exists can be taken
                /// </summary>
                if (!_motionExists && Vehicle.List_Vehicle[Index_Input].sc_FL != null)
                {
                    vehicleCADDrawer_Input.DrawStands(Vehicle.List_Vehicle[Index_Input].sc_FL, Vehicle.List_Vehicle[Index_Input].sc_FR, Vehicle.List_Vehicle[Index_Input].sc_RL, Vehicle.List_Vehicle[Index_Input].sc_RR);
                }
            }
            catch (Exception E)
            {
                string error = E.Message;
                // Keeping this code in try and catch block will help during Open operation. If the method is called without a Vehicle or VehicleGUI item being present, then the software won't crasha
            }
        }