|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
# y/ |! `- H8 g- s! f; v% ONX二次开发源码分享: 如何获取装配导航器上PMI的节点名称
: Q2 y9 i; y) i4 M$ v7 A% @* ?7 w
NX 目前没有想过方法,需要借助 KF 函数
5 r, t7 G% m7 {3 s7 E
% K' h6 i1 y1 m2 r$ v5 G# s' N6 T
8 h) E; p4 ^0 O! ]// There is no direct way to get the name that is shown for the PMI object/ g9 S) F8 W% v4 t4 @
// in the Part Navigator. See ER 7961161.) A2 h0 H5 u# z, Q
// This method uses a Check-Mate function then parses the output to format it
) `: d5 F4 \2 c/ d3 U* z* k // so that it maTChes what is shown there in most cases.
4 ?; @6 W7 P1 p3 \ private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)& b7 u- i( W9 N" D% T
{4 u9 T+ u" \1 I; u
string ruleName;, ~% [+ S9 t! H1 }* r
theUFSession.Cfi.GetUniqueFilename(out ruleName);- F3 @( \. ~8 e8 p9 Z+ I
workPart.RuleManager.CreateDynamicRule("root:", ruleName,
7 D9 l$ P c( q/ F. I$ ^ "Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");$ u5 E$ u& y' t, J6 i2 g
string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");
/ }; n- N$ x) Q/ u# j6 `3 P workPart.RuleManager.DeleteDynamicRule("root:", ruleName);+ { f# g, d. i, [, p6 a
2 {0 y) x# I& g. c) O; `& }
% D, u7 o8 L( l9 J/ |- K$ L
string[] infos = theValue.Split(new Char[]{','});
, m e) O l" M
9 a0 [3 C0 M9 q* S+ b, l' r1 g/ A7 g6 I) l; T" R1 I) E4 A
string theName = (infos[1].Trim().Trim(new Char[]{'"'}) +# F- o3 P" f' t( Q0 m
"(" + infos[2].Trim() + ")").Replace("PMI ", "");
- w& j: X i1 w return theName;
; p% F6 A3 n; t# b' ?( m3 V }
# S; Y- g1 ?* G! X1 m: q+ S d) f' l; \
|
|