|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
* Q6 S9 m/ h( \& \NX二次开发源码分享: 如何获取装配导航器上PMI的节点名称
: B# m! S& J) F% z, p1 r. M# m
3 G9 m/ [" ~7 w/ L R% {NX 目前没有想过方法,需要借助 KF 函数, m* G# Y% b! a, y
2 D3 B8 O, Q( `8 W5 W! F. U8 E( T$ ^0 U. n
& E( F0 T( y: y' i5 t// There is no direct way to get the name that is shown for the PMI object+ t7 g! L& I: @* p8 }$ K- ^7 G
// in the Part Navigator. See ER 7961161.
; @' X j* L7 J5 ^- w: E9 W // This method uses a Check-Mate function then parses the output to format it3 t3 T# `; f% e Q" s6 q
// so that it maTChes what is shown there in most cases.
: a: J$ K' g; `- ^* ]! r) c! o/ {0 q private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)
& n7 b/ ~* R) e! m. U4 ?7 e3 x {: @7 {: [+ e6 C! A8 B0 u
string ruleName;
* O7 e. ~+ C2 K" {: A$ E8 m! t1 e theUFSession.Cfi.GetUniqueFilename(out ruleName);
; W9 _* ]. R% h9 I workPart.RuleManager.CreateDynamicRule("root:", ruleName,' S% a4 o7 m1 S3 f& z
"Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");4 f% Q" U) R! Z( v6 t5 a) p
string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");$ h7 g% w# t/ t# {" @" s2 b
workPart.RuleManager.DeleteDynamicRule("root:", ruleName);
$ r' N& t8 [" a6 \9 c. T* @2 M
% L5 @) g" w2 e8 ?& h
, w" q* F/ j B3 ]# e7 M) T string[] infos = theValue.Split(new Char[]{','});
! ~9 z% C* \' ~) _ q- ? Y5 s8 r& N2 e8 G+ Z
& L# v6 {0 [4 g! A, c$ W string theName = (infos[1].Trim().Trim(new Char[]{'"'}) +; {2 Z+ x! I5 A& f' t
"(" + infos[2].Trim() + ")").Replace("PMI ", "");
/ {& Q5 M: D' \; D# d% a! M- X% S5 { return theName;
) k+ }$ s( P9 A/ l* H }
( M' ]7 W: [; t
y4 N- r, A8 Z6 o |
|