public async Task InvokeFunction() { var root = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "../../../../"); var config = Hypar.Functions.Function.FromJson(File.ReadAllText(Path.Combine(root, "hypar.json"))); var store = new FileModelStore<StructureInputs>(root, true); // Create an input object with default values. var input = new StructureInputs(); // 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<StructureInputs, StructureOutputs>(store, Structure.Execute); await l.InvokeAsync(input); }
public void StructureTest() { var model = Model.FromJson(System.IO.File.ReadAllText("../../../../core.json")); var inputs = new StructureInputs(4.0, 5.0, "", "", new Dictionary <string, string>(), "", "", ""); var outputs = Structure.Execute(new Dictionary <string, Model> { { "envelope", model } }, inputs); System.IO.File.WriteAllText("../../../../structureCore.json", outputs.model.ToJson()); outputs.model.ToGlTF("../../../../structureCore.glb"); model = Model.FromJson(System.IO.File.ReadAllText("../../../../mass.json")); inputs = new StructureInputs(4.0, 5.0, "", "", new Dictionary <string, string>(), "", "", ""); outputs = Structure.Execute(new Dictionary <string, Model> { { "envelope", model } }, inputs); System.IO.File.WriteAllText("../../../../structureMass.json", outputs.model.ToJson()); outputs.model.ToGlTF("../../../../structureMass.glb"); model = Model.FromJson(System.IO.File.ReadAllText("../../../../story.json")); inputs = new StructureInputs(4.0, 5.0, "", "", new Dictionary <string, string>(), "", "", ""); outputs = Structure.Execute(new Dictionary <string, Model> { { "envelope", model } }, inputs); System.IO.File.WriteAllText("../../../../structureStory.json", outputs.model.ToJson()); outputs.model.ToGlTF("../../../../structureStory.glb"); }
public void StructureTest() { var envModel = Model.FromJson(System.IO.File.ReadAllText(INPUT + "Envelope.json")); var lvlModel = Model.FromJson(System.IO.File.ReadAllText(INPUT + "Levels.json")); var inputs = new StructureInputs( 5.0, 6.0, 1.5, false, StructureInputsTypeOfConstruction.Steel, StructureInputsColumnType.W10x100, StructureInputsGirderType.W10x100, StructureInputsBeamType.W10x100, 1.5, false, 0.1254, false, maximumNeighborSpan: 2, bucketName: "", uploadsBucket: "", modelInputKeys: new Dictionary <string, string>(), gltfKey: "", elementsKey: "", ifcKey: ""); var outputs = Structure.Execute( new Dictionary <string, Model> { { "Envelope", envModel }, { "Levels", lvlModel } }, inputs); System.IO.File.WriteAllText(OUTPUT + "Structure.json", outputs.Model.ToJson()); outputs.Model.AddElements(envModel.Elements.Values); outputs.Model.AddElements(lvlModel.Elements.Values); outputs.Model.ToGlTF(OUTPUT + "Structure.glb"); }
public async Task InvokeFunction() { var store = new FileModelStore <StructureInputs>("./", true); // Create an input object with default values. var input = new StructureInputs(); // 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 <StructureInputs, StructureOutputs>(store, Structure.Execute); var output = await l.InvokeAsync(input); }