From 43a0207d207390abdeeb3ab9155eebf03edd7b1a Mon Sep 17 00:00:00 2001 From: chr <chr@mailcom> Date: 星期一, 21 四月 2025 09:28:01 +0800 Subject: [PATCH] 优化; --- PdmSwPlugin.PropertySetting/Panel/JgjPartPanel.xaml.cs | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 deletions(-) diff --git a/PdmSwPlugin.PropertySetting/Panel/JgjPartPanel.xaml.cs b/PdmSwPlugin.PropertySetting/Panel/JgjPartPanel.xaml.cs index 654ae2d..9977c5d 100644 --- a/PdmSwPlugin.PropertySetting/Panel/JgjPartPanel.xaml.cs +++ b/PdmSwPlugin.PropertySetting/Panel/JgjPartPanel.xaml.cs @@ -1,6 +1,7 @@ 锘縰sing System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; +using System.IO; using System.Runtime.CompilerServices; using System.Windows.Controls; using PdmSwPlugin.Common.CustomHandler; @@ -8,6 +9,7 @@ using PdmSwPlugin.PropertySetting.Entity; using PdmSwPlugin.PropertySetting.Interface; using PdmSwPlugin.PropertySetting.Panel.Attr; +using PdmSwPlugin.PropertySetting.Util; using SolidWorks.Interop.sldworks; using SolidWorks.Interop.swconst; @@ -40,6 +42,11 @@ } } #endregion + + static JgjPartPanel() + { + PropHolder.Register(typeof(JgjPartPanel)); + } public void ccc<T>(ref T old, T @new, [CallerMemberName] string propertyName = null) { @@ -117,7 +124,7 @@ #region UI灞炴�� private string _materialCode; - [PropertySettingAttr(Name = NameConstant.materialCode)] + [PropertySettingAttr(Name = NameConstant.materialCode, defaultValue = "$PRP:\"SW-File Name\"")] public string materialCode { get => _materialCode; @@ -197,13 +204,20 @@ [PropertySettingAttr(Name = NameConstant.weight, NeedSave = false)] public string weight { - get => _weight; + get => CustomPropertyUtil.GetMassBySWDM(doc); set { - RaiseAndSetIfChanged(ref _weight, value); + ccc(ref _weight, value); } } + [PropertySettingAttr(Name = NameConstant.weight, NeedInit = false)] + public string weightEval + { + get => doc == null ? null : $"\"SW-璐ㄩ噺@{Path.GetFileName(doc.GetPathName())}\""; + set { } + } + private string _materialType = ""; [PropertySettingAttr(Name = NameConstant.materialType, defaultValue = "鏅�氫欢")] public string materialType -- Gitblit v1.9.1