|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/ F+ a) s; N5 `' UNX二次开发源码分享: 如何获取装配导航器上PMI的节点名称/ ?) Z: q. P* {0 e: {7 A
7 u% a+ }7 E( _' D: `NX 目前没有想过方法,需要借助 KF 函数( J5 T3 Q3 Y% B9 F7 n
6 L1 p3 @5 T: Z/ H
! {" z/ j1 ?3 `1 p' t$ J# t
+ V7 ^: l; T$ Q, A% {8 _8 k, \// There is no direct way to get the name that is shown for the PMI object& b( J) k! E9 [/ d. m" ^4 F
// in the Part Navigator. See ER 7961161.
$ o9 \. t% K! Q" O // This method uses a Check-Mate function then parses the output to format it
4 Y# w6 v7 h K* L/ h8 Q // so that it maTChes what is shown there in most cases.
3 _ v9 ~# K" O3 ] private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)
7 A; O% d! W* ~2 ?5 I9 u, h {' V' \9 o4 i# D9 V9 z Y: X( I5 L/ @
string ruleName;+ l5 m. f1 d; o# i3 V8 I
theUFSession.Cfi.GetUniqueFilename(out ruleName);3 z7 A6 y- h3 E. B$ D6 Q
workPart.RuleManager.CreateDynamicRule("root:", ruleName,* J) i8 t8 d0 E8 e, ~! ]
"Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");
& v" J% M! X' c0 w7 v" \4 O O string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");% d$ I9 j: U! T( v) |; h6 w1 m
workPart.RuleManager.DeleteDynamicRule("root:", ruleName);
6 e, B( ], p% {# i, N- s5 C/ _- x, [6 a4 n2 u# {
, P: a9 U4 m% ^/ o& }; A. a
string[] infos = theValue.Split(new Char[]{','});
5 ]/ y8 Y4 P+ y3 I
2 W. @ r( ^, ^! _1 `% I" Y X
4 U5 G$ |# k$ R# [; P- `9 U string theName = (infos[1].Trim().Trim(new Char[]{'"'}) +
( @2 c. k% j0 M" _ "(" + infos[2].Trim() + ")").Replace("PMI ", "");
- x' Y3 [/ ~0 Y# F return theName;/ m! P7 J7 E! A3 |' ^
}
! f b6 y _ V$ e5 }7 F
6 K' U& a& F. F+ J9 _$ z" H |
|