首页 > 其他 > 详细

改背景黑白交替

时间:2020-06-08 22:17:54      阅读:49      评论:0      收藏:0      [点我收藏+]
 1 NXOpen::Display::Background *background;
 2     background = workPart->Views()->CreateBackground(workPart->ModelingViews()->WorkView(), false);
 3     background->SetBackgroundShadedViewsType(NXOpen::Display::Background::ShadedTypePlain);
 4     background->Commit();
 5     background->Destroy();
 6     
 7     UF_initialize();
 8 
 9     char * clr_name;
10     double clr_values[3];
11     UF_DISP_ask_color(0, UF_DISP_rgb_model, &clr_name, clr_values);
12     if (clr_values[0] == 0.0&& clr_values[1] == 0.0&& clr_values[2] == 0.0)
13     {
14         //白色背景
15         double clr_values[3] = { 1.0,1.0,1.0 };
16         UF_DISP_set_color(UF_DISP_BACKGROUND_COLOR, UF_DISP_rgb_model, NULL, clr_values);
17         UF_DISP_load_color_table();
18         uc1601("庆哥提示更改为:白色背景", 0);
19     }
20     else if (clr_values[0] == 1.0&& clr_values[1] == 1.0&& clr_values[2] == 1.0)
21     {
22         //黑色背景
23         double clr_values[3] = { 0.0,0.0,0.0 };
24         UF_DISP_set_color(UF_DISP_BACKGROUND_COLOR, UF_DISP_rgb_model, NULL, clr_values);
25         UF_DISP_load_color_table();
26         uc1601("庆哥提示更改为:黑色背景", 0);
27     }
28     else
29     {
30         NXOpen::Display::Background *background;
31         background = workPart->Views()->CreateBackground(workPart->ModelingViews()->WorkView(), false);
32         background->SetBackgroundShadedViewsType(NXOpen::Display::Background::TypePlain);
33         background->Commit();
34         background->Destroy();
35     }
36     UF_terminate();

 下面是经典背景

 1     NXOpen::Session *theSession = NXOpen::Session::GetSession();
 2     NXOpen::Part *workPart(theSession->Parts()->Work());
 3     NXOpen::Part *displayPart(theSession->Parts()->Display());
 4 
 5     NXOpen::Display::Scene *scene;
 6     scene = workPart->Views()->CreateScene(workPart->ModelingViews()->WorkView(), false);
 7     NXOpen::Display::Background *background;
 8     background = workPart->Views()->CreateBackground(workPart->ModelingViews()->WorkView(), false);
 9     background->SetBackgroundShadedViewsType(2);
10     std::vector<double> topcolor;
11     const double topcolor1_initial_values[] = {0.13725490196078433, 0.13725490196078433, 0.29411764705882354};
12     topcolor.assign(topcolor1_initial_values, topcolor1_initial_values + 3);
13     background->SetBackgroundShadedViewsGraduatedTop(topcolor);
14     std::vector<double> bottomcolor;
15     const double bottomcolor1_initial_values[] = {0.054901960784313725, 0.41176470588235292, 0.58823529411764708};
16     bottomcolor.assign(bottomcolor1_initial_values, bottomcolor1_initial_values + 3);
17     background->SetBackgroundShadedViewsGraduatedBottom(bottomcolor);
18     background->Commit();
19     scene->Commit();
20     scene->Destroy();
21     background->Destroy();

 

改背景黑白交替

原文:https://www.cnblogs.com/liuxiaoqing1/p/13068732.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!