Пример #1
0
        public static void TestCommand()
        {
            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    ents = th.EditObjects(sset);
                string name = "AREA";
                foreach (var e in ents)
                {
                    var p = PropertyWorker.GetProperty(e, name);
                    if (p == null)
                    {
                        Messaging.Tweet("Skip");
                        continue;
                    }
                    Messaging.Tweet(p);
                    Console.WriteLine(p);
                }
            }
        }
Пример #2
0
        static void PropertyMLeader(string name, int pow)
        {
            var acDoc   = App.DocumentManager.MdiActiveDocument;
            var acCurDb = acDoc.Database;
            var acEd    = acDoc.Editor;
            var sset    = Input.Objects("Выберите объект"); if (Input.StatusBad)

            {
                return;
            }

            asc = UT.GetAnnoScale("CANNOSCALE");
            Vector3d offset = new Vector3d(2, 3.6, 0);
            var      areas  = new List <double>();

            using (var th = new TransactionHelper())
            {
                var ents = th.EditObjects(sset);

                foreach (var e in ents)
                {
                    var p = PropertyWorker.GetProperty(e, name);
                    if (p == null)
                    {
                        Messaging.Tweet("Skip");
                        continue;
                    }
                    areas.Add((double)p.pValue);
                }
            }
            foreach (var d in areas)
            {
                double measured_d = PKUserTools.Measurings.UnitsForm.measuringUnits.Value(PKUserTools.Measurings.UnitsForm.modelUnits, d, pow);

                using (var th = new TransactionHelper())
                {
                    var pt1 = Input.Point("Первая точка выноски"); if (Input.StatusBad)
                    {
                        return;
                    }
                    var pt2 = Input.Point("Вторая точка выноски"); if (Input.StatusBad)
                    {
                        return;
                    }

                    //TODO сделать общий класс создания мультивыносок
                    var   mleader = new MLeader();
                    MText mt;
                    PrepareMtext(0, out mt, acCurDb, pt2);

                    mleader.SetDatabaseDefaults();
                    mleader.ContentType = ContentType.MTextContent;

                    mt.TransformBy(Matrix3d.Displacement(offset.DivideBy(asc.Scale)));

                    mt.Contents = string.Format("{0:F3}", measured_d);

                    mleader.MText = mt;

                    int idx = mleader.AddLeaderLine(pt1);
                    mleader.SetFirstVertex(idx, pt1);

                    th.WriteObject(mleader);
                }
            }
        }