Пример #1
0
        public async Task InvokeFunction()
        {
            var root   = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "../../../../");
            var config = Hypar.Model.Function.FromJson(File.ReadAllText(Path.Combine(root, "hypar.json")));

            var store = new FileModelStore <PlanByProgramInputs>(root);

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

            // 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 <PlanByProgramInputs, PlanByProgramOutputs>(store, PlanByProgram.Execute);
            await l.InvokeAsync(input);
        }
        public void AxisTest_School()
        {
            var inputs =
                new PlanByProgramInputs(suiteRatio: 1.5,
                                        corridorWidth: 2.5,
                                        plenumHeight: 1.5,
                                        multipleLevels: true,
                                        diagonalAdjacency: true,
                                        conformFloorsToRooms: true,
                                        SuitePlanType.Axis,
                                        PrimaryDirection.Northeast,
                                        CoordinateAdjacency.Minimum,
                                        "", "", new Dictionary <string, string>(), "", "", "");
            var model =
                Model.FromJson(System.IO.File.ReadAllText(INPUT + "ProgramByCSV_School.json"));
            var outputs =
                PlanByProgram.Execute(new Dictionary <string, Model> {
                { "Program", model }
            }, inputs);

            System.IO.File.WriteAllText(OUTPUT + "PlanByProgram-Axis_School.json", outputs.Model.ToJson());
            outputs.Model.AddElements(model.Elements.Values);
            outputs.Model.ToGlTF(OUTPUT + "PlanByProgram-Axis_School.glb");
        }