From 4a977023f89c251df82aff7c134ae13b8a0433be Mon Sep 17 00:00:00 2001 From: "SINVO\\yangshunli" Date: Thu, 13 Feb 2025 12:00:20 +0800 Subject: [PATCH] =?UTF-8?q?105067=20=E4=BC=98=E5=8C=96=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E9=83=A8=E4=BB=B6=E9=AB=98=E4=BA=AE=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModel/ScannerViewModel.cs | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/ScannerViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/ScannerViewModel.cs index 6b6533a..713a849 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/ScannerViewModel.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/ScannerViewModel.cs @@ -1,18 +1,10 @@ -using CommunityToolkit.Mvvm.Messaging; -using EPLAN.Harness.API; -using EPLAN.Harness.AppCore.StudioCommon.TreeView; +using EPLAN.Harness.API; using EPLAN.Harness.Common; using EPLAN.Harness.Core.Controls; -using EPLAN.Harness.Core.Extensions; -using EPLAN.Harness.Core.LibEntities; -using EPLAN.Harness.Primitives.Treeviews; using EPLAN.Harness.ProjectCore; using EPLAN.Harness.ProjectCore.Occurrences; using EPLAN.Harness.ProjectCore.Occurrences.Designer; -using HandyControl.Tools.Extension; -using Sinvo.EplanHpD.Plugin.WPFUI.Common; using Sinvo.EplanHpD.Plugin.WPFUI.Models; -using Sinvo.EplanHpD.Plugin.WPFUI.Utils; using System; using System.Collections; using System.Collections.Generic; @@ -20,16 +12,15 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Linq; -using System.Security; -using System.Security.Permissions; -using System.Text; -using System.Threading.Tasks; using System.Windows.Threading; namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel { public class ScannerViewModel : INotifyPropertyChanged, INotifyDataErrorInfo { + + + private FlexDesigner _currentFlexDesigner; private bool _othersWireShow = true; private bool _continueScan = true; @@ -362,6 +353,24 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel } } + //public void sethightlight() + //{ + // ClearHighlights(); + // var selectedObjects = HarnessApp.Selection.GetSelectedObjects(); + // foreach (var obj in selectedObjects) + // { + // obj.SetHighlight(true); // 高亮选中部件 + // } + //} + + //private void ClearHighlights() + //{ + // var allObjects = HarnessApp.GetAllObjects(); + // foreach (var obj in allObjects) + // { + // obj.SetHighlight(false); // 清除高亮 + // } + //} private void ToSourceByName(string wireName) { var occWire = _currentFlexDesigner.GetOccurrenceByName(wireName, typeof(OccWire)); @@ -397,6 +406,8 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel { // 从设计器中获取线实例 var occWire = _currentFlexDesigner.GetOccurrenceByID(occId); + + var scanedWire = ScanCableModels.FirstOrDefault(); if (occWire != null) { // 设置线显示 @@ -404,6 +415,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel // 清空已选择项并加入当前线 _currentFlexDesigner.SelectSet.Clear(); _currentFlexDesigner.SelectSet.Add(occWire); + if (occId.Equals(scanedWire.S_PartID)|| occId.Equals(scanedWire.S_pinID) ) + _currentFlexDesigner.SelectSet.Add(scanedWire.S_partObj.Children.Where(it => it.Type == OCC_TYPE.wPART)); + else + _currentFlexDesigner.SelectSet.Add(scanedWire.E_partObj.Children.Where(it => it.Type == OCC_TYPE.wPART)); // 缩放设计器且触发选中事件 _currentFlexDesigner.FitToSelectSet();