示例#1
0
 static void checkIfCorrectlyConfigured()
 {
     try {
         OpenStudio.Model model = new OpenStudio.Model();
     } catch (Exception e) {
         Console.WriteLine("It appears that there was an error accessing the C# SWIG Bindings for OpenStudio. Note that the libraries installed in <installdir>/CSharp/openstudio need to be accessible to this application at runtime, either through the path or in the same directory as the exe. Nothing else will work properly have this point.\n\nError Text: " + e.InnerException.InnerException.Message, "Error loading libraries");
         throw e;
     }
 }
示例#2
0
        public void BasicModel()
        {
            // Console.WriteLine("\nCreate an empty model and add 2 Spaces");

            OpenStudio.Model model = new OpenStudio.Model();

            OpenStudio.Space space1 = new OpenStudio.Space(model);
            space1.setName("First Space");
            OpenStudio.Space space2 = new OpenStudio.Space(model);
            space2.setName("Second Space");

            OpenStudio.SpaceVector spaces = model.getSpaces();
            var spaceArray = spaces.ToArray();

            Assert.Equal(2, spaceArray.Length);

            Assert.True(Array.Exists(spaceArray, s => (s.nameString() == "First Space")));
            Assert.True(Array.Exists(spaceArray, s => (s.nameString() == "Second Space")));
        }
示例#3
0
        static void createAFewSpaces()
        {
            Console.WriteLine("\nCreate an empty model and add 2 Spaces");

            OpenStudio.Model model = new OpenStudio.Model();

            OpenStudio.Space space1 = new OpenStudio.Space(model);
            space1.setName("First Space");
            OpenStudio.Space space2 = new OpenStudio.Space(model);
            space2.setName("Second Space");

            OpenStudio.SpaceVector spaces = model.getSpaces();
            var spaceArray = spaces.ToArray();


            Console.WriteLine("The model has " + spaceArray.Length + " Spaces:");
            for (int i = 0; i < spaceArray.Length; ++i)
            {
                Console.WriteLine("* {0}.", spaceArray[i].nameString());
            }
        }