From e9d7a5ef4c17e4804fb988dd193ff7d1fa36d52b Mon Sep 17 00:00:00 2001 From: chr <chr@chr.com> Date: 星期一, 12 八月 2024 09:08:43 +0800 Subject: [PATCH] 优化; --- PdmSwPlugin.Common/Util/CustomPropertyUtil.cs | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/PdmSwPlugin.Common/Util/CustomPropertyUtil.cs b/PdmSwPlugin.Common/Util/CustomPropertyUtil.cs index 790597c..f40a1f3 100644 --- a/PdmSwPlugin.Common/Util/CustomPropertyUtil.cs +++ b/PdmSwPlugin.Common/Util/CustomPropertyUtil.cs @@ -159,6 +159,21 @@ return true; } + public static string GetMass(ModelDoc2 doc) + { + var cpm = doc?.Extension; + if (cpm == null) + { + return null; + } + double[] values = cpm.GetMassProperties2(0, out _, false); + if (values == null) + { + return null; + } + return values[5].ToString(); + } + public static bool SetCustomProperties(ModelDoc2 doc, string key, string value) { CustomPropertyManager cpm = doc.Extension.CustomPropertyManager[""]; -- Gitblit v1.9.1