|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
0 z3 W# w8 a# a, @0 z/ YNX二次开发源码分享: 如何获取装配导航器上PMI的节点名称
* j; ?1 p% C0 F1 L" R
! l9 |2 d( k- u9 N# S; aNX 目前没有想过方法,需要借助 KF 函数
+ D4 r/ U2 t4 {4 M
4 |; G' m9 d( S5 m' u+ _! _3 t! ]7 K# j6 K
/ u; Q' R- M7 e2 s// There is no direct way to get the name that is shown for the PMI object
- _5 k, @& l8 N! v4 y7 _ // in the Part Navigator. See ER 7961161.
4 F2 n& K$ D. I // This method uses a Check-Mate function then parses the output to format it# O9 P# ]4 v' q
// so that it maTChes what is shown there in most cases.
( [2 r$ b3 t; G; S/ c" D private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)
% \, t+ L4 j; j {8 Y; A" y8 s9 g' J; k
string ruleName;
9 o& N( ^) ~4 H theUFSession.Cfi.GetUniqueFilename(out ruleName);3 o& A4 k( T! @4 F+ _* C! U
workPart.RuleManager.CreateDynamicRule("root:", ruleName,* h' X2 \4 f; G4 P( N$ e
"Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");8 u3 a' u& E8 H6 P! o* A5 P
string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");1 \6 W7 W- }- }
workPart.RuleManager.DeleteDynamicRule("root:", ruleName);
6 E) B2 K* Y9 B8 i& {
/ s# M" o! |9 p6 n/ P+ H0 v2 i( N# x+ y
string[] infos = theValue.Split(new Char[]{','});
* M% W1 j9 B1 u9 c C, r c& g$ c1 P( j
$ ^( i3 c& ~ n; |8 p' D string theName = (infos[1].Trim().Trim(new Char[]{'"'}) +
& w$ c! ~( y+ c. D8 A9 |$ c "(" + infos[2].Trim() + ")").Replace("PMI ", "");
- N; ]# p R( P9 q% f return theName;+ R. F5 k* ~) V1 T7 F3 |
}
: n( E: d; Z4 \* F, o X' t
& C$ l q8 {5 r) d9 t# q |
|