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(); } }
/// <inheritdoc /> public override bool IsApplicable(RXObject overruledSubject) { return(ExtendedDataUtils.IsApplicable(overruledSubject, Axis.GetDescriptor().Name, true)); }
/// <inheritdoc /> public override bool IsApplicable(RXObject overruledSubject) { return(ExtendedDataUtils.IsApplicable(overruledSubject, SectionDescriptor.Instance.Name)); }
/// <inheritdoc/> public override bool IsApplicable(RXObject overruledSubject) { return(ExtendedDataUtils.IsApplicable(overruledSubject, GroundLineDescriptor.Instance.Name, true)); }
/// <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)); }
/// <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; } } }
/// <inheritdoc /> public override bool IsApplicable(RXObject overruledSubject) { return(ExtendedDataUtils.IsApplicable(overruledSubject, WaterProofing.GetDescriptor().Name)); }