|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- N+ g" }# ~( ZNX二次开发源码分享: 如何获取装配导航器上PMI的节点名称
$ r( ^! W3 j% z# F8 `
9 i4 A: F, Y- O- y3 l1 [NX 目前没有想过方法,需要借助 KF 函数5 ~) {+ W7 ^. u i Q j- l
. s' N4 ^4 l% h3 `) |2 A
+ K! e6 l- C2 j5 h8 G+ g
, l! N" G+ l: Q) b# ?: \// There is no direct way to get the name that is shown for the PMI object
. u1 e6 O9 t) m# @8 e' M. X# W. V& A // in the Part Navigator. See ER 7961161.- q& n5 O( M! g* `, ]3 l3 Z
// This method uses a Check-Mate function then parses the output to format it, l0 W' V& y! h
// so that it maTChes what is shown there in most cases.. r+ L# V' ]/ y6 ^3 ]
private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)" l2 \: [+ k9 ~! \* @# j4 j6 e
{- t) _% @" ^6 J6 E, T( N
string ruleName;; A! F- X% R6 T* C7 y% ]4 e
theUFSession.Cfi.GetUniqueFilename(out ruleName);
& @* C6 w1 W9 l1 I workPart.RuleManager.CreateDynamicRule("root:", ruleName,& K: w" Y8 K9 n$ B
"Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");
% Z- R) y. Y3 {9 [4 _8 A string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");
, S$ q+ d7 k+ }2 S( }- K workPart.RuleManager.DeleteDynamicRule("root:", ruleName);
: Y* o) q; l! U
. m# }+ b \5 T* f; B, h( K7 X; K1 _3 h/ o7 R7 N3 R' ]0 q
string[] infos = theValue.Split(new Char[]{','});! \; r2 V" Y2 }( J* P! `; G5 ^
g# ? }& |5 |( ~1 J
; z1 {0 [; x! r9 A! j* ? string theName = (infos[1].Trim().Trim(new Char[]{'"'}) +
' B; X$ R. ]/ b. E0 g3 T e( l: T "(" + infos[2].Trim() + ")").Replace("PMI ", "");8 ?) v3 f0 ^/ a: v
return theName;' X6 l. j9 U4 ?5 K$ _) l% j
}
, v/ S, J1 ^' a+ F9 s5 J9 b( C2 s
|
|