Example #1
0
        private List <T.BendingShape> getBendingData(List <_Db.BlockReference> blocks)
        {
            List <T.BendingShape> parse = new List <T.BendingShape>();

            foreach (_Db.BlockReference block in blocks)
            {
                G.Point        insp    = new G.Point(block.Position.X, block.Position.Y);
                T.BendingShape current = new T.BendingShape(insp, block.Name);

                foreach (_Db.ObjectId arId in block.AttributeCollection)
                {
                    _Db.DBObject           obj = _c.trans.GetObject(arId, _Db.OpenMode.ForWrite);
                    _Db.AttributeReference ar  = obj as _Db.AttributeReference;
                    setBendingParameters(ar, current);
                }

                current.validator();
                if (current.Valid)
                {
                    parse.Add(current);
                }
                else
                {
                    write(current.Reason);
                }
            }

            return(parse);
        }
Example #2
0
        public TableBendingRow(BendingShape b)
        {
            _shape    = b.Shape;
            _position = b.Position;
            _material = b.Material;

            _count    = 0;
            _diameter = b.Diameter;
            _length   = b.Length;

            _A = b.A;
            _B = b.B;
            _C = b.C;
            _D = b.D;
            _E = b.E;
            _F = b.F;
            _G = b.G;

            _U = b.U;
            _V = b.V;

            _R = b.R;

            _X = b.X;
            _Y = b.Y;
        }
Example #3
0
        private void setBendingParameters(_Db.AttributeReference ar, T.BendingShape bending)
        {
            if (ar != null)
            {
                if (ar.Tag == "Positsioon")
                {
                    bending.Position = ar.TextString;
                }
                else if (ar.Tag == "Teraseklass")
                {
                    bending.Material = ar.TextString;
                }
                else if (ar.Tag == "U")
                {
                    bending.U = ar.TextString;
                }
                else if (ar.Tag == "V")
                {
                    bending.V = ar.TextString;
                }
                else
                {
                    int temp = 99999;
                    Int32.TryParse(ar.TextString, out temp);

                    if (ar.Tag == "A")
                    {
                        bending.A = temp;
                    }
                    else if (ar.Tag == "B")
                    {
                        bending.B = temp;
                    }
                    else if (ar.Tag == "C")
                    {
                        bending.C = temp;
                    }
                    else if (ar.Tag == "D")
                    {
                        bending.D = temp;
                    }
                    else if (ar.Tag == "E")
                    {
                        bending.E = temp;
                    }
                    else if (ar.Tag == "F")
                    {
                        bending.F = temp;
                    }
                    else if (ar.Tag == "G")
                    {
                        bending.G = temp;
                    }
                    else if (ar.Tag == "R")
                    {
                        bending.R = temp;
                    }
                    else if (ar.Tag == "X")
                    {
                        bending.X = temp;
                    }
                    else if (ar.Tag == "Y")
                    {
                        bending.Y = temp;
                    }
                }
            }
        }
Example #4
0
        public List <DrawingArea> main(List <G.Area> areas, List <TableHead> heads, List <ReinforcementMark> marks, List <BendingShape> bendings, List <TableBendingRow> rows)
        {
            List <DrawingArea> fields = sortData(areas, heads, marks, bendings, rows);

            foreach (DrawingArea f in fields)
            {
                if (f._tableHeads.Count < 1)
                {
                    f.setInvalid("[WARNING] - Painutustabel_pais - Puudub, ala jääb vahele");
                    continue;
                }
                if (f._tableHeads.Count > 1)
                {
                    f.setInvalid("[WARNING] - Painutustabel_pais - Rohkem kui 1, ala jääb vahele");
                    continue;
                }
                if (f._rows.Count > 0)
                {
                    f.setInvalid("[WARNING] - Tabel on juba koostatud");
                    continue;
                }
                if (f._marks.Count == 0)
                {
                    f.setInvalid("[WARNING] - Raamjoone vahel pole ühtegi viidet");
                    continue;
                }
                if (f._defaultMaterial.Count > 1)
                {
                    f.setInvalid("[WARNING] - Raud_A_DEFAULT - Rohkem kui 1, ala jääb vahele");
                    continue;
                }


                foreach (BendingShape b in f._bendings)
                {
                    TableBendingRow r = new TableBendingRow(b);
                    f.addRow(r);
                }


                string currentDefaultMaterial = defaultMaterial;
                if (f._defaultMaterial.Count == 0)
                {
                    try
                    {
                        currentDefaultMaterial = f._rows.GroupBy(i => i.Material).OrderByDescending(grp => grp.Count()).Select(grp => grp.Key).First();
                    }
                    catch
                    {
                    }
                }
                else
                {
                    currentDefaultMaterial = f._defaultMaterial[0].Material;
                }


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

                    if (found == false)
                    {
                        if (m.Shape == "A")
                        {
                            BendingShape newBending = new BendingShape(m.IP, "Raud_A");
                            newBending.A        = m.Other;
                            newBending.Material = currentDefaultMaterial;
                            newBending.Position = m.Position;

                            if (newBending.validator())
                            {
                                TableBendingRow newRow = new TableBendingRow(newBending);
                                newRow.Count += m.Count;
                                f.addRow(newRow);
                            }
                        }
                    }
                }

                f._rows = f._rows.OrderBy(b => b.Shape).ThenBy(s => s.Diameter).ThenBy(s => s.Length).ToList();
            }

            return(fields);
        }
Example #5
0
 internal void addMaterial(BendingShape df)
 {
     _defaultMaterial.Add(df);
 }
Example #6
0
 internal void addBending(BendingShape bd)
 {
     _bendings.Add(bd);
 }