Esempio n. 1
0
        /// <summary>
        /// Сделано временно для быстрого ввода данных о диаметрах с чертежей и вывод их в упорядоченную таблицу
        /// Здесь же добавлен объем бетона
        /// </summary>
        public static void MakeRebarString()
        {
            string heading  = "БЕТОН\tД40\tД36\tД32\tД28\tД25\tД20\tД16\tД12\tД10\tД8";
            var    dict     = new Dictionary <string, string>();
            var    splitted = heading.Split('\t');

            foreach (var s in splitted)
            {
                dict.Add(s, "");
            }

            var sset = Input.Objects("Выберите сначала объем бетона затем текстовые элементы ведомости расхода стали"); if (Input.StatusBad)
            {
                return;
            }
            string output = "";

            List <Entity> entities;
            var           strings  = new List <string>();
            string        concrete = "";

            using (var th = new TransactionHelper())
            {
                entities = th.ReadObjects(sset);
                concrete = Utilities.GetText(entities[0]);
                entities = entities.Skip(1).ToList();

                entities.Sort(Comparer <Entity> .Create(MyCompare));

                foreach (var ent in entities)
                {
                    string s = Utilities.GetText(ent);
                    if (String.IsNullOrEmpty(s))
                    {
                        continue;
                    }

                    strings.Add(s);
                }
            }
            for (int i = 1; i < strings.Count; i += 2)
            {
                var pair = DiameterPair(new Tuple <string, string>(strings[i - 1], strings[i]));
                dict[pair.Item1] = pair.Item2;
            }

            var match_number = new Regex(@"\d+\.\d+м");

            concrete      = match_number.Match(concrete.Replace(",", ".")).Value.Replace("м", "");
            dict["БЕТОН"] = concrete.Replace(".", ",");

            output = dict.Values.Aggregate((a, b) => a + '\t' + b);

            Clipboard.SetText(output);
        }
Esempio n. 2
0
        public static void ListAttributes()
        {
            var contents = new List <string>();
            var tags     = new List <string>();
            var acDoc    = App.DocumentManager.MdiActiveDocument;
            var acCurDb  = acDoc.Database;
            var acEd     = acDoc.Editor;

            var sset = Input.Objects("Выберите блоки, из которых нужно прочитать имена аттрибутов"); if (Input.StatusBad)

            {
                return;
            }

            using (var th = new TransactionHelper())
            {
                var blockrefs = th.ReadObjects(sset).OfType <BlockReference>();
                foreach (var br in blockrefs)
                {
                    foreach (ObjectId attRef_id in br.AttributeCollection)
                    {
                        var attRef = th.EditObject(attRef_id) as AttributeReference;
                        if (tags.Contains(attRef.Tag))
                        {
                            continue;
                        }
                        else
                        {
                            tags.Add(attRef.Tag);
                            contents.Add(attRef.TextString);
                        }
                    }
                }
            }

            string output = "";

            for (int i = 0; i < tags.Count; i++)
            {
                output += tags[i] + "\t" + contents[i] + "\n";
            }

            Console.WriteLine(output);

            Clipboard.SetText(output);
        }
Esempio n. 3
0
        public static void ShowFields()
        {
            var Selection = Input.Objects("Выделите объекты для просмотра полей"); if (Input.StatusBad)

            {
                return;
            }

            using (var th = new TransactionHelper())
            {
                var AcadObjects = th.ReadObjects(Selection);
                foreach (var AcadObject in AcadObjects)
                {
                    var AcadObjectType = AcadObject.GetType();
                    Messaging.Tweet("Объект типа " + AcadObjectType.Name);
                    BaseTypeInfo(AcadObjectType, AcadObject);
                }
            }
        }