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 <EnvelopeByCenterlineInputs>(root); // Create an input object with default values. var input = new EnvelopeByCenterlineInputs(); // 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 <EnvelopeByCenterlineInputs, EnvelopeByCenterlineOutputs>(store, EnvelopeByCenterline.Execute); await l.InvokeAsync(input); }
public void EnvelopeByCenterlineTest() { var polyline = new Polygon ( new [] { Vector3.Origin, new Vector3(25.0, 0.0), new Vector3(55.0, 20.0), new Vector3(85.0, 60.0) }); var inputs = new EnvelopeByCenterlineInputs( centerline: polyline, buildingHeight: 55.0, barWidth: 25.0, foundationDepth: 5.0, "", "", new Dictionary <string, string>(), "", "", ""); var outputs = EnvelopeByCenterline.Execute(new Dictionary <string, Model> { { "Envelope", new Model() } }, inputs); System.IO.File.WriteAllText(OUTPUT + "EnvelopeByCenterline.json", outputs.Model.ToJson()); outputs.Model.ToGlTF(OUTPUT + "EnvelopeByCenterline.glb"); }
public async Task InvokeFunction() { var store = new FileModelStore <EnvelopeByCenterlineInputs>("./", true); // Create an input object with default values. var input = new EnvelopeByCenterlineInputs(); // 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 <EnvelopeByCenterlineInputs, EnvelopeByCenterlineOutputs>(store, EnvelopeByCenterline.Execute); var output = await l.InvokeAsync(input); }