|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
7 C) r3 I4 P2 E; D
NX二次开发源码分享: 如何获取装配导航器上PMI的节点名称1 p+ V5 l$ a( l; H. u
8 a) G F( q) g# m+ m3 vNX 目前没有想过方法,需要借助 KF 函数4 r4 _* v6 Q! T
@2 q) I y& b7 y$ y: D" y9 P% u6 I4 o
0 ~ D: @9 c2 R1 o' j! Z// There is no direct way to get the name that is shown for the PMI object$ t8 o8 R3 w9 W- r8 p0 s2 ^
// in the Part Navigator. See ER 7961161.
+ e- e* k2 l) z" d. g // This method uses a Check-Mate function then parses the output to format it
, n' I9 `5 E" M- W/ K7 J3 [ // so that it maTChes what is shown there in most cases.; O: x/ N- Y7 R2 o& [. W# H
private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)
7 f% q8 z$ d( k& B+ [ {
( u& l1 ]( ]( o- N( Q; O string ruleName;
4 J* b& ]) `9 l/ w/ K$ ?) n0 T theUFSession.Cfi.GetUniqueFilename(out ruleName);
9 D* F5 k$ v0 x3 K& ?( C workPart.RuleManager.CreateDynamicRule("root:", ruleName,- l+ z! ]. y0 R N5 {
"Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");
/ j" ^0 o8 V+ B) D string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");$ C( F7 L- o6 V& L X& M
workPart.RuleManager.DeleteDynamicRule("root:", ruleName); S% B H9 Z. \0 M! r4 i
6 l8 \' Q w6 U2 p7 ^* U0 Z# `
, j8 B$ g# Z( N1 I1 g7 Y string[] infos = theValue.Split(new Char[]{','});9 q. j# @8 s; C L8 S
" x! c: O& P- ~7 k! R6 e: A1 N9 ]+ ]
string theName = (infos[1].Trim().Trim(new Char[]{'"'}) +8 Z; x5 e$ N' {/ z0 f3 A. B
"(" + infos[2].Trim() + ")").Replace("PMI ", "");
7 X. z4 e2 w4 W% f7 ^ return theName;
! e. ~/ j- w6 t B0 B4 H }; } w7 o% P6 H- _9 g9 ]
5 e+ d2 v0 A" @% c) C
|
|