Part rebar calculation

Part rebar calculation

k005
Advisor Advisor
280 Views
1 Reply
Message 1 of 2

Part rebar calculation

k005
Advisor
Advisor

Hello friends


I'm doing a study for iron footage, friends. How should I edit the code according to the algorithm in the dwg file I have attached. Is anyone available that can help?


Thanks.

 

 

 

 

[CommandMethod("demirPART")]
        public void demirPart()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor editor = doc.Editor;
            editor.WriteMessage("Demir ağırlık hesabı için kolon açılımlarından Text Obje seçiniz..");
            // Define the selection filter to select Text objects only
      
            TypedValue[] filterList = new TypedValue[] {
                new TypedValue((int)DxfCode.Start, "TEXT"),
                
            };
            SelectionFilter selectionFilter = new SelectionFilter(filterList);

            // Prompt user to select Text objects
            PromptSelectionResult selectionResult = editor.GetSelection(selectionFilter);
            if (selectionResult.Status != PromptStatus.OK)
            {
                editor.WriteMessage("Text Obje seçilmedi.!");
                return;
            }
            int sbCount = 0;
            // Get the selected Text objects
            //string ayriCaplar = "";

            //List<int> capListesi = new List<int>();
            //List<int> adetListesi = new List<int>();
            //List<double> boyListesi = new List<double>();
            //List<int> uniqueCaps = new List<int>();

            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                SelectionSet selectionSet = selectionResult.Value;
                foreach (SelectedObject selectedObject in selectionSet)
                {
                    if (selectedObject.ObjectId.ObjectClass.DxfName == "TEXT")
                    {
                        DBText textObject = tr.GetObject(selectedObject.ObjectId, OpenMode.ForRead) as DBText;
                        if (textObject != null)
                        {
                            string text = textObject.TextString;
                            string sbPattern = @"(\.SB)|(S{1,3}|(P{1,3}))";//kolon veya perde adedi
                            MatchCollection sbMatches = Regex.Matches(text, sbPattern);
                            sbCount += sbMatches.Count;

                            //string dntPattern = @"(\d+)ø(\d+)\/?\d*?\s+?L=(\d+)";//kolon veya perde adedi
                            //MatchCollection dntMatches = Regex.Matches(text, dntPattern);


                            //foreach (var kayit in dntMatches)
                            //{
                            //    var rgx = new Regex(@"(\d+)ø(\d+)\/?\d*?\s+?L=(\d+)");
                            //    var matches = rgx.Matches((string)kayit);
                            //    if (matches.Count < 1) continue;
                            //    capListesi.Add(int.Parse(matches[0].Groups[2].Value));
                            //    adetListesi.Add(int.Parse(matches[0].Groups[1].Value));
                            //    boyListesi.Add(double.Parse(matches[0].Groups[3].Value));
                            //}


                        }

                    }

                    //var caP1 = capListesi.Distinct();
                    //foreach (int cp in caP1)
                    //{
                    //    uniqueCaps.Add(cp);
                    //}

                    //for (int i = 0; i < uniqueCaps.Count; i++)
                    //{
                    //    double mysum = 0.0;
                    //    for (int f = 0; f < capListesi.Count; f++)
                    //    {

                    //        if (capListesi[f] == uniqueCaps[i])
                    //        {
                    //             mysum += trg.Krs(uniqueCaps[i]) * 0.00617 * (adetListesi[f] * boyListesi[f] / 100) / 1000;
                    //        }

                    //    }
                    //    ayriCaplar = ayriCaplar + "ø" + uniqueCaps[i] + " = " + mysum.ToString("F3") + " ton" + "\n";
                    //}
                }

               // System.Windows.Forms.MessageBox.Show(adetListesi + "\n", "Donatılar");
                tr.Commit();
            }

        }

 

 

 

 

0 Likes
281 Views
1 Reply
Reply (1)
Message 2 of 2

k005
Advisor
Advisor

****************************** I HAVE NOT SOLVE THIS PROBLEM. THANKS. ****************

0 Likes