|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
T0 d- ^) _# E7 R1 N1 g \7 o, R, qNX二次开发源码分享: 如何获取装配导航器上PMI的节点名称
$ K3 X3 V4 D8 i9 {2 j! P- r
/ E* f' v* z2 P" ` l tNX 目前没有想过方法,需要借助 KF 函数
/ X$ w7 j, z6 G+ R/ G1 a1 n" O4 M- x3 k. F. b( h; p* p
3 G( Q$ I$ V. A) W1 O/ A3 s
" \: U8 Y+ J( {- l
// There is no direct way to get the name that is shown for the PMI object
. e# Z' w0 ~: O P1 ]% L+ `5 \: M" ~ // in the Part Navigator. See ER 7961161.7 Y1 W, e9 B9 }
// This method uses a Check-Mate function then parses the output to format it8 s4 M' {2 V' K, [7 l b+ b: K# D
// so that it maTChes what is shown there in most cases.1 u5 B3 e$ o7 F3 F( a5 X
private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)
( s v* S9 h" ]3 A M; L$ o {- f/ j. Y- k- e X
string ruleName;
" V: @) u9 D! p, a* K( C5 R j theUFSession.Cfi.GetUniqueFilename(out ruleName);+ S n- r% U" x* ~5 |
workPart.RuleManager.CreateDynamicRule("root:", ruleName,
) K1 u& I5 i$ |7 k- a; j- p- s "Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");
* r6 \0 j/ L( M* W$ u' H8 {- H: f string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");( ]9 }& |; J$ {7 q
workPart.RuleManager.DeleteDynamicRule("root:", ruleName);9 w/ r, O& K) I; q$ p
5 g' q6 c9 m" P5 e) T
2 R* J5 T* X+ O% Q& H
string[] infos = theValue.Split(new Char[]{','});8 ~5 T. g0 h" U: @. p d
) s1 _$ a: l G2 A( v: Y2 |9 ^$ G& [# e
string theName = (infos[1].Trim().Trim(new Char[]{'"'}) +
; q1 H8 s3 G" f5 r "(" + infos[2].Trim() + ")").Replace("PMI ", "");7 F5 z) }4 |/ z& c
return theName;% \% ~1 M8 O9 Z. L' C* m2 j6 _& w
}
) w" ^ j D# C' |* b, f' ]5 m3 r3 s
. Q6 N) i. q" C; K: c |
|