コード例 #1
0
        private static void Document_ImpliedSelectionChanged(object sender, EventArgs e)
        {
            var psr    = AcadUtils.Editor.SelectImplied();
            var detach = true;

            if (psr.Value != null && psr.Value.Count == 1)
            {
                using (AcadUtils.Document.LockDocument())
                {
                    using (var tr = new OpenCloseTransaction())
                    {
                        foreach (SelectedObject selectedObject in psr.Value)
                        {
                            if (selectedObject.ObjectId == ObjectId.Null)
                            {
                                continue;
                            }

                            var obj = tr.GetObject(selectedObject.ObjectId, OpenMode.ForRead);
                            if (obj is BlockReference blockReference &&
                                ExtendedDataUtils.IsApplicable(blockReference))
                            {
                                AttachCreateAnalogContextMenu();
                                detach = false;
                            }
                        }

                        tr.Commit();
                    }
                }
            }

            if (detach)
            {
                DetachCreateAnalogContextMenu();
            }
        }
コード例 #2
0
 /// <inheritdoc />
 public override bool IsApplicable(RXObject overruledSubject)
 {
     return(ExtendedDataUtils.IsApplicable(overruledSubject, Axis.GetDescriptor().Name, true));
 }
コード例 #3
0
 /// <inheritdoc />
 public override bool IsApplicable(RXObject overruledSubject)
 {
     return(ExtendedDataUtils.IsApplicable(overruledSubject, SectionDescriptor.Instance.Name));
 }
コード例 #4
0
 /// <inheritdoc/>
 public override bool IsApplicable(RXObject overruledSubject)
 {
     return(ExtendedDataUtils.IsApplicable(overruledSubject, GroundLineDescriptor.Instance.Name, true));
 }
コード例 #5
0
 /// <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));
 }
コード例 #6
0
        /// <summary>
        /// Добавление пользовательских элементов в палитру в зависимости от выбранных объектов
        /// </summary>
        private void ShowPropertiesControlsBySelection()
        {
            BtCollapseAll.Visibility = Visibility.Hidden;

            // Удаляем контролы свойств
            if (StackPanelProperties.Children.Count > 0)
            {
                StackPanelProperties.Children.Clear();
            }

            var psr = AcadUtils.Editor.SelectImplied();

            if (psr.Value == null || psr.Value.Count == 0)
            {
                // Очищаем панель описания
                ShowDescription(string.Empty);

                // hide message
                StckMaxObjectsSelectedMessage.Visibility = Visibility.Collapsed;
            }
            else
            {
                var maxSelectedObjects = MainSettings.Instance.MaxSelectedObjects;
                if (maxSelectedObjects == 0 || maxSelectedObjects >= psr.Value.Count)
                {
                    StckMaxObjectsSelectedMessage.Visibility = Visibility.Collapsed;

                    var objectIds = new List <ObjectId>();
                    using (AcadUtils.Document.LockDocument())
                    {
                        using (var tr = new OpenCloseTransaction())
                        {
                            foreach (SelectedObject selectedObject in psr.Value)
                            {
                                if (selectedObject.ObjectId == ObjectId.Null)
                                {
                                    continue;
                                }

                                var obj = tr.GetObject(selectedObject.ObjectId, OpenMode.ForRead);
                                if (obj is BlockReference blockReference &&
                                    ExtendedDataUtils.IsApplicable(blockReference))
                                {
                                    objectIds.Add(selectedObject.ObjectId);
                                }
                            }

                            tr.Commit();
                        }
                    }

                    if (objectIds.Any())
                    {
                        BtCollapseAll.Visibility = Visibility.Visible;
                        var summaryPropertyCollection = new SummaryPropertyCollection(objectIds);
                        summaryPropertyCollection.OnLockedLayerEventHandler +=
                            (sender, args) => ShowPropertiesControlsBySelection();
                        SetData(summaryPropertyCollection);
                    }
                }
                else
                {
                    StckMaxObjectsSelectedMessage.Visibility = Visibility.Visible;
                }
            }
        }
コード例 #7
0
 /// <inheritdoc />
 public override bool IsApplicable(RXObject overruledSubject)
 {
     return(ExtendedDataUtils.IsApplicable(overruledSubject, WaterProofing.GetDescriptor().Name));
 }