Beispiel #1
0
        /// <summary>
        /// Панель "Выноски"
        /// </summary>
        private static void AddLeadersPanel(RibbonTab ribbonTab)
        {
            var ribSourcePanel = new RibbonPanelSource {
                Title = Language.GetItem("tab15")
            };
            var ribPanel = new RibbonPanel {
                Source = ribSourcePanel
            };

            ribbonTab.Panels.Add(ribPanel);
            var ribRowPanel = new RibbonRowPanel();

            // mpNodalLeader
            var ribbonButton = GetBigButton(NodalLeader.GetDescriptor());

            if (ribbonButton != null)
            {
                ribRowPanel.Items.Add(ribbonButton);
            }

            // mpSecantNodalLeader
            ribbonButton = GetSmallButton(SecantNodalLeader.GetDescriptor());
            if (ribbonButton != null)
            {
                ribRowPanel.Items.Add(ribbonButton);
            }

            if (ribRowPanel.Items.Any())
            {
                ribSourcePanel.Items.Add(ribRowPanel);
            }
        }
Beispiel #2
0
        /// <inheritdoc />
        public override void OnGripStatusChanged(ObjectId entityId, Status newStatus)
        {
            try
            {
                // При начале перемещения запоминаем первоначальное положение ручки
                // Запоминаем начальные значения
                if (newStatus == Status.GripStart)
                {
                    _gripTmp = GripPoint;
                }

                // При удачном перемещении ручки записываем новые значения в расширенные данные
                // По этим данным я потом получаю экземпляр класса LevelMark
                if (newStatus == Status.GripEnd)
                {
                    using (var tr = AcadUtils.Database.TransactionManager.StartOpenCloseTransaction())
                    {
                        var blkRef = tr.GetObject(SecantNodalLeader.BlockId, OpenMode.ForWrite, true, true);
                        using (var resBuf = SecantNodalLeader.GetDataForXData())
                        {
                            blkRef.XData = resBuf;
                        }

                        tr.Commit();
                    }

                    SecantNodalLeader.Dispose();
                }

                // При отмене перемещения возвращаем временные значения
                if (newStatus == Status.GripAbort)
                {
                    if (_gripTmp != null)
                    {
                        switch (GripName)
                        {
                        case GripName.InsertionPoint:
                            SecantNodalLeader.InsertionPoint = _gripTmp;
                            break;

                        case GripName.LeaderPoint:
                            SecantNodalLeader.EndPoint = _gripTmp;
                            break;
                        }
                    }
                }

                base.OnGripStatusChanged(entityId, newStatus);
            }
            catch (Exception exception)
            {
                if (exception.ErrorStatus != ErrorStatus.NotAllowedForThisProxy)
                {
                    ExceptionBox.Show(exception);
                }
            }
        }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SecantNodalLeaderGrip"/> class.
 /// </summary>
 /// <param name="secantNodalLeader">Экземпляр <see cref="mpSecantNodalLeader.SecantNodalLeader"/></param>
 /// <param name="gripType">Вид ручки</param>
 /// <param name="gripName">Имя ручки</param>
 /// <param name="gripPoint">Точка ручки</param>
 public SecantNodalLeaderGrip(
     SecantNodalLeader secantNodalLeader,
     GripType gripType,
     GripName gripName,
     Point3d gripPoint)
 {
     SecantNodalLeader = secantNodalLeader;
     GripName          = gripName;
     GripType          = gripType;
     GripPoint         = gripPoint;
 }
        /// <summary>
        /// Singleton instance
        /// </summary>
        public static SecantNodalLeaderObjectOverrule Instance()
        {
            if (_instance != null)
            {
                return(_instance);
            }

            _instance = new SecantNodalLeaderObjectOverrule();

            // Фильтр "отлова" примитива по расширенным данным. Работает лучше, чем проверка вручную!
            _instance.SetXDataFilter(SecantNodalLeader.GetDescriptor().Name);
            return(_instance);
        }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SecantNodalLevelShelfPositionGrip"/> class.
 /// </summary>
 /// <param name="secantNodalLeader">Экземпляр <see cref="mpNodalLeader.NodalLeader"/></param>
 public SecantNodalLevelShelfPositionGrip(SecantNodalLeader secantNodalLeader)
 {
     SecantNodalLeader = secantNodalLeader;
 }
 /// <summary>
 /// Проверка валидности примитива. Проверка происходит по наличию XData с определенным AppName
 /// </summary>
 /// <param name="overruledSubject">Instance of <see cref="RXObject"/></param>
 public override bool IsApplicable(RXObject overruledSubject)
 {
     return(ExtendedDataUtils.IsApplicable(overruledSubject, SecantNodalLeader.GetDescriptor().Name, true));
 }