コード例 #1
0
        private void generateMaterialTable(T.DrawingArea field, string tableMaterialRow)
        {
            G.Point insertPoint = field.getSummaryInsertionPoint();
            double  scale       = field._tableHeads[0].Scale;

            G.Point currentPoint = field.getSummaryInsertionPoint();
            double  delta        = scale * 4;

            currentPoint.X  = insertPoint.X;
            currentPoint.Y -= delta;

            foreach (T.TableMaterialRow s in field._summarys)
            {
                insertRow(currentPoint, s, scale, tableMaterialRow);

                currentPoint.X  = insertPoint.X;
                currentPoint.Y -= 4 * scale;
            }
        }
コード例 #2
0
        public G.Point getSummaryInsertionPoint(DrawingArea field)
        {
            if (field.Valid)
            {
                double tempX = field._tableHeads[0].IP.X;
                double tempY = field._tableHeads[0].IP.Y;

                foreach (TableBendingRow r in field._rows)
                {
                    if (r.IP.Y < tempY)
                    {
                        tempY = r.IP.Y;
                    }
                }

                return(new G.Point(tempX, tempY));
            }
            else
            {
                throw new Exception();
            }
        }
コード例 #3
0
        private int showErrors(_SETUP init, T.DrawingArea f)
        {
            if (f._errors.Count > 0)
            {
                List <string> layerNames = new List <string>()
                {
                    kontrollLayer
                };
                init.initLayers(layerNames);
            }

            foreach (T.ErrorPoint e in f._errors)
            {
                double      scale       = e.Scale;
                _Ge.Point3d insertPoint = new _Ge.Point3d(e.IP.X, e.IP.Y, 0);
                createCircle(5 * scale, insertPoint);
                createCircle(40 * scale, insertPoint);

                write(e.ErrorMessage);
            }

            return(f._errors.Count);
        }
コード例 #4
0
        private void generateBendingTable(T.DrawingArea field, string tableBendingRow)
        {
            G.Point insertPoint = field._tableHeads[0].IP;
            double  scale       = field._tableHeads[0].Scale;

            G.Point currentPoint = field._tableHeads[0].IP;
            double  delta        = scale * 14;

            currentPoint.X  = insertPoint.X;
            currentPoint.Y -= delta;

            foreach (T.ErrorPoint e in field._errors)
            {
                write(e.ErrorMessage);
            }

            foreach (T.TableBendingRow b in field._rows)
            {
                insertRow(currentPoint, b, scale, tableBendingRow);

                currentPoint.X  = insertPoint.X;
                currentPoint.Y -= 4 * scale;
            }
        }
コード例 #5
0
        private void calculateWeights(DrawingArea field, string languange)
        {
            List <string> MaterialFilter = new List <string>();
            var           DistinctItems  = field._rows.GroupBy(x => x.Material).Select(y => y.First());

            foreach (TableBendingRow item in DistinctItems)
            {
                MaterialFilter.Add(item.Material);
            }

            foreach (string mat in MaterialFilter)
            {
                List <TableBendingRow> matList = field._rows.Where(x => x.Material == mat).ToList();

                List <int> DiameterFilter = new List <int>();
                DistinctItems = matList.GroupBy(x => x.Diameter).Select(y => y.First());
                foreach (TableBendingRow item in DistinctItems)
                {
                    DiameterFilter.Add(item.Diameter);
                }

                double totWeight = 0;

                DiameterFilter.Sort();

                foreach (int diam in DiameterFilter)
                {
                    double radius = diam / 2;
                    double area   = Math.PI * (Math.Pow(radius, 2));

                    List <TableBendingRow> diamList = matList.Where(x => x.Diameter == diam).ToList();

                    TableMaterialRow current = new TableMaterialRow();
                    current.Text     = "%%C" + diam.ToString();
                    current.Material = mat;
                    current.Weight   = 0;
                    current.Units    = "kg";

                    foreach (TableBendingRow r in diamList)
                    {
                        double count  = r.Count * r.Length * area;
                        double weight = count * 7850 / 1000000000;
                        current.Weight += weight;
                        totWeight      += weight;
                    }

                    field.addSummary(current);
                }

                TableMaterialRow total = new TableMaterialRow();

                if (languange == "EN")
                {
                    total.Text = "TOTAL";
                }
                else if (languange == "FIN")
                {
                    total.Text = "KOKON";
                }
                else
                {
                    total.Text = "KOKKU";
                }

                total.Material = mat;
                total.Weight   = totWeight;
                total.Units    = "kg";
                field.addSummary(total);
            }
        }
コード例 #6
0
ファイル: HandlerChecker.cs プロジェクト: 15831944/habile
        private List <ErrorPoint> checker(DrawingArea field)
        {
            List <ErrorPoint> errors = new List <ErrorPoint>();

            var dublicateTableRows = field._rows
                                     .GroupBy(i => i.Position)
                                     .Where(g => g.Count() > 1)
                                     .Select(j => j.First());

            foreach (TableBendingRow r in dublicateTableRows)
            {
                ErrorPoint er = new ErrorPoint(r.IP, "[VIGA] - TABEL - DUBLICATE - " + r.Position);
                errors.Add(er);
            }

            var dublicateBendings = field._bendings
                                    .GroupBy(i => i.Position)
                                    .Where(g => g.Count() > 1)
                                    .Select(j => j.First());

            foreach (BendingShape b in dublicateBendings)
            {
                ErrorPoint er = new ErrorPoint(b.IP, "[VIGA] - PAINUTUS - DUBLICATE - " + b.Position);
                errors.Add(er);
            }

            foreach (TableBendingRow r in field._rows)
            {
                if (r.Count == 0)
                {
                    ErrorPoint er = new ErrorPoint(r.IP, "[VIGA] - TABEL - KOGUS -> 0");
                    errors.Add(er);
                }
            }

            foreach (ReinforcementMark m in field._marks)
            {
                bool found = false;
                foreach (TableBendingRow r in field._rows)
                {
                    if (m.Position == r.Position)
                    {
                        found = true;
                        break;
                    }
                }

                if (found == false)
                {
                    ErrorPoint er = new ErrorPoint(m.IP, "[VIGA] - VIIDE - EI LEIA TABELIST - " + m.Position);
                    errors.Add(er);
                }
            }

            foreach (ReinforcementMark m in field._marks)
            {
                bool found = false;
                foreach (BendingShape b in field._bendings)
                {
                    if (m.Position == b.Position)
                    {
                        found = true;
                        break;
                    }
                }

                if (found == false && m.Shape != "A")
                {
                    ErrorPoint er = new ErrorPoint(m.IP, "[VIGA] - VIIDE - EI LEIA PAINUTUST - " + m.Position);
                    errors.Add(er);
                }
            }

            foreach (ReinforcementMark m in field._marks)
            {
                bool found = false;
                foreach (ReinforcementMark n in field._marks)
                {
                    if (ReferenceEquals(m, n))
                    {
                        continue;
                    }

                    if (m.IP == n.IP)
                    {
                        found = true;
                        break;
                    }
                }

                if (found == true)
                {
                    ErrorPoint er = new ErrorPoint(m.IP, "[VIGA] - VIIDE - TOPELT VIIDE - " + m.Position);
                    if (!errors.Contains(er))
                    {
                        errors.Add(er);
                    }
                }
            }

            foreach (BendingShape b in field._bendings)
            {
                bool found = false;
                foreach (TableBendingRow r in field._rows)
                {
                    if (b.Position == r.Position)
                    {
                        found = true;
                        break;
                    }
                }

                if (found == false)
                {
                    ErrorPoint er = new ErrorPoint(b.IP, "[VIGA] - PAINUTUS - EI LEIA TABELIST - " + b.Position);
                    errors.Add(er);
                }
            }

            foreach (BendingShape b in field._bendings)
            {
                bool found = false;
                foreach (ReinforcementMark m in field._marks)
                {
                    if (b.Position == m.Position)
                    {
                        found = true;
                        break;
                    }
                }

                if (found == false)
                {
                    ErrorPoint er = new ErrorPoint(b.IP, "[VIGA] - PAINUTUS - EI LEIA VIIDET - " + b.Position);
                    errors.Add(er);
                }
            }

            return(errors);
        }
コード例 #7
0
ファイル: HandlerChecker.cs プロジェクト: 15831944/habile
        private List <DrawingArea> sortData(List <G.Area> areas, List <TableHead> heads, List <ReinforcementMark> marks, List <BendingShape> bendings, List <TableBendingRow> rows, List <TableMaterialRow> summarys)
        {
            List <DrawingArea> data = new List <DrawingArea>();

            if (areas.Count != 0)
            {
                foreach (G.Area cur in areas)
                {
                    DrawingArea temp = new DrawingArea(cur);
                    data.Add(temp);
                }
            }
            else
            {
                DrawingArea temp = new DrawingArea(true);
                data.Add(temp);
            }

            foreach (TableHead head in heads)
            {
                foreach (DrawingArea cr in data)
                {
                    if (cr.isInArea(head.IP))
                    {
                        cr.addTableHead(head);
                        break;
                    }
                }
            }

            foreach (ReinforcementMark mark in marks)
            {
                foreach (DrawingArea cr in data)
                {
                    if (cr.isInArea(mark.IP))
                    {
                        if (mark.validate())
                        {
                            cr.addMark(mark);
                        }
                        else
                        {
                            cr.addError(new ErrorPoint(mark.IP, "[WARNING] VIIDE - \"" + mark.Content + "\" - could not read!"));
                        }

                        break;
                    }
                }
            }

            foreach (BendingShape bending in bendings)
            {
                foreach (DrawingArea cr in data)
                {
                    if (cr.isInArea(bending.IP))
                    {
                        cr.addBending(bending);
                        break;
                    }
                }
            }

            foreach (TableBendingRow row in rows)
            {
                foreach (DrawingArea cr in data)
                {
                    if (cr.isInArea(row.IP))
                    {
                        cr.addRow(row);
                        break;
                    }
                }
            }

            foreach (TableMaterialRow summary in summarys)
            {
                foreach (DrawingArea cr in data)
                {
                    if (cr.isInArea(summary.IP))
                    {
                        cr.addSummary(summary);
                        break;
                    }
                }
            }

            return(data);
        }