Esempio n. 1
0
        public async Task InvokeFunction()
        {
            var root   = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "../../../../");
            var config = Hypar.Functions.Function.FromJson(File.ReadAllText(Path.Combine(root, "hypar.json")));

            var store = new FileModelStore <FloorsByLevelsInputs>(root, true);

            // Create an input object with default values.
            var input = new FloorsByLevelsInputs();

            // Read local input files to populate incoming test data.
            if (config.ModelDependencies != null)
            {
                var modelInputKeys = new Dictionary <string, string>();
                foreach (var dep in config.ModelDependencies)
                {
                    modelInputKeys.Add(dep.Name, $"{dep.Name}.json");
                }
                input.ModelInputKeys = modelInputKeys;
            }

            // Invoke the function.
            // The function invocation uses a FileModelStore
            // which will write the resulting model to disk.
            // You'll find the model at "./model.gltf"
            var l = new InvocationWrapper <FloorsByLevelsInputs, FloorsByLevelsOutputs>(store, FloorsByLevels.Execute);
            await l.InvokeAsync(input);
        }
Esempio n. 2
0
        public void GHFloorsByLevelsTest()
        {
            var model   = Model.FromJson(System.IO.File.ReadAllText("../../../../../../TestOutput/Building-01.json"));
            var inputs  = new FloorsByLevelsInputs(0.2, 0.5, "", "", new Dictionary <string, string>(), "", "", "");
            var outputs = FloorsByLevels.Execute(new Dictionary <string, Model> {
                { "Levels", model }
            }, inputs);

            System.IO.File.WriteAllText("../../../../../../TestOutput/GHFloorsByLevels.json", outputs.Model.ToJson());
            outputs.Model.ToGlTF("../../../../../../TestOutput/GHFloorsByLevels.glb");
        }
Esempio n. 3
0
        public async Task InvokeFunction()
        {
            var store = new FileModelStore <FloorsByLevelsInputs>("./", true);

            // Create an input object with default values.
            var input = new FloorsByLevelsInputs();

            // Invoke the function.
            // The function invocation uses a FileModelStore
            // which will write the resulting model to disk.
            // You'll find the model at "./model.gltf"
            var l      = new InvocationWrapper <FloorsByLevelsInputs, FloorsByLevelsOutputs>(store, FloorsByLevels.Execute);
            var output = await l.InvokeAsync(input);
        }
        public void FloorsByLevelsTest()
        {
            var model =
                Model.FromJson(System.IO.File.ReadAllText(INPUT + "LevelsByEnvelope.json"));
            var inputs =
                new FloorsByLevelsInputs(
                    floorSetback: 0.2,
                    floorThickness: 0.1,
                    "", "", new Dictionary <string, string>(), "", "", "");
            var outputs =
                FloorsByLevels.Execute(new Dictionary <string, Model> {
                { "Levels", model }
            }, inputs);

            System.IO.File.WriteAllText(OUTPUT + "FloorsByLevels.json", outputs.Model.ToJson());
            outputs.Model.ToGlTF(OUTPUT + "FloorsByLevels.glb");
        }