예제 #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 <RoofByDXFInputs>(root);

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

            // 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 <RoofByDXFInputs, RoofByDXFOutputs>(store, RoofByDXF.Execute);
            await l.InvokeAsync(input);
        }
예제 #2
0
        public void RoofByDXF3()
        {
            var inputs =
                new RoofByDXFInputs(
                    new Hypar.Functions.Execution.InputData(INPUT + "Roof3.dxf"),
                    roofElevation: 20.0,
                    roofThickness: 0.1,
                    "", "", new Dictionary <string, string>(), "", "", "");
            var outputs =
                RoofByDXF.Execute(new Dictionary <string, Model> {
                { "Program", new Model() }
            }, inputs);

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