|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
4 z" U2 q3 I6 | D4 z4 m+ x% vNX二次开发源码分享: 如何获取装配导航器上PMI的节点名称
, o3 Z# h- p3 m0 B
( c* M7 Q3 J, ~1 [: d: \/ eNX 目前没有想过方法,需要借助 KF 函数
4 @$ a, x( W7 D1 T9 F2 d+ H
$ x# |& p# m- [* ^* H
3 K: D( q4 F4 ]) ~
; M+ a! [$ f; b7 N, x2 g// There is no direct way to get the name that is shown for the PMI object& w" R$ ]% @' y5 B
// in the Part Navigator. See ER 7961161.
' [4 y6 B: V9 b // This method uses a Check-Mate function then parses the output to format it
% W' D( R! d( F+ m // so that it maTChes what is shown there in most cases.+ c* Q% l# G( A1 u* j# N4 v
private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)& v2 I8 O8 u9 ]8 A+ h
{
9 o& B# @. s5 I# T6 ] string ruleName;
: N( h! ~6 e8 _ G theUFSession.Cfi.GetUniqueFilename(out ruleName);/ _& B) f4 G8 @
workPart.RuleManager.CreateDynamicRule("root:", ruleName,4 r" E; m/ u- u# l) n6 r) o
"Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");
6 X4 p, ?: d% J5 N) Y( a" x8 K string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");
; Q# d; i3 g6 D' j* M2 r workPart.RuleManager.DeleteDynamicRule("root:", ruleName);3 j# ]9 W$ @0 o
) h. v& r2 M8 l
& J) n) O8 k9 J, S$ ~# }& l string[] infos = theValue.Split(new Char[]{','});
0 i6 l8 }$ U* p7 Z4 m5 r/ c+ [4 k. H3 S" K+ g) R& q. o: y
/ E' V9 a$ P1 x" u% m& k/ b" E3 e5 D: P string theName = (infos[1].Trim().Trim(new Char[]{'"'}) +
: t6 R5 D- E& @+ W% o$ J "(" + infos[2].Trim() + ")").Replace("PMI ", "");( G* z1 [1 ^. I! Y3 r/ e
return theName;
! p4 g; k# a! q' L }
! d a8 x* _; I+ n
) R. P0 @1 g D! W* K4 t |
|