|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
1 \3 K; r5 l u; SNX二次开发源码分享: 如何获取装配导航器上PMI的节点名称2 y: q8 L q( V0 _$ ^
% i$ ]+ }' a$ |# i7 ]0 H' M" a
NX 目前没有想过方法,需要借助 KF 函数
4 R! p% g* a3 I. @2 E( I8 o2 ^7 R" J3 @' h9 z# ]; X2 v
- p! l2 Z' n. F) w7 ]0 o5 W
6 L" W4 c" U7 `7 m& L' `// There is no direct way to get the name that is shown for the PMI object
5 e& E! v V& r+ w // in the Part Navigator. See ER 7961161.
) B/ _5 @1 }/ ~3 f // This method uses a Check-Mate function then parses the output to format it
* f6 E' j* u' M* f // so that it maTChes what is shown there in most cases.) Q) N- ?# P7 M, \4 Z2 U, S5 S
private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)
8 t. q; F' H$ c% r4 g9 h {
. m; }' M$ n0 y# |1 c. k4 L string ruleName;
* `7 ]' k4 s" c4 a theUFSession.Cfi.GetUniqueFilename(out ruleName);
^$ o' F" |+ s+ G: N0 @: V- p workPart.RuleManager.CreateDynamicRule("root:", ruleName,
2 f7 T" A7 ^ C9 k o& _) j1 j$ c1 g. y% F "Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");
+ z3 ~8 n% c8 d9 h% y7 R string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");
" y2 V1 v- u1 G! i* A workPart.RuleManager.DeleteDynamicRule("root:", ruleName);; C V* x5 F0 J! f j& a
+ y1 y5 D/ F; S& {- v/ G# x
# E, ]% t, d% D+ K string[] infos = theValue.Split(new Char[]{','});" V6 z8 i* {& \" s0 J
- `& S! M \3 y9 }1 w7 |8 h
3 S( |" z' m5 \3 q
string theName = (infos[1].Trim().Trim(new Char[]{'"'}) +
! Q, i# U, ~/ X0 P "(" + infos[2].Trim() + ")").Replace("PMI ", "");* @6 I4 `+ W# A" s. K$ @: e
return theName;* G; s! |8 R0 a8 _1 v
}. V% B& v, T9 p f( I/ Q
* V# s# \$ ?+ @+ H2 K$ m2 Y
|
|