|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
0 n; y4 w6 c& [( \2 d$ p5 eNX二次开发源码分享: 如何获取装配导航器上PMI的节点名称
9 o: t6 t" w: d# Q6 p) L+ N' @- L5 B2 K/ A5 D
NX 目前没有想过方法,需要借助 KF 函数. Z, p' `# ?5 r8 s4 @1 r$ A
( q' K4 h. t& L" v) m
5 |; ^* y! l7 l5 e4 X4 s/ s
& e H4 A* T9 v0 k* [6 D% C/ w" V// There is no direct way to get the name that is shown for the PMI object
0 V: T- ]8 {4 u$ `( N& E7 } // in the Part Navigator. See ER 7961161.
+ S5 x: R0 ?# v7 Z6 l // This method uses a Check-Mate function then parses the output to format it% M, Z/ }0 b! Z# J- q
// so that it maTChes what is shown there in most cases.9 a) S2 R0 G/ z
private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)
8 I& I7 O9 @/ Z4 X; l4 A/ Q A {2 z; B; J. j: O; ^2 ^5 B
string ruleName;
1 L0 k5 z& D+ E; f& e" L" b l theUFSession.Cfi.GetUniqueFilename(out ruleName);! k7 U( N5 F6 o! b
workPart.RuleManager.CreateDynamicRule("root:", ruleName,
% I$ r$ D' e" \ T* c9 c "Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");6 O4 E; T* ?: E: } \8 a! Q+ t7 h8 a2 `. `
string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");
' L/ Z2 z* i: i0 _8 {: `/ l! o workPart.RuleManager.DeleteDynamicRule("root:", ruleName);
, r/ r& I. O& \& I: A
3 }/ f( l- g9 M# D' N9 Z( m" `" Y: }
string[] infos = theValue.Split(new Char[]{','});
6 U3 D7 Z! b9 H4 X* w3 |
$ Q7 o/ H7 f$ D9 h, [. m: q W! d( R% a/ `, T% ~( |! g2 f/ k: Q
string theName = (infos[1].Trim().Trim(new Char[]{'"'}) +9 o$ C* o: |8 Z" G8 N6 L8 I" g
"(" + infos[2].Trim() + ")").Replace("PMI ", "");$ @& i2 l+ e) ^! \. k0 q/ L
return theName;
1 g1 t1 e, z: T: U' {( g }; n) ?8 r4 J/ c7 h4 {, |6 u
/ a' {% I* E3 ?$ i( a4 l/ A+ ?$ Q
|
|