예제 #1
0
        private void setRowAttribute(_Db.AttributeReference ar, T.TableBendingRow row)
        {
            if (ar != null)
            {
                if (ar.Tag == "Klass")
                {
                    row.Material = ar.TextString;
                }
                else if (ar.Tag == "Pos")
                {
                    row.Position = ar.TextString;
                }
                else
                {
                    int temp = 99999;
                    Int32.TryParse(ar.TextString, out temp);

                    if (ar.Tag == "Diam")
                    {
                        row.Diameter = temp;
                    }
                    else if (ar.Tag == "tk")
                    {
                        row.Count = temp;
                    }
                    else if (ar.Tag == "Pikkus")
                    {
                        row.Length = temp;
                    }
                }
            }
        }
예제 #2
0
        private List <T.TableBendingRow> getRowData(List <_Db.BlockReference> blocks)
        {
            List <T.TableBendingRow> parse = new List <T.TableBendingRow>();

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

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

                parse.Add(current);
            }

            return(parse);
        }
예제 #3
0
        private void insertRow(G.Point insertion, T.TableBendingRow rowData, double scale, string tableBendingRow)
        {
            _Ge.Point3d insertPointBlock = new _Ge.Point3d(insertion.X, insertion.Y, 0);
            using (_Db.BlockReference newBlockReference = new _Db.BlockReference(insertPointBlock, _c.blockTable[tableBendingRow]))
            {
                newBlockReference.Layer = bendingLayer;
                _c.modelSpace.AppendEntity(newBlockReference);
                _c.trans.AddNewlyCreatedDBObject(newBlockReference, true);
                newBlockReference.TransformBy(_Ge.Matrix3d.Scaling(scale, insertPointBlock));

                _Db.BlockTableRecord blockBlockTable = _c.trans.GetObject(_c.blockTable[tableBendingRow], _Db.OpenMode.ForRead) as _Db.BlockTableRecord;
                if (blockBlockTable.HasAttributeDefinitions)
                {
                    foreach (_Db.ObjectId objID in blockBlockTable)
                    {
                        _Db.DBObject obj = _c.trans.GetObject(objID, _Db.OpenMode.ForRead) as _Db.DBObject;

                        if (obj is _Db.AttributeDefinition)
                        {
                            _Db.AttributeDefinition attDef = obj as _Db.AttributeDefinition;

                            if (!attDef.Constant)
                            {
                                using (_Db.AttributeReference attRef = new _Db.AttributeReference())
                                {
                                    attRef.SetAttributeFromBlock(attDef, newBlockReference.BlockTransform);
                                    attRef.Position = attDef.Position.TransformBy(newBlockReference.BlockTransform);
                                    setRowParameters(attRef, rowData);
                                    newBlockReference.AttributeCollection.AppendAttribute(attRef);
                                    _c.trans.AddNewlyCreatedDBObject(attRef, true);
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #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);
        }
예제 #5
0
 internal void addRow(TableBendingRow r)
 {
     _rows.Add(r);
 }
예제 #6
0
 private void setRowParameters(_Db.AttributeReference ar, T.TableBendingRow rowData)
 {
     if (ar != null)
     {
         if (ar.Tag == "Pos")
         {
             ar.TextString = rowData.Position.ToString();
         }
         else if (ar.Tag == "Klass")
         {
             ar.TextString = rowData.Material.ToString();
         }
         else if (ar.Tag == "Diam")
         {
             ar.TextString = rowData.Diameter.ToString();
         }
         else if (ar.Tag == "tk")
         {
             ar.TextString = rowData.Count.ToString();
         }
         else if (ar.Tag == "Pikkus")
         {
             ar.TextString = rowData.Length.ToString();
         }
         else if (ar.Tag == "a")
         {
             if (rowData.A != -1)
             {
                 ar.TextString = rowData.A.ToString();
             }
         }
         else if (ar.Tag == "b")
         {
             if (rowData.B != -1)
             {
                 ar.TextString = rowData.B.ToString();
             }
         }
         else if (ar.Tag == "c")
         {
             if (rowData.C != -1)
             {
                 ar.TextString = rowData.C.ToString();
             }
         }
         else if (ar.Tag == "d")
         {
             if (rowData.D != -1)
             {
                 ar.TextString = rowData.D.ToString();
             }
         }
         else if (ar.Tag == "e")
         {
             if (rowData.E != -1)
             {
                 ar.TextString = rowData.E.ToString();
             }
         }
         else if (ar.Tag == "f")
         {
             if (rowData.F != -1)
             {
                 ar.TextString = rowData.F.ToString();
             }
         }
         else if (ar.Tag == "g")
         {
             if (rowData.G != -1)
             {
                 ar.TextString = rowData.G.ToString();
             }
         }
         else if (ar.Tag == "u")
         {
             if (rowData.U != "")
             {
                 ar.TextString = rowData.U;
             }
         }
         else if (ar.Tag == "v")
         {
             if (rowData.V != "")
             {
                 ar.TextString = rowData.V;
             }
         }
         else if (ar.Tag == "R")
         {
             if (rowData.R != -1)
             {
                 ar.TextString = rowData.R.ToString();
             }
         }
         else if (ar.Tag == "x")
         {
             if (rowData.X != -1)
             {
                 ar.TextString = rowData.X.ToString();
             }
         }
         else if (ar.Tag == "y")
         {
             if (rowData.Y != -1)
             {
                 ar.TextString = rowData.Y.ToString();
             }
         }
     }
 }