PLM之家PLMHome-工业软件践行者

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

[复制链接]

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

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

积分
82162
QQ
发表于 2023-3-6 11:55:57 | 显示全部楼层 |阅读模式

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

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

x

4 @* R9 ?: G  y; B4 M( L  `3 j3 B2 x7 U5 `
- \' U. Z+ z' F, q2 i$ X0 s0 M
一种自定义颜色条的方法,直接可以用,可以作为CAE后处理# F! v5 G# v+ @
: D3 d& d5 s5 k* f. B
QQ截图20230306115545.png " s$ r0 M- V- N+ ~6 {

5 t' f$ p: d8 D, X
  1. + @4 c/ _) @, x+ Q% e  x; {) \
  2. ) y: G* K" Z. y9 g

  3. 3 l7 h, k4 L- N
  4. 4 S' N( ~7 Q8 ^6 |/ r3 A, b
  5. void UI_ColorRangeUDB::UI_ShowColorMapBlocks()' k* Y, B- c2 X3 _. C
  6. {
    4 F- M6 S8 M  J7 E# `) y6 v
  7.         int colorNum = integerColorNum->Value();
    1 N' x: w6 d; ~2 g/ \  e+ ~
  8.         vector<BlockStyler::UIBlock*> hiddenGroup;
    . V0 O- Q3 ~( c
  9.         hiddenGroup.clear();6 S/ J( M3 r) u3 u
  10.         vector<BlockStyler::UIBlock*> shownGroup;/ m' n; R8 @* o! l: d2 o5 a
  11.         shownGroup.clear();
    4 |- ^: ?3 _& W% x5 B# ]7 t
  12.         string groupPreStr = "groupColorRange";
    + ?: b( w# v8 b0 m" L& i' t
  13.         string doubleUPreStr = "doubleU";
    ) [/ U0 P9 l7 g
  14.         string doubleLPreStr = "doubleL";
    # ~; m" K( V' a" A  K
  15.         //get all the groups with the name str //groupColorRange6
    8 w/ A/ j) |6 A1 @1 K& o
  16.         vector<BlockStyler::UIBlock*> allBlocks = theUserDefinedUIBlock->TopBlock()->GetBlocks();5 @4 J3 t6 B2 K: W+ }+ I
  17.         //type: Group          name : groupColorRange2 p7 c% g/ E: i" V
  18.         //type : Group          name : groupColorRange1
    : y% @7 N5 \  V# g9 f
  19.         //type : Group          name : groupColorRange10' t' X& r6 g/ f7 x6 k
  20.         //type : Group          name : groupColorRange11
      z: {# J# {- ?- }2 T% K: Y
  21.         //type : Group          name : groupColorRange12
    , ?# I: a& C6 l) k
  22.         //type : Group          name : groupColorRange2
    7 n4 a1 e# D+ `. m$ S
  23.         //type : Group          name : groupColorRange3, G8 x3 O7 |4 ]1 z. A* h% g; _
  24.         //type : Group          name : groupColorRange46 V: U6 u& {1 H9 _
  25.         //type : Group          name : groupColorRange5
    & _- d1 o. j2 {; V1 b# L9 r' x
  26.         //type : Group          name : groupColorRange6. y* {6 r! x' A/ O3 R, _
  27.         //type : Group          name : groupColorRange7
    & U7 v2 l8 K4 F+ N1 D% m
  28.         //type : Group          name : groupColorRange87 i# t' u1 Z9 L& t- k' Y- d
  29.         //type : Group          name : groupColorRange9
    5 v2 K& K! Y: z& n5 i) d
  30. 0 E; d7 c' ^% j, w
  31.         for (int i = 0; i < allBlocks.size(); i++)$ [! z* t& P4 O' i5 ]( |
  32.         {$ `6 Z$ n0 m  S) Q% a
  33.                 BlockStyler::UIBlock* tempBlock = allBlocks[i];$ @6 y2 W; f* T5 Q/ ^6 d% L( }
  34.                 if (isSameNXString("Group", tempBlock->Type().GetText()))
    " W7 |1 O/ _9 V% \/ ]0 g
  35.                 {
    5 T0 f" @, E$ x
  36.                         string blockNameStr = tempBlock->Name().GetLocaleText();3 s# @% i. o1 y6 @4 b) x
  37.                         size_t findIndex = blockNameStr.find("groupColorRange");) x4 `) n$ q! R! w- H
  38.                         if (findIndex != string::npos)4 C, M# ^1 A" Z
  39.                         {
    7 {$ o- B+ A6 C  W
  40.                                 string subStr = blockNameStr.substr(groupPreStr.length());* B0 x, d( |+ \! u# [# t7 Q
  41.                                 // Echo("%s", subStr.c_str());
    & p2 D2 [6 y5 v  p. e: |
  42.          //Echo("%d -- %d", atoi(subStr.c_str()), colorNum);
    2 E/ h2 H# L3 |' p! x
  43.                                 if (colorNum >= atoi(subStr.c_str()))
    9 d3 F% {3 n  v/ I: @
  44.                                 {! Q8 y5 I2 V: Y" Z+ H- \2 O
  45.                                         shownGroup.push_back(tempBlock);+ K: O6 b! l  ]  o3 l6 Y
  46.                                 }$ H0 ~3 e1 P8 ^$ X1 K- l
  47.                                 else
    ) H+ p% ?. U) v% w
  48.                                 {' ^0 Z( Q9 x6 n. [
  49.                                         hiddenGroup.push_back(tempBlock);
    # k4 ]' t) s% @) w
  50.                                 }
    8 m1 x' k" R  l; q. N( d2 l0 U
  51.                         }. V" Y; L9 y2 a& i  f5 T8 D8 q
  52.                 }
    + V& d* I' ~6 s$ f
  53.         }
      F+ g* L* n9 t
  54.         if (!shownGroup.empty())2 e1 c5 J' K% ?4 H! x8 ?
  55.         {
    # W" |7 P  c8 p: m4 c$ a2 T
  56.                 for (auto a : shownGroup)+ W3 B! k/ ?7 y6 [9 J9 h0 J! a8 K. H
  57.                 {2 G. x" g% b& e! h
  58.                         a->SetShow(true);
    " ^4 w' D: ?' y& e( E

  59. , v7 q  }* O) S' G  U" N1 q+ F
  60.                 }! E3 _  J% w+ W3 ]" N. x& L3 J% H
  61.         }
    # h8 D5 I+ B0 i0 ]2 F" ^' d( {1 _
  62.         if (!hiddenGroup.empty())* O& U! \( R( g" x  {+ U( `& K* `0 ~4 C
  63.         {& E. P+ g. O3 W4 E
  64.                 for (auto a : hiddenGroup)$ q. [. n; P+ [9 S/ x
  65.                 {
    ' R9 `  q$ c% V+ t
  66.                         a->SetShow(false);
    3 L0 [7 G' H: Y. `3 U# Y
  67.                 }
    " Y1 G! j- \4 d+ Z7 g+ n$ I% p
  68.         }' i: a  p! K! k' U+ n8 D6 m

  69.   N8 O# s7 U. z5 v* m; B9 s% d
  70.     //实时更新显示$ A8 H- i! b9 I; F6 u2 Y- Y2 q4 M
  71. , ~6 |  M% I. o) G) o5 a
  72.     UI_UpdateDoubleRangeValue();5 j, \6 f0 T6 O" D
  73. }
复制代码
: i' S! S* x" V$ c2 V6 ?) {
/ M; L8 @$ T7 g& O4 K) A2 Z
% Q) i& `1 B( F
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

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

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

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

    我知道了