|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
; v& S, l c6 j7 V0 @6 r8 A" ]NX二次开发源码分享: 如何获取装配导航器上PMI的节点名称: B- h5 w7 v0 F* v7 C. [3 e3 Z" O
2 [; m2 U, Z5 N5 D& {! k- j( JNX 目前没有想过方法,需要借助 KF 函数: ?+ t8 E f9 a/ _; U; Q& B
5 m5 F3 j& e0 E7 ] C' }" G; C$ X, r; Q" B
8 d* [4 I) S7 x1 m7 p( y9 ]- W// There is no direct way to get the name that is shown for the PMI object
) j0 L* z# g2 G; X2 U4 G, f6 r( @ // in the Part Navigator. See ER 7961161.
# g$ \/ Y; |# J# Y- B+ M5 o // This method uses a Check-Mate function then parses the output to format it
+ f9 p& r) C4 b' y% @) b // so that it maTChes what is shown there in most cases.
& ` S, | R/ ?2 n5 v0 z private static string get_pmi_part_navigator_name(NXOpen.Annotations.Pmi thePmi)! D; s3 r: t2 O4 L0 C( u
{
9 I* O; A2 R2 L1 L string ruleName;
& G9 `0 a) |2 [( n- C theUFSession.Cfi.GetUniqueFilename(out ruleName);4 g3 h5 \8 t& L5 x
workPart.RuleManager.CreateDynamicRule("root:", ruleName,' ^- N5 b0 h& n4 w# b, d0 n7 x
"Any", "mqc_askPMIObjectsInformation({" + thePmi.Tag + "});", "");
# U- B/ C1 D, r string theValue = workPart.RuleManager.EvaluateAnyAsString(ruleName + ":");
6 r4 l# u, X5 Z workPart.RuleManager.DeleteDynamicRule("root:", ruleName);8 k0 _6 X6 l7 B1 z, o
, P, e R3 _ ~8 S# G- S
; d6 ~3 s4 O- c/ @4 x) `# e
string[] infos = theValue.Split(new Char[]{','});' B1 t |: W0 D- C, t
+ k n; Q4 z) A$ ?9 ~5 u/ E4 u0 |$ @
string theName = (infos[1].Trim().Trim(new Char[]{'"'}) +
2 R6 _5 K! ]$ S- a' G "(" + infos[2].Trim() + ")").Replace("PMI ", "");( f- K! l3 ?! j3 r/ B
return theName;5 r, s! a" T. F4 s( P
}5 ?# |7 O; F8 l6 w! {6 `! c
$ V7 d% H! U/ u |
|