public void UseBlock(Model model1) { // x 변수를 0에서 1000까지 100씩 증가하면서 반복합니다.(10번 반복) for (int x = 0; x < 1000; x += 100) { // y 변수를 0에서 1000까지 100씩 증가하면서 반복합니다.(10번 반복) for (int y = 0; y < 1000; y += 100) { // BlockReference 객체 생성 BlockReference br = new BlockReference("my block"); // BlockReference 객체를 x, y 만큼 이동 br.Translate(x, y); // 객체 추가 model1.Entities.Add(br); } } model1.Invalidate(); }
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 } }