From 373e23ba0854ad7990aac5b0cb8b6583e1928584 Mon Sep 17 00:00:00 2001 From: lihanbo Date: Mon, 20 Jan 2025 17:07:41 +0800 Subject: [PATCH] =?UTF-8?q?105040=20Update=20=E5=B0=86=E7=BA=BF=E6=9D=90?= =?UTF-8?q?=E4=B8=A4=E5=A4=B4=E8=BF=9E=E6=8E=A5=E7=9A=84=E5=85=83=E5=99=A8?= =?UTF-8?q?=E4=BB=B6=E5=8A=A0=E5=85=A5=E9=80=89=E4=B8=AD=E9=A1=B9=E4=B8=AD?= =?UTF-8?q?=EF=BC=8C=E5=90=8C=E6=97=B6=E8=AE=BE=E7=BD=AE=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModel/ScannerViewModel.cs | 53 +++++++++++++++---- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/ScannerViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/ScannerViewModel.cs index 5eff835..2c3d235 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/ScannerViewModel.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/ScannerViewModel.cs @@ -262,15 +262,16 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel var oriOcc = SelfControler.FindInstance(occ.ID); var parent = oriOcc.Parents?.FirstOrDefault(); var grandparent = parent.Parents?.FirstOrDefault(); + scanCableModel.S_partObj = grandparent; scanCableModel.S_part = grandparent.Name; S_part = scanCableModel.S_part; - } if (occ.ID.Equals(scanCableModel.E_pinID)) { var oriOcc = SelfControler.FindInstance(occ.ID); var parent = oriOcc.Parents?.FirstOrDefault(); var grandparent = parent.Parents?.FirstOrDefault(); + scanCableModel.E_partObj = grandparent; scanCableModel.E_part = grandparent.Name; E_part = scanCableModel.E_part; } @@ -342,18 +343,14 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel // 扫描即装配 if (ScanAndAssembled) { - //cable.IsChecked = true; - ScanCableModel scanCableModel = new ScanCableModel(); - scanCableModel = cable; - + cable.IsChecked = true; _ScanCableModels.Remove(cable); - _ScanCableModels.Insert(0, scanCableModel); - _ScanCableModels.FirstOrDefault().IsChecked = true; - ToMotorSource(scanCableModel); + _ScanCableModels.Insert(0, cable); } + GetWireConnectPart(cable); ScanedIndex = 0;//Math.Max(cable.Index - 1, 0); - ToSourceById(cable.Id); + ToSourceById(cable); } else @@ -426,6 +423,44 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel */ } } + /// + /// 将设计器聚焦到对应的线 + /// + /// + private void ToSourceById(ScanCableModel scanedWire) + { + var occId = scanedWire.Id; + // 从设计器中获取线实例 + var occWire = _currentFlexDesigner.GetOccurrenceByID(occId); + if (occWire != null) + { + // 设置线显示 + occWire.SetVisibility(true, null); + // 清空已选择项并加入当前线 + _currentFlexDesigner.SelectSet.Clear(); + _currentFlexDesigner.SelectSet.Add(scanedWire.S_partObj.Children.Where(it => it.Type == OCC_TYPE.wPART)); + _currentFlexDesigner.SelectSet.Add(scanedWire.E_partObj.Children.Where(it => it.Type == OCC_TYPE.wPART)); + _currentFlexDesigner.SelectSet.Add(occWire); + // 缩放设计器且触发选中事件 + _currentFlexDesigner.FitToSelectSet(); + _currentFlexDesigner.SelectSet.OnSelectionChanged(); + + //_currentFlexDesigner.Camera.GraphicControl._HighlightNode() + /* + List> nodeByEntity = this._occTreeView.GetNodeByEntity(baseOccurrence); + if (nodeByEntity != null) + { + foreach (DatTreeNodeEx datTreeNodeEx in nodeByEntity) + { + if (!this._occTreeView.SelectedNodes.Contains(datTreeNodeEx)) + { + this._occTreeView.SelectedNodes.Add(datTreeNodeEx); + } + } + } + */ + } + }