コード例 #1
0
        private void ProcessReportSolution(reportSolution rSol)
        {
            // create document
            Document doc = new Document(rSol.reportParameters.name, rSol.reportParameters.description, rSol.reportParameters.author, DateTime.Now, null);
            // load analysis
            CasePalletAnalysis analysis = LoadPalletAnalysis(doc, rSol.solutionRef.analysisId);

            if (null == analysis)
            {
                return;
            }
            // compute solutions
            treeDiM.StackBuilder.Engine.CasePalletSolver solver = new treeDiM.StackBuilder.Engine.CasePalletSolver();
            solver.ProcessAnalysis(analysis);
            // retrieve wanted solution
            List <Basics.CasePalletSolution> solutions = analysis.Solutions;

            if (rSol.solutionRef.index >= solutions.Count)
            {
                throw new Exception(string.Format("Analysis {0} has no solution with index {1}", analysis.Name, rSol.solutionRef.index));
            }
            Basics.CasePalletSolution sol = solutions[(int)rSol.solutionRef.index];
            // selected solution
            SelCasePalletSolution selSolution = new SelCasePalletSolution(doc, analysis, sol);
            // generate report
            ReporterMSWord reporter = new ReporterMSWord(new ReportData(analysis, selSolution)
                                                         , rSol.reportParameters.templateFilePath, rSol.reportParameters.outputPath, new Margins());
        }
コード例 #2
0
        private void ProcessViewSolution(viewSolution vSol)
        {
            // instantiate graphics
            Graphics3DImage graphics = InitializeImageFromViewParameters(vSol.viewParameters);
            // load analysis
            CasePalletAnalysis analysis = LoadPalletAnalysis(null, vSol.solutionRef.analysisId);

            // compute solutions
            treeDiM.StackBuilder.Engine.CasePalletSolver solver = new treeDiM.StackBuilder.Engine.CasePalletSolver();
            solver.ProcessAnalysis(analysis);
            // retrieve wanted solution
            List <Basics.CasePalletSolution> solutions = analysis.Solutions;

            if (vSol.solutionRef.index >= solutions.Count)
            {
                throw new Exception(string.Format("Analysis {0} has no solution with index {1}", analysis.Name, vSol.solutionRef.index));
            }
            Basics.CasePalletSolution sol = solutions[(int)vSol.solutionRef.index];
            // display solution
            CasePalletSolutionViewer solViewer = new CasePalletSolutionViewer(sol);

            solViewer.Draw(graphics);
            FinalizeImageFromViewParameters(vSol.viewParameters, graphics);
        }