|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& a5 a( F- T' M6 y) \ _" nNX二次开发源码分享: 如何获取装配导航器上PMI的节点名称
2 L/ }/ F+ F) S
9 u; X. A' j) t5 s' WNX 目前没有想过方法,需要借助 KF 函数6 K( _2 M) |* S0 _
) @, @# {$ Q6 t) S( H! v9 ^
5 E$ V1 X0 S3 L; p; p5 x" @0 S" i& r7 `
// There is no direct way to get the name that is shown for the PMI object; x( k+ f: K4 E3 j- V/ s
// in the Part Navigator. See ER 7961161.
4 h9 G; O' y8 p2 |" q x* X1 V // This method uses a Check-Mate function then parses the output to format it" z; g! t5 C6 ^+ Z: W
// so that it maTChes what is shown there in most cases.
4 @+ ?0 y- j9 d8 D' Y- I private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)
% ~6 C6 Z8 q4 s& m- F {
# }0 e& H0 k( x( ]; b string ruleName;
3 ~3 y- j! [5 M1 ^ theUFSession.Cfi.GetUniqueFilename(out ruleName);
% x, s- {* v" X! F* q) E& s workPart.RuleManager.CreateDynamicRule("root:", ruleName,
. Z. v* _! z8 |$ I& }2 F' d "Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");6 z7 P( x$ h, D$ s3 W
string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");/ [& h* |% d/ k' K
workPart.RuleManager.DeleteDynamicRule("root:", ruleName);
7 d* _; h7 W, Q8 y) u z
% E. C# M( x; T. [+ Z2 j; f; w. O G0 s( H# z h. }$ h% h- l `
string[] infos = theValue.Split(new Char[]{','});2 x; p8 J6 u6 i& H8 d; e
: u. u0 F" @4 b% a1 Y7 @2 M; a, P- @
string theName = (infos[1].Trim().Trim(new Char[]{'"'}) +( ~8 B# M' c0 ^$ a! D
"(" + infos[2].Trim() + ")").Replace("PMI ", ""); t3 Y- X) v/ R" }# r8 L6 i
return theName;7 j+ K4 h6 B4 Z0 z d, x" P/ X6 L9 y
}% Q) y$ h: G* r
" ?* h1 L' s* ^
|
|