コード例 #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 <LevelsByEnvelopeInputs>(root);

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

            // 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 <LevelsByEnvelopeInputs, LevelsByEnvelopeOutputs>(store, LevelsByEnvelope.Execute);
            await l.InvokeAsync(input);
        }
コード例 #2
0
        public void LevelsByEnvelopeTest()
        {
            var inputs  = new LevelsByEnvelopeInputs(6.0, 4.0, 5.0, "", "", new Dictionary <string, string>(), "", "", "");
            var model   = Model.FromJson(System.IO.File.ReadAllText("../../../../../../TestOutput/EnvelopeBySketch.json"));
            var outputs = LevelsByEnvelope.Execute(new Dictionary <string, Model> {
                { "Envelope", model }
            }, inputs);

            System.IO.File.WriteAllText("../../../../../../TestOutput/LevelsByEnvelope.json", outputs.model.ToJson());
            outputs.model.ToGlTF("../../../../../../TestOutput/LevelsByEnvelope.glb");
        }
コード例 #3
0
        public void LevelsByEnvelopeTest()
        {
            var inputs  = new LevelsByEnvelopeInputs(3.0, 3.0, 3.0, "", "", new Dictionary <string, string>(), "", "", "");
            var model   = Model.FromJson(System.IO.File.ReadAllText(INPUT + "EnvelopeBySketch.json"));
            var outputs = LevelsByEnvelope.Execute(new Dictionary <string, Model> {
                { "Envelope", model }
            }, inputs);

            System.IO.File.WriteAllText(OUTPUT + "LevelsByEnvelope.json", outputs.Model.ToJson());
            outputs.Model.AddElements(model.Elements.Values);
            outputs.Model.ToGlTF(OUTPUT + "LevelsByEnvelope.glb");
        }
コード例 #4
0
        public async Task InvokeFunction()
        {
            var store = new FileModelStore <LevelsByEnvelopeInputs>("./", true);

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

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