0

I am writing a test for my simulation, and saving my results to an array of doubles. As explained before, my results are not being saved to the desired format. Here is the code:

using ScottPlot;
using System.Collections.Generic;
using System.Linq;

class Test {
    Armor armor;
    Projectile projectile;

    List<float> armor_thickness_list = new List<float>();
    List<float> penetration_list = new List<float>();
    
    public void TestPenetration() {
        armor = new Armor();
        projectile = new Projectile();

        foreach (int value in Enumerable.Range(1, 10)){
            armor.thickness = value / 10;
            armor_thickness_list.Add(armor.thickness);

            float penetration = armor.CalculatePenetration(armor, projectile);
            penetration_list.Add(penetration);
        }
        double[] armor_thickness = armor_thickness_list.Select(x=>(double)x).ToArray();
        double[] penetration_array = armor_thickness_list.Select(x=>(double)x).ToArray();
        
        var plt = new ScottPlot.Plot(400,300);
        plt.AddScatter(armor_thickness, penetration_array);

        plt.SaveFig("PenetrationTest.png");
    }
}

I was expecting the image file to save with my results, but there was no file there. Any help would be appreciated.

1 Answers1

0

You can see where the file is being saved by setting a breakpoint on plt.SaveFig("PenetrationTest.png") and then execute System.IO.File.Path.GetFullPath("PenetrationTest.png") in your debug terminal.

If you just give the file name for SaveFig, it defaults to saving in the working directory of the executable, which in debug mode is bin/Debug. You could specify the full path you want the image to be saved to during development, but take a look at this answer for other alternatives.

PacifismPostMortem
  • 105
  • 1
  • 4
  • 9