|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
( u* j/ h# ~# m: x# Z% C, h4 C! h
NX二次开发源码分享: 如何获取装配导航器上PMI的节点名称
; d* @: @" A( k2 b, N
( h/ H8 V( e/ Y! N! N1 |NX 目前没有想过方法,需要借助 KF 函数- h X7 r) S4 Z' p
0 O/ [% ]7 V$ b
8 H' h1 T1 e. c: z9 h1 E
. Q2 P% ^( h/ X% d// There is no direct way to get the name that is shown for the PMI object
r6 O$ N4 }# ~$ @: X // in the Part Navigator. See ER 7961161.
" E; X4 `: a& k: N% V* L' n8 I3 Q // This method uses a Check-Mate function then parses the output to format it% |+ f+ @( V# f5 j3 e& f$ a
// so that it maTChes what is shown there in most cases./ u# E+ X( X6 q# ?+ z" f. b
private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)
6 ^% a8 Q" E2 I: x# r: N4 s& m0 a+ B {
) b- U2 }( L* E- T$ v string ruleName;3 Q+ @+ V1 m+ J0 U
theUFSession.Cfi.GetUniqueFilename(out ruleName);
! J$ v9 A9 ?9 ^3 `9 Q8 M3 ?3 T workPart.RuleManager.CreateDynamicRule("root:", ruleName,2 N: N9 L+ {0 C3 y
"Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");& J& K0 l3 Z7 p
string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");" [* b- R: F, `$ y$ \ J* I: R
workPart.RuleManager.DeleteDynamicRule("root:", ruleName);
. }* o) I2 v; U: \2 n& {: F- W, y% k* T/ X. K) B* T
' I/ s5 O6 H V- G! |; r
string[] infos = theValue.Split(new Char[]{','});: w! k7 u: s0 T% s
6 y' K, v0 _+ ~2 w4 Y& h0 r. R2 z5 s
string theName = (infos[1].Trim().Trim(new Char[]{'"'}) ++ {/ c6 F7 n9 K6 p
"(" + infos[2].Trim() + ")").Replace("PMI ", "");
: ?5 k8 x4 U T return theName;8 ~4 i6 A2 Q( m+ y5 r5 R1 a
}; e! ?1 H2 [9 W, l: H
7 w1 P6 L, W$ \/ K N l |
|