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); }
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"); }
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"); }
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); }