|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 w! D8 X z, `/ U4 ONX二次开发源码分享: 如何获取装配导航器上PMI的节点名称
. F$ q. g* _* i8 v p# v. j4 X, w/ N1 h5 d! M: M% n/ V& r9 I
NX 目前没有想过方法,需要借助 KF 函数3 _, j& M5 \( m0 l& |& H( W/ f3 E
) \0 S9 E l% j, \4 E; J
1 w7 D1 p" O9 s v+ a2 a; ~, C% R6 g* C5 e( ?% H
// There is no direct way to get the name that is shown for the PMI object/ d7 \# q0 K' v5 k
// in the Part Navigator. See ER 7961161.' L7 n& b3 Y [- Q
// This method uses a Check-Mate function then parses the output to format it
6 u- G, a5 ]: g: }0 r" U- f2 Y; p // so that it maTChes what is shown there in most cases.
% D4 p" g' ]4 {0 N$ I private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)2 {( q8 s8 [* r8 e" Y. j; p
{$ G! t1 C9 f" X
string ruleName;* g# L" U' W$ t j
theUFSession.Cfi.GetUniqueFilename(out ruleName);
: G+ I* i. U/ t* p$ a) F workPart.RuleManager.CreateDynamicRule("root:", ruleName,, ]* ~5 ~! l {5 ^: ]
"Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");. L {4 V* \) X! G
string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");
6 W; O) A* F* m* _; ?4 F- m workPart.RuleManager.DeleteDynamicRule("root:", ruleName); a1 D/ x% ~0 p& A
. ~' {0 D2 ^) V+ k# Z
4 {9 [! V( ]+ W. N
string[] infos = theValue.Split(new Char[]{','});
$ s3 V5 Z! r: |6 k% F% v, C4 V: a- g
+ R/ }% P/ I5 X. p3 s( \1 o3 c2 W1 A
string theName = (infos[1].Trim().Trim(new Char[]{'"'}) +
- H- ?' `: |5 W( M( y- |3 b "(" + infos[2].Trim() + ")").Replace("PMI ", "");5 E& d1 L( v! X$ {+ p. Q
return theName;
- A+ c' u$ P! r }
, D/ D) x7 Q( v6 S: C+ P1 c' A1 J5 G, C" ~) f/ E9 R6 c" w# v
|
|