PLM之家PLMHome-国产软件践行者

[资料分享] 一种自定义颜色条的方法,直接可以用,可以作为CAE后处理

[复制链接]

2023-3-6 11:55:57 876 0

admin 发表于 2023-3-6 11:55:57 |阅读模式

admin 楼主

2023-3-6 11:55:57

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

x

; Z9 B$ Q) X- I9 {2 a1 }" F) |0 K9 ^$ s) Q$ j% R

7 o$ r" f9 R  E) t一种自定义颜色条的方法,直接可以用,可以作为CAE后处理) g" b" R( `% u0 v9 p, ?

- E  s* @4 Q6 F: C; O8 b: p QQ截图20230306115545.png
" `8 Z! F, R9 E; M( ]0 B, D6 E6 g2 W! {/ T5 f

  1. - ]  X" U; d8 H$ Y; z

  2. 7 O4 N2 g5 ?, D/ F% f; J( B

  3. 0 M9 P: b, G  c# l. v4 m1 |

  4.   r6 ?3 I% V$ b! Y
  5. void UI_ColorRangeUDB::UI_ShowColorMapBlocks()
    # W% G( I8 U9 M5 F1 k! S2 c* i% j5 L
  6. {
    1 ^7 O: {7 H& p$ Z4 v
  7.         int colorNum = integerColorNum->Value();3 f2 n& r2 M& u5 B
  8.         vector<BlockStyler::UIBlock*> hiddenGroup;
    % M- H+ ]4 L( P; I% x
  9.         hiddenGroup.clear();1 F2 K- A( N* Z) U# y* G% P4 _% b
  10.         vector<BlockStyler::UIBlock*> shownGroup;, m% P; ?( D  L6 |' ~2 V9 l
  11.         shownGroup.clear();7 S" @- U: D6 F3 n$ W4 u
  12.         string groupPreStr = "groupColorRange";
    ) Y( G1 Y) L+ _  C
  13.         string doubleUPreStr = "doubleU";2 u/ l& y6 w: e" E, \! n5 D
  14.         string doubleLPreStr = "doubleL";
    : j) _: r9 {/ l8 M, Q' ^! b( i
  15.         //get all the groups with the name str //groupColorRange6
    , F. }( s3 n' s$ q# C3 ^
  16.         vector<BlockStyler::UIBlock*> allBlocks = theUserDefinedUIBlock->TopBlock()->GetBlocks();2 H0 }5 S8 h6 E9 \+ M, z& G
  17.         //type: Group          name : groupColorRange
    * J8 y/ }: |3 M1 Y/ r1 S1 y) O8 N
  18.         //type : Group          name : groupColorRange12 A9 p+ J$ v4 `; [
  19.         //type : Group          name : groupColorRange10
    , w$ ^* j& k/ i& ]& V* J/ Z
  20.         //type : Group          name : groupColorRange11
    4 y/ @! N  _6 D' j8 b
  21.         //type : Group          name : groupColorRange12
    # w$ |2 g6 w" [
  22.         //type : Group          name : groupColorRange2
    $ d4 O! S7 `1 R$ u' K8 a
  23.         //type : Group          name : groupColorRange3
    / u7 G# S/ C: p
  24.         //type : Group          name : groupColorRange4) I. D8 T9 R! j  k/ D% u* s
  25.         //type : Group          name : groupColorRange5' n/ _3 \1 h* u  n2 |
  26.         //type : Group          name : groupColorRange60 I, ]2 {3 u1 F
  27.         //type : Group          name : groupColorRange7
    : O! q  P: S7 G. c9 p5 u$ t) J, k
  28.         //type : Group          name : groupColorRange8
    ; A( V+ i( ]  K2 D
  29.         //type : Group          name : groupColorRange93 v1 t0 K- a( \2 w, \! {8 _

  30.   c1 i; j9 ]/ _- \, V4 k8 P1 W
  31.         for (int i = 0; i < allBlocks.size(); i++)6 F% Z* ^+ j5 G; G
  32.         {# m3 V) {$ e; _' X. y
  33.                 BlockStyler::UIBlock* tempBlock = allBlocks[i];
    ' P( ~' o# p$ R& E2 ~  c4 m+ G# u5 i
  34.                 if (isSameNXString("Group", tempBlock->Type().GetText()))# |1 @  e( h; D2 d; ]  U- H
  35.                 {
    * H. ]6 |* b. z3 U/ M- t. l
  36.                         string blockNameStr = tempBlock->Name().GetLocaleText();
    7 l2 c; {* J4 B/ g
  37.                         size_t findIndex = blockNameStr.find("groupColorRange");; w7 M6 |" B9 N% X# a2 r% `
  38.                         if (findIndex != string::npos)" |: R7 Q0 c" n0 x. n5 e' t% _; }
  39.                         {
    ) E) N+ [' _! D" ?
  40.                                 string subStr = blockNameStr.substr(groupPreStr.length());
    4 [9 j" z1 n1 s: W
  41.                                 // Echo("%s", subStr.c_str());
    . W7 H: Z& }! d! L
  42.          //Echo("%d -- %d", atoi(subStr.c_str()), colorNum);* j# h( N5 E3 \1 V9 H" J" u
  43.                                 if (colorNum >= atoi(subStr.c_str()))
    # J+ I' G- ?$ N4 U! L/ u
  44.                                 {
    3 ~: X4 A, w7 R& N
  45.                                         shownGroup.push_back(tempBlock);+ ^7 O+ X0 @! g5 s- w/ T
  46.                                 }  ~1 }7 ~: g: w, u
  47.                                 else" f4 m# E# W7 s+ K
  48.                                 {
    8 M( V! Q6 d5 \+ ^* r+ x! L# \4 d
  49.                                         hiddenGroup.push_back(tempBlock);9 G# k2 s. S/ ~! @
  50.                                 }
    % L5 z  [) `- i8 a; ~. D* \
  51.                         }
    6 D: e% @# S& r1 B( Z
  52.                 }- r& h% b; j7 U" y; d0 Y% S0 B. A
  53.         }
    - c2 S* z; {- X  P
  54.         if (!shownGroup.empty()); W; B% m+ y" V; \/ E7 ]
  55.         {& R; Y8 f6 e# W$ E
  56.                 for (auto a : shownGroup)
    . r5 C# O$ B; T  O( K) J% i& s8 w/ v
  57.                 {9 `- ^7 i) I* V& H( M2 l+ |* Y
  58.                         a->SetShow(true);
    4 }; f- p7 _- F3 ^' O

  59. % ~! O$ V/ U7 I, E( }% x$ I
  60.                 }" Q4 p$ I$ ^0 K! n
  61.         }0 Q5 p9 o/ Y, g, @; e, N
  62.         if (!hiddenGroup.empty())6 m1 P$ D- m. j. h
  63.         {: `, v3 e3 }# A* t; b/ c
  64.                 for (auto a : hiddenGroup)' P/ ~8 E0 ?( k  R0 h
  65.                 {
    5 E9 b' @! n4 [2 }# m
  66.                         a->SetShow(false);
    7 D2 e1 @3 J8 j  b
  67.                 }
    ' T8 B) \; M1 S0 t; ?- L
  68.         }3 c* h, o) J% d5 A; q
  69. : J6 n' A' R) Y5 @
  70.     //实时更新显示9 S: m" T$ ]2 H0 n) u

  71. : y9 P- U+ m2 N% \) v* `
  72.     UI_UpdateDoubleRangeValue();
    6 x2 U: A+ H# p8 I. N: y# q
  73. }
复制代码

5 Y3 [0 Q7 ^2 O$ [0 |' P% ^: U, j2 e1 X4 T1 u* l; y9 k
7 j$ A) ^$ ^. W: @/ O2 k) `
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了