Exemplo n.º 1
0
        public void EnvelopeBySiteTest()
        {
            var model  = Model.FromJson(System.IO.File.ReadAllText(INPUT + "SiteBySketch.json"));
            var inputs = new EnvelopeBySiteInputs(
                60,
                5,
                3.0,
                true,
                10,
                1,
                100,
                null,
                "",
                "",
                new Dictionary <string, string>(),
                "",
                "",
                ""
                );
            var outputs = EnvelopeBySite.Execute(new Dictionary <string, Model> {
                { "Site", model }
            }, inputs);

            System.IO.File.WriteAllText(OUTPUT + "EnvelopeBySite.json", outputs.Model.ToJson());
            outputs.Model.AddElements(model.Elements.Values);
            outputs.Model.ToGlTF(OUTPUT + "EnvelopeBySite.glb");
        }
Exemplo n.º 2
0
        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 <EnvelopeBySiteInputs>(root, true);

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

            // 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 <EnvelopeBySiteInputs, EnvelopeBySiteOutputs>(store, EnvelopeBySite.Execute);
            await l.InvokeAsync(input);
        }
        public void EnvelopeBySiteTest()
        {
            var model   = Model.FromJson(System.IO.File.ReadAllText("../../../../../../TestOutput/SiteBySketch.json"));
            var inputs  = new EnvelopeBySiteInputs(3.0, 60, 10, 1.0, 100.0, 5.0, "", "", new Dictionary <string, string>(), "", "", "");
            var outputs = EnvelopeBySite.Execute(new Dictionary <string, Model> {
                { "Site", model }
            }, inputs);

            System.IO.File.WriteAllText("../../../../../../TestOutput/EnvelopeBySite.json", outputs.model.ToJson());
            outputs.model.ToGlTF("../../../../../../TestOutput/EnvelopeBySite.glb");
        }
Exemplo n.º 4
0
        public async Task InvokeFunction()
        {
            var store = new FileModelStore <EnvelopeBySiteInputs>("./", true);

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

            // 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 <EnvelopeBySiteInputs, EnvelopeBySiteOutputs>(store, EnvelopeBySite.Execute);
            var output = await l.InvokeAsync(input);
        }
Exemplo n.º 5
0
        public void EnvelopeBySiteTest()
        {
            var model  = Model.FromJson(System.IO.File.ReadAllText(INPUT + "SiteBySketch.json"));
            var inputs = new EnvelopeBySiteInputs(
                siteSetback: 3.0,
                buildingHeight: 60.0,
                setbackInterval: 10.0,
                setbackDepth: 1.0,
                minimumTierArea: 100.0,
                foundationDepth: 5.0,
                "", "", new Dictionary <string, string>(), "", "", "");
            var outputs = EnvelopeBySite.Execute(new Dictionary <string, Model> {
                { "Site", model }
            }, inputs);

            System.IO.File.WriteAllText(OUTPUT + "EnvelopeBySite.json", outputs.Model.ToJson());
            outputs.Model.AddElements(model.Elements.Values);
            outputs.Model.ToGlTF(OUTPUT + "EnvelopeBySite.glb");
        }