示例#1
0
        public async Task <FloorsByDXFOutputs> Handler(FloorsByDXFInputs args, ILambdaContext context)
        {
            if (this.store == null)
            {
                // Preload the dependencies (if they exist),
                // so that they are available during model deserialization.
                var asmLocation = this.GetType().Assembly.Location;
                var asmDir      = Path.GetDirectoryName(asmLocation);
                var asmName     = Path.GetFileNameWithoutExtension(asmLocation);
                var depPath     = Path.Combine(asmDir, $"{asmName}.Dependencies.dll");

                if (File.Exists(depPath))
                {
                    Console.WriteLine($"Loading dependencies from assembly: {depPath}...");
                    Assembly.LoadFrom(depPath);
                    Console.WriteLine("Dependencies assembly loaded.");
                }

                this.store = new S3ModelStore <FloorsByDXFInputs>(RegionEndpoint.USWest1);
            }

            var l      = new InvocationWrapper <FloorsByDXFInputs, FloorsByDXFOutputs>(store, FloorsByDXF.Execute);
            var output = await l.InvokeAsync(args);

            return(output);
        }
示例#2
0
        /// <summary>
        /// Generates the specified quantity of stacked Floors from a DXF LWPolyline pattern and supplied elevations.
        /// </summary>
        /// <param name="model">The input model.</param>
        /// <param name="input">The arguments to the execution.</param>
        /// <returns>A FloorsByDXFOutputs instance containing computed results and the model with any new elements.</returns>
        public static FloorsByDXFOutputs Execute(Dictionary <string, Model> inputModels, FloorsByDXFInputs input)
        {
            /// Your code here.
            var height    = 1.0;
            var volume    = input.Length * input.Width * height;
            var output    = new FloorsByDXFOutputs(volume);
            var rectangle = Polygon.Rectangle(input.Length, input.Width);
            var mass      = new Mass(rectangle, height);

            output.Model.AddElement(mass);
            return(output);
        }