|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
8 X$ k/ A. V! h9 tNX二次开发源码分享: 如何获取装配导航器上PMI的节点名称
+ v" c* J/ c/ [, M2 b
4 o! l/ X' U+ H5 p ~$ N+ e% INX 目前没有想过方法,需要借助 KF 函数
) M# V+ f& J2 B
- P6 C( x7 ~! X, ~: D* W) z/ z/ ]4 T0 b0 \ x
7 S( O+ [( U0 }$ v L7 p
// There is no direct way to get the name that is shown for the PMI object
0 V% q% G% H4 a // in the Part Navigator. See ER 7961161.7 H. n( C4 X Y7 N
// This method uses a Check-Mate function then parses the output to format it/ N, ?& B( h5 p4 S: Z5 R! `
// so that it maTChes what is shown there in most cases.
' _/ p4 s0 ]9 n1 K& L7 d) D( p2 H, H! N private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)
3 L1 A" j+ t' d; u0 R {
) ^. F" D2 l' v* O5 c q string ruleName;3 ]1 c: d; {0 `* R) I1 o
theUFSession.Cfi.GetUniqueFilename(out ruleName);
! e. R4 q8 a& s: E workPart.RuleManager.CreateDynamicRule("root:", ruleName,1 l4 a; v) I% Q, j$ Q
"Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");
+ |. L: }* @7 p- |( S string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");
! N$ j2 t. g! S workPart.RuleManager.DeleteDynamicRule("root:", ruleName);' }& C5 a3 _/ Z
7 [+ E( w# ^$ y) y2 `4 e$ R5 z# h1 j0 v" [
string[] infos = theValue.Split(new Char[]{','});
/ f. _5 H4 P# `6 K5 u6 G' x0 T f8 o/ I! t2 G7 U$ U( Z: N, I
& w4 I4 F3 i# B0 E! ^. d
string theName = (infos[1].Trim().Trim(new Char[]{'"'}) +$ h/ a" Q! ^2 {" C
"(" + infos[2].Trim() + ")").Replace("PMI ", "");
" T2 f, ]( f& G3 H, a7 D return theName;
3 P6 G- g1 y; A v& E( y* v$ V6 ^8 | }/ \3 d8 K9 i- Z$ L# _
9 K/ g9 V- T; ?' a |
|