|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
2 V% U( N# `3 ]2 b' `% I- u( f" Y
NX二次开发源码分享: 如何获取装配导航器上PMI的节点名称- Y; u5 {5 Y: O7 o+ F$ U+ R
- O, U8 g. Z) j" o
NX 目前没有想过方法,需要借助 KF 函数9 u0 ]3 O8 L+ C7 `* v, {( O
1 G* r( Q' G6 I7 |! U2 e* @/ N. m! k3 F5 k+ k
0 V; T ~. b$ F+ R, |// There is no direct way to get the name that is shown for the PMI object
( y7 M. k1 w* d // in the Part Navigator. See ER 7961161.# c' D, G; |+ K3 V( o" A
// This method uses a Check-Mate function then parses the output to format it0 a3 P0 ^' ~- O/ s/ l; [- f
// so that it maTChes what is shown there in most cases.
& g2 b# J6 e* G6 e1 ] private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)! l& Q# L8 n9 o" E S0 [
{! X% P/ t5 _% p6 \, b( {2 E
string ruleName;
) L' f; X; V7 H1 V theUFSession.Cfi.GetUniqueFilename(out ruleName);
1 |3 g5 ]- a- b2 ?2 f( H workPart.RuleManager.CreateDynamicRule("root:", ruleName,
; F4 @+ A0 t3 }: M "Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");# x& s2 ]4 ]5 Q) A% F
string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");, D& m/ L, I0 J6 b% {
workPart.RuleManager.DeleteDynamicRule("root:", ruleName);
& s( C1 ~, K$ m5 j- f/ @* C. f( c
$ r) {6 M, ~# u" [" A* `
( i6 j) M: g' e7 _9 k, G string[] infos = theValue.Split(new Char[]{','});2 Z3 t: a; B) g8 z/ ]
& ^$ M/ H* k' Y/ g
+ x2 x$ O- C8 r7 ?0 l! l string theName = (infos[1].Trim().Trim(new Char[]{'"'}) +) B( |1 E/ T2 E
"(" + infos[2].Trim() + ")").Replace("PMI ", "");
* h! f3 @9 \$ A0 x& A+ t return theName;
8 R# g( M: a3 j$ k }: f1 P1 n$ n7 Y
1 ]9 b; q4 G I
|
|