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 <RoomsByFloorsInputs>(root, true);

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

            // 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 <RoomsByFloorsInputs, RoomsByFloorsOutputs>(store, RoomsByFloors.Execute);
            await l.InvokeAsync(input);
        }
        public void RoomsByFloorsTest()
        {
            var inputs  = new RoomsByFloorsInputs(2.0, 2.0, 5.0, 5.0, 1.0, 0.0, false, "", "", new Dictionary <string, string>(), "", "", "");
            var model   = Model.FromJson(System.IO.File.ReadAllText("../../../../../../TestOutput/FloorsByLevels.json"));
            var outputs = RoomsByFloors.Execute(new Dictionary <string, Model> {
                { "Floors", model }
            }, inputs);

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

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

            // 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 <RoomsByFloorsInputs, RoomsByFloorsOutputs>(store, RoomsByFloors.Execute);
            var output = await l.InvokeAsync(input);
        }