|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
$ p! Q, P: H4 J0 h
NX二次开发源码分享: 如何获取装配导航器上PMI的节点名称0 x4 p5 }2 B& C2 s
: \( K p" L6 m, l; T7 G# hNX 目前没有想过方法,需要借助 KF 函数
* m" Q. y% Y. X; O2 U" D# a1 d, P" v) T$ F$ P6 F( u
9 C. j% A4 D% P
- u. g, w& O* U// There is no direct way to get the name that is shown for the PMI object& y( z$ u# z6 D A! z K
// in the Part Navigator. See ER 7961161.* N9 v2 ~7 _" ~0 u
// This method uses a Check-Mate function then parses the output to format it
0 ?5 Q; w$ P, ~ // so that it maTChes what is shown there in most cases., @5 V: J+ V$ W6 F
private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)
; Q3 g) N n* f6 e" c0 G! E# X {8 E7 _ Q! R1 q. s& M$ m) _
string ruleName;
3 x/ F8 g: R# D4 C" D! _ theUFSession.Cfi.GetUniqueFilename(out ruleName);8 T& j* v* c( b! ~. D
workPart.RuleManager.CreateDynamicRule("root:", ruleName,$ }0 k! V' [, J8 R4 Z
"Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");
) o/ y- O( G# ~1 C% h' u" C8 U string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");' R$ G: R( [' _8 ?
workPart.RuleManager.DeleteDynamicRule("root:", ruleName);, t1 t3 }" H* i$ L8 }' N+ G! V
$ |! E2 k, O0 @& t- v6 j' `5 y" R$ r( f5 V0 E% a( W# m
string[] infos = theValue.Split(new Char[]{','});
+ `+ v2 G& }/ \4 K6 a9 t* Q8 y
; ]5 x6 _* P$ M# B+ `9 h. s# t+ p: ~% k& b! v
string theName = (infos[1].Trim().Trim(new Char[]{'"'}) +* S0 a* o; f' w4 W
"(" + infos[2].Trim() + ")").Replace("PMI ", "");+ A1 T* |* h% O% p
return theName;
+ G( J, I' c4 K% w( O }9 W; L( j- X' s" ~! l
4 @9 o& @# l0 [! r
|
|