From fb00d0ac0bde241ceb3c901b313d40573d7b6a6c Mon Sep 17 00:00:00 2001 From: cjw Date: Fri, 21 Mar 2025 15:12:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=86=E5=A4=87=E8=8F=9C=E5=8D=95=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E5=85=B7=E6=A0=8F=E4=BD=8D=E7=BD=AE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E3=80=82=E6=95=B4=E4=BD=93=E6=8C=89=E9=92=AE=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E4=BF=AE=E6=94=B9=E3=80=82Gcode=E8=BF=9E=E7=BB=AD?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E4=BF=AE=E6=94=B9=E3=80=82=E7=BA=A4=E7=BB=B4?= =?UTF-8?q?=E8=BF=9B=E7=BB=99=E7=8E=87=E5=92=8C=E6=99=AE=E9=80=9A=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E9=80=9F=E5=BA=A6=E6=9A=82=E6=97=B6=E8=BF=98=E5=8E=9F?= =?UTF-8?q?=EF=BC=8C=E6=96=B9=E4=BE=BF=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libslic3r/Calib.cpp | 2 + libslic3r/Extruder.cpp | 1 + libslic3r/Fill/FillTest.cpp.back | 3462 ++++++++++++++++++++ libslic3r/Fill/FillTest.hpp.back | 49 + libslic3r/GCode.cpp | 94 +- libslic3r/GCodeWriter.cpp | 35 +- libslic3r/GCodeWriter.hpp | 1 + libslic3r/PrintConfig.cpp | 8 +- libslic3r/PrintConfig.hpp | 1 + libslic3r/PrintObject.cpp | 4 + slic3r/GUI/AMSMaterialsSetting.cpp | 12 +- slic3r/GUI/AmsMappingPopup.cpp | 6 +- slic3r/GUI/Auxiliary.hpp | 3 +- slic3r/GUI/BindDialog.cpp | 21 +- slic3r/GUI/BonjourDialog.cpp | 3 +- slic3r/GUI/CaliHistoryDialog.cpp | 24 +- slic3r/GUI/CalibrationPanel.hpp | 3 +- slic3r/GUI/CalibrationWizard.cpp | 4 + slic3r/GUI/CalibrationWizardPage.cpp | 6 +- slic3r/GUI/CalibrationWizardPresetPage.cpp | 2 + slic3r/GUI/ConnectPrinter.cpp | 6 +- slic3r/GUI/CreatePresetsDialog.cpp | 36 +- slic3r/GUI/DailyTips.cpp | 6 +- slic3r/GUI/ExtrusionCalibration.cpp | 18 +- slic3r/GUI/GCodeViewer.cpp | 6 +- slic3r/GUI/GLCanvas3D.cpp | 55 +- slic3r/GUI/GLCanvas3D.hpp | 3 + slic3r/GUI/GLToolbar.cpp | 8 +- slic3r/GUI/GLToolbar.hpp | 2 + slic3r/GUI/GUI_App.cpp | 3 +- slic3r/GUI/Gizmos/GLGizmoMeasure.cpp | 3 +- slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp | 15 +- slic3r/GUI/IMSlider.cpp | 3 +- slic3r/GUI/MainFrame.cpp | 6 +- slic3r/GUI/MsgDialog.cpp | 9 +- slic3r/GUI/MultiMachineManagerPage.cpp | 15 +- slic3r/GUI/MultiTaskManagerPage.cpp | 24 +- slic3r/GUI/Notebook.cpp | 6 +- slic3r/GUI/ObjColorDialog.cpp | 30 +- slic3r/GUI/ParamsPanel.cpp | 6 +- slic3r/GUI/PlateSettingsDialog.cpp | 6 +- slic3r/GUI/Plater.cpp | 14 +- slic3r/GUI/PrivacyUpdateDialog.cpp | 3 +- slic3r/GUI/Project.hpp | 3 +- slic3r/GUI/PublishDialog.cpp | 3 +- slic3r/GUI/RecenterDialog.cpp | 6 +- slic3r/GUI/SavePresetDialog.cpp | 6 +- slic3r/GUI/SelectMachine.cpp | 18 +- slic3r/GUI/SelectMachine.hpp | 3 +- slic3r/GUI/SendMultiMachinePage.cpp | 12 +- slic3r/GUI/SendToPrinter.cpp | 6 +- slic3r/GUI/SlicingProgressNotification.cpp | 3 +- slic3r/GUI/StatusPanel.cpp | 21 +- slic3r/GUI/TabButton.cpp | 3 +- slic3r/GUI/UnsavedChangesDialog.cpp | 6 +- slic3r/GUI/UpgradePanel.cpp | 12 +- slic3r/GUI/Widgets/AMSControl.cpp | 3 +- slic3r/GUI/Widgets/AMSControl.hpp | 3 +- slic3r/GUI/Widgets/AxisCtrlButton.cpp | 3 +- slic3r/GUI/Widgets/Button.cpp | 4 +- slic3r/GUI/Widgets/ComboBox.cpp | 3 +- slic3r/GUI/Widgets/DropDown.cpp | 3 +- slic3r/GUI/Widgets/ImageSwitchButton.cpp | 3 +- slic3r/GUI/Widgets/ProgressBar.hpp | 3 +- slic3r/GUI/Widgets/SideButton.cpp | 9 +- slic3r/GUI/Widgets/SideTools.cpp | 6 +- slic3r/GUI/Widgets/SideTools.hpp | 3 +- slic3r/GUI/Widgets/SpinInput.cpp | 3 +- slic3r/GUI/Widgets/StepCtrl.cpp | 6 +- slic3r/GUI/Widgets/TabCtrl.cpp | 3 +- slic3r/GUI/Widgets/TempInput.cpp | 9 +- slic3r/GUI/Widgets/TextInput.cpp | 3 +- slic3r/GUI/WipeTowerDialog.cpp | 18 +- slic3r/GUI/calib_dlg.cpp | 30 +- slic3r/Utils/CalibUtils.cpp | 1 + 75 files changed, 4048 insertions(+), 194 deletions(-) create mode 100644 libslic3r/Fill/FillTest.cpp.back create mode 100644 libslic3r/Fill/FillTest.hpp.back diff --git a/libslic3r/Calib.cpp b/libslic3r/Calib.cpp index 933f646..991e665 100644 --- a/libslic3r/Calib.cpp +++ b/libslic3r/Calib.cpp @@ -209,6 +209,7 @@ std::string CalibPressureAdvance::draw_line(GCodeWriter &writer, Vec2d to_pt, do const double e_per_mm = CalibPressureAdvance::e_per_mm(line_width, layer_height, m_config.option("nozzle_diameter")->get_at(0), m_config.option("filament_diameter")->get_at(0), m_config.option("filament_flow_ratio")->get_at(0)); + //m_config.option("fibre_feed_rate")->get_at(0)); const double length = get_distance(Vec2d(m_last_pos.x(), m_last_pos.y()), to_pt); auto dE = e_per_mm * length; @@ -556,6 +557,7 @@ void CalibPressureAdvancePattern::generate_custom_gcodes(const DynamicPrintConfi double number_e_per_mm = e_per_mm(line_width(), height_layer(), m_config.option("nozzle_diameter")->get_at(0), m_config.option("filament_diameter")->get_at(0), m_config.option("filament_flow_ratio")->get_at(0)); + //m_config.option("fibre_feed_rate")->get_at(0)); // glyph on every other line for (int j = 0; j < num_patterns; j += 2) { diff --git a/libslic3r/Extruder.cpp b/libslic3r/Extruder.cpp index 9ba2b4c..33b87f4 100644 --- a/libslic3r/Extruder.cpp +++ b/libslic3r/Extruder.cpp @@ -134,6 +134,7 @@ double Extruder::filament_cost() const double Extruder::filament_flow_ratio() const { return m_config->filament_flow_ratio.get_at(m_id); + //return m_config->fibre_feed_rate.get_at(m_id); } // Return a "retract_before_wipe" percentage as a factor clamped to <0, 1> diff --git a/libslic3r/Fill/FillTest.cpp.back b/libslic3r/Fill/FillTest.cpp.back new file mode 100644 index 0000000..7c395cc --- /dev/null +++ b/libslic3r/Fill/FillTest.cpp.back @@ -0,0 +1,3462 @@ +#ifndef AQ_CREAT_CURVES_ALONG_BODY_H_INCLUDED +#define AQ_CREAT_CURVES_ALONG_BODY_H_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include< uf_modl_curves.h > +#include +#include +#include +#include< uf_trns.h > +#include +#include +#include +#include + +#define EntityType_AllowBodies (1 << 6); +#define BodyRules_SingleBody (1 << 0); +#define BodyRules_FeatureBodies (1 << 1); +#define BodyRules_BodiesinGroup (1 << 2); + +using namespace std; +using namespace NXOpen; +using namespace NXOpen::BlockStyler; + +struct infor_inter_curves_s{ + list curves; + list< list::iterator > sign_curves; +}; + +/*定义一个结构体,储存与曲线相关的数据结构 +curves存tag_t类型标识符(tag_t为唯一标识曲线对象的类型,这个列表可能用于表示一组相关的曲线) +sign_curves:这是一个嵌套的list,元素是curves list中元素的迭代器类//型,这个嵌套列表用于标记或记录 curves 列表中某些特定曲线的位置或//状态信息 +*/ + +typedef struct infor_inter_curves_s infor_inter_curves_t; + +struct point_two_curve_s{ + tag_t point_TAG; + tag_t curve_TAG[2]; +}; +/* +定义了两个数据结构,一个是类型别名infor_inter_curves_t,另一个是结构体point_two_curve_s。infor_inter_curves_t 的类型别名,它等价于结构体类型 infor_inter_curves_s + +point_TAG:这是一个 tag_t 类型的成员变量,用于存储一个点的标识符。同样,tag_t 通常是在特定编程环境中用于唯一标识点对象的类型 + +curve_TAG[2]:这是一个包含两个 tag_t 类型元素的数组,用于存储两条曲线的标识符。这个结构体可能用于表示一个点与两条特定曲线之间的关系,例如该点是两条曲线的交点,或者该点在两条曲线的某种特定几何关系中具有重要意义。 +*/ + +typedef struct point_two_curve_s point_two_curve_t; + +struct curve_inter_points_s{ + tag_t curve_TAG; + list points_TAG; +}; +typedef struct curve_inter_points_s curve_inter_points_t; + +struct point_four_curve_s{ + tag_t point_TAG; + int num_of_curve; + tag_t curve_TAG[4]; +}; +typedef struct point_four_curve_s point_four_curve_t; + +class DllExport AQ_creat_curves_along_body +{ + // class members +public: + static Session *theSession; + static UI *theUI; + AQ_creat_curves_along_body(); + int Show(); + + void initialize_cb(); + void dialogShown_cb(); + int apply_cb(); + int ok_cb(); + int update_cb(NXOpen::BlockStyler::UIBlock* block); + PropertyList* GetBlockProperties(const char *blockID); + +//主函数 + int AQ_main(); + +//切片部分 + //创建平面 + int creat_Zplanes_along_body ( tag_t body_TAG, double height_layer, vector &planes_TAG ); + void creat_plane_along_Zcoor( double Z_coor, tag_t *plane_tag ); + + //得到交线 + int creat_inter_curves + ( tag_t body_TAG, vector &planes_TAG, vector< list< list< tag_t > > > & store_inter_curves ); + int ask_inter_curves_along_body_plane + ( tag_t body_TAG, tag_t plane_TAG, list< tag_t > & curves_TAG ); + +//切片交线孔位位置拓扑重构 + //交线提环 + int edit_infor_inter_curves( vector< list< list< tag_t > > > & store_inter_curves ); + +//生成截面中间过渡曲线 + int creat_edge_closing_curves + ( vector< list< list< tag_t > > > & store_inter_curves, + vector< list< list< tag_t > * > > & store_inter_curves_pt, + double offset_distance, + int offset_num, + list< list< tag_t > > & Sum_closing_curves_store_list, + vector< multimap< list< tag_t >*, list< tag_t >* > > & Sum_closing_curves_store ); + + int creat_mid_closing_curves + ( list< list< tag_t > * > & layer_closing_curves, + double offset_distance, + list< list< tag_t > > & Sum_closing_curves_store_list, + multimap< list< tag_t >*, list< tag_t >* > & closing_curves_store + ); + + //异常删除 + int delete_all_closing_curves + ( list< list< tag_t > > & Sum_closing_curves_store_list ); + + //小面积方向偏置 + int creat_offset_curve_small + ( list &input_curves, double distance, + vector< list< list< tag_t > > > &store_inter_curves ); + + //大面积偏置 + int creat_offset_curve_big + ( list &input_curves, double offset_distance, list &output_curves ); + + //处理孔洞它交环 + int ask_useful_curves_along_other( + list & closing_curves1, //输入tag + list & closing_curves2, + list< list< tag_t > > &store_inter_curves ); + + //相交求并环处理 + int edit_insert_curves + ( list & closing_curves1, list & closing_curves2 , list & output_curves ); + + //孔位相对位置判断函数 + int ask_position_along_two_curves + ( list & closing_curves1, list & closing_curves2 ); + + int ask_right_curves( tag_t curve_TAG, list *output_curves_list ); + int is_curve_open( tag_t curve_TAG ); + +//辅助小函数 + //多态求面积函数 + double ask_area_along_closing_curves( list &input_curves ); + +//拐角处理 + void edit_curves_inter + ( list< list< tag_t > > & Sum_closing_curves_store_list, + double degree, double cute_length ); + + tag_t edit_curves_inter + ( tag_t curve1, tag_t curve2, double degree, double cute_length ); + +//裁剪连接 + //处理层层之间路径 + int edit_layer_curves_creat_bridges + ( double R, double L, //第一层的起始过度圆环半径,及外连直线 + double ref_start_point[3], double ref_end_point[3], + vector< list< tag_t >* > & layer_first_curves_store, double cute_distance ); + + double is_curves_have_off_part + ( tag_t curve1, tag_t curve2, double offset ); + + int ask_two_ref_points + ( double ref_start_point[3], double ref_end_point[3], + list< tag_t > & curves, + tag_t * ref_curveTAG1, tag_t * ref_curveTAG2, + double out_start_point[3], double out_end_point[3] ); + + //深度优先搜索,进行根部倒置处理层间路径环 + int edit_closing_curves_creat_bridges + ( multimap< list< tag_t >*, list< tag_t >* >::iterator & father_it, + multimap< list< tag_t >*, list< tag_t >* > & closing_curves_store, double cute_distance ); + + //编辑连接 + int edit_curves_creat_bridge + ( list< tag_t > & curves1, list< tag_t > & curves2, double cute_distance ); + + //点线最短距离 + double ask_min_dist_pt_curve + ( double point[3], tag_t curve_TAG, double min_dist_point[3] ); + + //桥接相切曲线 + int create_bridge_curve_along_two_curves_points + ( int bridge_method, tag_t curve_ids [2] ,double parms [ 2 ] , tag_t * bridge_id ); + int creat_tangent_line_along_curve + (double startpoint[3], tag_t curve_TAG, double length, tag_t *line_TAG); + + //剪切曲线 + + + int edit_cute_curve_along_point_length + ( tag_t curve_TAG, double point[3], double length, tag_t *another_curve_TAG ); + + //复制对象 + int copy_obj(tag_t obj, tag_t *copyed_obj); + + //线上点和参数相互转换 + int ask_curve_point_along_parm( tag_t curve_id, double parm, double outputpoint [3] ); + int ask_curve_parm_along_point( tag_t curve_id, double point [ 3 ] , double * parm); + + //曲线相交 + int intersect_curve_along_curve + (tag_t curve1_TAG, tag_t curve2_TAG, vector *points_TAG ); + + //起点判断 + int is_start_point_along_curve + ( double*start_point, tag_t curve, double modeling_tolerance, double parameter_tolerance ); + + //两点距离 + double point_distance( double *p1,double *p2 ); + + //求线终点 + void ask_endpoint_along_curve + ( double* Start_point, tag_t curve, double * output_endpoint ); + +//参考缩放操作 +void scale_opition( tag_t solid, double* refpoint, double *param ); + +//路径显示 +void path_display +(vecter curves, int colour, int type_curve, int wide_curve); + + +private: + const char* theDlxFileName; + NXOpen::BlockStyler::BlockDialog* theDialog; + NXOpen::BlockStyler::Group* group0;// Block type: Group + NXOpen::BlockStyler::BodyCollector* bodySelect0;// Block type: Body Collector + NXOpen::BlockStyler::Group* group;// Block type: Group + NXOpen::BlockStyler::ExpressionBlock* expression0;// Block type: Expression + NXOpen::BlockStyler::ExpressionBlock* expression1;// Block type: Expression + +}; +#endif //AQ_CREAT_CURVES_ALONG_BODY_H_INCLUDED +//预处理文件,#ifndef与#endif中为一次编译代码,其他.cpp避免二次编译 + + +#include "AQ_creat_curves_along_body.hpp" +using namespace NXOpen; +using namespace NXOpen::BlockStyler; + +Session *(AQ_creat_curves_along_body::theSession) = NULL; +UI *(AQ_creat_curves_along_body::theUI) = NULL; + +AQ_creat_curves_along_body::AQ_creat_curves_along_body() +{ + try + { + // Initialize the NX Open C++ API environment + AQ_creat_curves_along_body::theSession = NXOpen::Session::GetSession(); + AQ_creat_curves_along_body::theUI = UI::GetUI(); + theDlxFileName = "AQ_creat_curves_along_body.dlx"; + theDialog = AQ_creat_curves_along_body::theUI->CreateDialog(theDlxFileName); + // Registration of callback functions + theDialog->AddApplyHandler(make_callback(this, &AQ_creat_curves_along_body::apply_cb)); + theDialog->AddOkHandler(make_callback(this, &AQ_creat_curves_along_body::ok_cb)); + theDialog->AddUpdateHandler(make_callback(this, &AQ_creat_curves_along_body::update_cb)); + theDialog->AddInitializeHandler(make_callback(this, &AQ_creat_curves_along_body::initialize_cb)); + theDialog->AddDialogShownHandler(make_callback(this, &AQ_creat_curves_along_body::dialogShown_cb)); + } + catch(exception& ex) + { + //---- Enter your exception handling code here ----- + throw; + } +} +//初始化AQ_creat_curves_along_body类的实例,获取会话session和ui对象。 +AQ_creat_curves_along_body::~AQ_creat_curves_along_body() +{ + if (theDialog != NULL) + { + delete theDialog; + theDialog = NULL; + } +} +//释放生命周期结束后的内存、对话框等资源 +extern "C" DllExport void ufusr(char *param, int *retcod, int param_len) +{ + AQ_creat_curves_along_body *theAQ_creat_curves_along_body = NULL; + try + { + theAQ_creat_curves_along_body = new AQ_creat_curves_along_body(); + // The following method shows the dialog immediately + theAQ_creat_curves_along_body->Show(); + } + catch(exception& ex) + { + //---- Enter your exception handling code here ----- + AQ_creat_curves_along_body::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); + } + if(theAQ_creat_curves_along_body != NULL) + { + delete theAQ_creat_curves_along_body; + theAQ_creat_curves_along_body = NULL; + } +} +//这个函数的目的是创建一个AQ_creat_curves_along_body类的对象,显示相关界面或执行初始化操作,如果出现问题则捕获并显示错误信息,最后在函数结束时正确清理对象资源。它可能是一个与特定应用程序(可能是与 NX 软件相关的二次开发)中创建沿体曲线功能相关的入口点函数,用于与外部环境进行交互并启动相应的操作流程。 + +extern "C" DllExport int ufusr_ask_unload() +{ + //return (int)Session::LibraryUnloadOptionExplicitly; + return (int)Session::LibraryUnloadOptionImmediately; + //return (int)Session::LibraryUnloadOptionAtTermination; +} + +extern "C" DllExport void ufusr_cleanup(void) +{ + try + { + //---- Enter your callback code here ----- + } + catch(exception& ex) + { + //---- Enter your exception handling code here ----- + AQ_creat_curves_along_body::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); + } +} + +int AQ_creat_curves_along_body::Show() +{ + try + { + theDialog->Show(); + } + catch(exception& ex) + { + //---- Enter your exception handling code here ----- + AQ_creat_curves_along_body::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); + } + return 0; +} +//显示一个对话框,如果出现问题会出现一个对话框,向用户返回问题 +void AQ_creat_curves_along_body::initialize_cb() +{ + try + { + group0 = dynamic_cast(theDialog->TopBlock()->FindBlock("group0")); + bodySelect0 = dynamic_cast(theDialog->TopBlock()->FindBlock("bodySelect0")); + group = dynamic_cast(theDialog->TopBlock()->FindBlock("group")); + expression0 = dynamic_cast(theDialog->TopBlock()->FindBlock("expression0")); + expression1 = dynamic_cast(theDialog->TopBlock()->FindBlock("expression1")); + } + catch(exception& ex) + { + //---- Enter your exception handling code here ----- + AQ_creat_curves_along_body::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); + } +} + +void AQ_creat_curves_along_body::dialogShown_cb() +{ + try + { + //---- Enter your callback code here ----- + } + catch(exception& ex) + { + //---- Enter your exception handling code here ----- + AQ_creat_curves_along_body::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); + } +} +//是一个对话框显示事件函数 +int AQ_creat_curves_along_body::apply_cb() +{ + int errorCode = 0; + try + { + AQ_main();//用于执行与创建沿体曲线相关的主要逻辑 + } + catch(exception& ex) + { + //---- Enter your exception handling code here ----- + errorCode = 1; + AQ_creat_curves_along_body::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); + } + return errorCode; +} + +int AQ_creat_curves_along_body::update_cb(NXOpen::BlockStyler::UIBlock* block)//通过一系列if-else if语句来判断触发更新事件的 UI 元素是哪一个 +{ + try + { + if(block == bodySelect0) + { + //---------Enter your code here----------- + } + else if(block == expression0) + { + //---------Enter your code here----------- + } + else if(block == expression1) + { + //---------Enter your code here----------- + } + } + catch(exception& ex) + { + //---- Enter your exception handling code here ----- + AQ_creat_curves_along_body::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); + } + return 0; +} + +int AQ_creat_curves_along_body::ok_cb() +{ + int errorCode = 0; + try + { + errorCode = apply_cb();//点击确定按钮执行该函数 + } + catch(exception& ex) + { + //---- Enter your exception handling code here ----- + errorCode = 1; + AQ_creat_curves_along_body::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); + } + return errorCode; +} + +PropertyList* AQ_creat_curves_along_body::GetBlockProperties(const char *blockID) +{ + return theDialog->GetBlockProperties(blockID); +} + +//主函数 +int AQ_creat_curves_along_body::AQ_main(){ + UF_initialize(); + +//获取体的tag信息,进行必要的错误信息过滤 + vectorbody = bodySelect0->GetSelectedObjects(); + if( body.size() > 1 ){//多体,错误过滤 + uc1601( "请您选择单个体" , 1); + return 0; + } + +//获取参数值 + tag_t body_TAG = body[0] -> Tag(); + double height_layer = expression0 ->Value();//层高 + double offset_distance = expression1 ->Value();//偏移距离 + + vector planes_TAG; + +//创建截平面 + int sign_creat_Zplanes = creat_Zplanes_along_body ( body_TAG, height_layer, planes_TAG ); + +//获取截面曲线信息 + vector< list< list< tag_t > > > store_inter_curves; + creat_inter_curves( body_TAG, planes_TAG, store_inter_curves ); + +//将截面信息进行提环,处理环之间的位置关系 + int sign_edit_infor = edit_infor_inter_curves + ( store_inter_curves ); + + + +//建立多重映射(红黑树实现)+ 链表储存对象 + vector< list< list< tag_t > * > > store_inter_curves_pt; + + vector< multimap< list< tag_t >*, list< tag_t >* > > + Sum_closing_curves_store; + Sum_closing_curves_store.resize( store_inter_curves.size() ); + + list< list< tag_t > > Sum_closing_curves_store_list; + list< tag_t > NULL_list; + Sum_closing_curves_store_list.push_back( NULL_list ); + + +//生成边缘层曲线,并给与信息,是否可产生偏置 + int offset_num = 3;//控制孔位偏置环数 + + int sign_creat_edge = creat_edge_closing_curves + ( store_inter_curves, + store_inter_curves_pt, + offset_distance, + offset_num, + Sum_closing_curves_store_list, + Sum_closing_curves_store + ); + +//进行中间层,路径环得生成 + for ( int i = 0; i < Sum_closing_curves_store.size() ; i ++ ){ + + creat_mid_closing_curves + ( store_inter_curves_pt[i], + offset_distance, + Sum_closing_curves_store_list, + Sum_closing_curves_store[i] ); + } + +//拐角处理 + edit_curves_inter + ( Sum_closing_curves_store_list, 90, offset_distance / 2 ); + +//处理链表中有无完整环线,如果有进行处理 + for( list< list< tag_t > >::iterator + temp_it = Sum_closing_curves_store_list.begin(); + temp_it!= Sum_closing_curves_store_list.end(); temp_it ++ ){ + + if( ( * temp_it ).size() != 1 ) + continue; + + tag_t another_curve_TAG; + double mid_point[3]; + + ask_curve_point_along_parm( *( ( * temp_it ).begin() ), 0.5, mid_point ); + + edit_cute_curve_along_point_length + ( *( ( * temp_it ).begin() ), mid_point, 0, &another_curve_TAG ); + + ( * temp_it ).push_back( another_curve_TAG ); + } + + //return 1; + +//层间环间剪切连接 + vector< list< tag_t >* > layer_first_curves_store( Sum_closing_curves_store.size() ); + + for (int i = 0; i < Sum_closing_curves_store.size(); i++){ + multimap< list< tag_t >*, list< tag_t >* >::iterator + first_father_it = Sum_closing_curves_store[i].lower_bound + ( & ( * ( Sum_closing_curves_store_list.begin() ) ) ); + + layer_first_curves_store[i] = ( * first_father_it ).second; + } + + double ref_start_point [3] = { 0, 0, 0 }; + double ref_end_point [3] = { 1, 0, 0 }; + + edit_layer_curves_creat_bridges + ( 5, 5, //第一层的起始过度圆环半径,及外连直线 + ref_start_point, ref_end_point, + layer_first_curves_store, height_layer * 2.5 ); + + + +//层内环间剪切连接 + //深度优先搜索,进行根部倒置处理层间路径环 + //UF_UI_open_listing_window(); + + for ( int i = 0; i < Sum_closing_curves_store.size(); i++ ){ + + multimap< list< tag_t >*, list< tag_t >* >::iterator + first_father_it = Sum_closing_curves_store[i].lower_bound + ( & ( * ( Sum_closing_curves_store_list.begin() ) ) ); + + //进行编辑 + edit_closing_curves_creat_bridges + ( first_father_it, + Sum_closing_curves_store[i], offset_distance ); + } + + + uc1601( "1", 1 ); + + UF_terminate(); + return 1; +} + + +//切片部分 +//创建平面 +int AQ_creat_curves_along_body::creat_Zplanes_along_body + ( tag_t body_TAG, double height_layer, vector &planes_TAG ){ + int num; + + //获取体的最大最小Z向坐标值 + double bounding_box [ 6 ]; + UF_MODL_ask_bounding_box( body_TAG, bounding_box); + + double Z_min = bounding_box[2]; + double Z_max = bounding_box[5]; + + //创建多个截面,Z坐标 + num = ( Z_max - Z_min )/height_layer; + height_layer = ( Z_max - Z_min )/num; + + //创建截平面 + double origin_point [3] ={0, 0, 0}; + double plane_normal [3] ={0, 0, 1}; + planes_TAG.resize( num ); + + for (int i = 0; i < num; i++){ + origin_point[2] = ( i * height_layer + Z_min ) + height_layer/2 ; + UF_MODL_create_plane ( origin_point, plane_normal, &( planes_TAG[i] ) ); + } + + return num; +} +void AQ_creat_curves_along_body::creat_plane_along_Zcoor(double Z_coor, tag_t *plane_tag){ + double origin_point [3] ={0, 0, Z_coor}; + double plane_normal [3] ={0, 0, 1}; + + int sign_plane = UF_MODL_create_plane + (origin_point, plane_normal, plane_tag ); +} + +//得到交线 +int AQ_creat_curves_along_body::creat_inter_curves + ( tag_t body_TAG, vector &planes_TAG, vector< list< list< tag_t > > > & store_inter_curves ){ + //获取公差 + double tol = 0.001; + UF_MODL_ask_distance_tolerance(&tol); + + int num_inter_curves; + + store_inter_curves.resize( planes_TAG.size() ); + + list< tag_t > temp_curves_store; + + //获取截面曲线TAG值信息 + for (int i = 0; i < planes_TAG.size(); i++){ + + //相交 + UF_MODL_intersect_info_p_t *intersect_data; + UF_MODL_intersect_objects( body_TAG, planes_TAG[i], tol, &num_inter_curves, &intersect_data ); + + store_inter_curves[i].push_back( temp_curves_store ); + + //数据转移 + for (int j = 0; j < num_inter_curves; j++){ + ( *( store_inter_curves[i].begin() ) ). + push_back( intersect_data[j]->intersect.curve.identifier ); + UF_free( intersect_data[j] ); + }//endfor + + //删除截面 + UF_OBJ_delete_object( planes_TAG[i] ); + + //清除内存 + if (num_inter_curves != 0){ + UF_free( intersect_data ); + } + }//end for(int i = 0; i < planes_TAG.size(); i++) + + return 1; +} + +int AQ_creat_curves_along_body::ask_inter_curves_along_body_plane + (tag_t body_TAG, tag_t plane_TAG, list< tag_t > &curves_TAG ){ + + double tol = 0.001; + UF_MODL_ask_distance_tolerance( &tol ); + + int num_inter_curves; + UF_MODL_intersect_info_p_t *intersect_data; + + UF_MODL_intersect_objects(body_TAG, plane_TAG, tol, &num_inter_curves, &intersect_data); + + curves_TAG.clear(); + for (int i = 0; i < num_inter_curves; i++){ + curves_TAG.push_back( intersect_data[i]->intersect.curve.identifier ); + }//endfor + + if (num_inter_curves != 0){ + UF_free(intersect_data); + } + + return num_inter_curves; +} + +//交线提环 +int AQ_creat_curves_along_body::edit_infor_inter_curves + ( vector< list< list< tag_t > > > & store_inter_curves ){ + + //store_inter_curves的数量已定 + + list< tag_t > temp_closing_curves;//储存每一层的线的总线tag + list< list > temp_curves_store;//储存每一层的封闭环的线的TAGs + list< tag_t > temp_curves;//单环线临时储存 + + for ( int i = 0; i < store_inter_curves.size(); i++ ){//处理动态数组中的每一项(每一层线) + //截取数据 + temp_closing_curves.clear();//清理 + temp_curves_store.clear(); + temp_curves.clear(); + + temp_closing_curves.insert( temp_closing_curves.end(),//插入数据 + ( * ( store_inter_curves[i].begin() ) ).begin(), + ( * ( store_inter_curves[i].begin() ) ).end() ); + + //进行环的提取 + double temp_start_point[3] = { 0, 0, 0 }; + int number = temp_closing_curves.size(); + list< tag_t >::iterator temp_it; + int sign_start_point_along_curve = 0; + + ask_endpoint_along_curve( temp_start_point, *( temp_closing_curves.begin() ), temp_start_point ); + + while( !( temp_closing_curves.empty() ) ){//整体每条线段循环 + sign_start_point_along_curve = 0; + + for ( temp_it = temp_closing_curves.begin(); + temp_it != temp_closing_curves.end(); temp_it ++){//起点找线 + if( is_start_point_along_curve + ( temp_start_point, *temp_it, 0.005, 0.05) == 1 ){//找到线 + sign_start_point_along_curve = 1; + break; + } + } + + if( sign_start_point_along_curve == 1 ){//找到线 + temp_curves.push_back( *temp_it ); + + //处理起点 + ask_endpoint_along_curve( temp_start_point, *temp_it, temp_start_point ); + + //删除temp_closing_curves列表中的TAG + list< tag_t >::iterator temp_it2 = temp_it; + temp_it2 ++; + temp_closing_curves.erase( temp_it, temp_it2 ); + }//end if + + else{//没有找到线 + //将线置入temp_curves_store总储存中,清理 + temp_curves_store.push_back( temp_curves ); + temp_curves.clear(); + //处理起点 + ask_endpoint_along_curve( temp_start_point, *( temp_closing_curves.begin() ), temp_start_point ); + }//end else + }//end while + + temp_curves_store.push_back( temp_curves ); + temp_curves.clear(); + + //进行大环提取,辅助存储 + list< list >::iterator real_curves_store_it; + double real_area = 0; + + //寻找面积最大环的迭代器 + for( list< list >::iterator temp_curves_store_it = temp_curves_store.begin(); + temp_curves_store_it != temp_curves_store.end(); temp_curves_store_it ++ ){ + //获取当前temp_curves_store_it对应的面积 + double temp_area = ask_area_along_closing_curves( *temp_curves_store_it ); + if( temp_area > real_area ){ + real_area = temp_area; + real_curves_store_it = temp_curves_store_it; + } + } + + //将最大面积环提前 + temp_curves.clear(); + temp_curves.insert( temp_curves.end(),//插入数据 + ( *real_curves_store_it ).begin(), ( *real_curves_store_it ).end() ); + + //删除temp_curves_store中对应的最大环 + list< list >::iterator real_curves_store_it1 = real_curves_store_it; + real_curves_store_it1 ++; + temp_curves_store.erase( real_curves_store_it, real_curves_store_it1 ); + + //插入最前端环 + temp_curves_store.push_front( temp_curves ); + + temp_curves.clear(); + + //将数据储存到store_inter_curves[i]中,list< list > temp_curves_store + store_inter_curves[i].pop_front(); + + for( list< list >::iterator temp_curves_store_it = temp_curves_store.begin(); + temp_curves_store_it != temp_curves_store.end(); temp_curves_store_it ++ ){ + store_inter_curves[i].push_back( * temp_curves_store_it ); + } + + }//end for 层 + + return 1; +}//end function + +int AQ_creat_curves_along_body::creat_edge_closing_curves + ( vector< list< list< tag_t > > > & store_inter_curves, + vector< list< list< tag_t > * > > & store_inter_curves_pt, + double offset_distance, + int offset_num, + list< list< tag_t > > & Sum_closing_curves_store_list, + vector< multimap< list< tag_t >*, list< tag_t >* > > & + Sum_closing_curves_store ){ + + //定义异常检索值 + int sign_result = 0; + vector< list< list< tag_t > > > temp_store_inter_curves; + + store_inter_curves_pt.resize( store_inter_curves.size() ); + + for ( int i = 0; i < store_inter_curves.size(); i++ ){ + + temp_store_inter_curves.clear(); + + int sign_creat_offset_curve_small = creat_offset_curve_small + ( * ( store_inter_curves[i].begin() ), offset_distance / 2, temp_store_inter_curves ); + + if ( temp_store_inter_curves[0].size() != 1 ){ + + if( temp_store_inter_curves[0].size() == 0 ){ + sign_result = 1; + } + if( temp_store_inter_curves[0].size() > 1 ){ + sign_result = 2; + delete_all_closing_curves ( temp_store_inter_curves[0] ); + } + + break; + } + + //储存数据 + Sum_closing_curves_store_list.push_back( * ( temp_store_inter_curves[0].begin() ) ); + + //储存指针对 + list< list< tag_t > >::iterator temp_beg = + Sum_closing_curves_store_list.begin(); + + list< list< tag_t > >::iterator temp_end = + Sum_closing_curves_store_list.end(); temp_end --; + + Sum_closing_curves_store[i].insert( + pair< list< tag_t >*, list< tag_t >* >( + & ( * temp_beg ), & ( * temp_end ) + ) + ); + + store_inter_curves_pt[i].push_back( & ( * temp_end ) ); + + } + + //排除异常 + if( sign_result != 0 ){ + delete_all_closing_curves ( Sum_closing_curves_store_list ); + return -1; + } + + + //处理有用层,删除,换线 + for ( int i = 0; i < store_inter_curves.size(); i++ ){ + for( list< tag_t >::iterator temp_it = ( * ( store_inter_curves[i].begin() ) ).begin(); + temp_it != ( * ( store_inter_curves[i].begin() ) ).end(); temp_it ++ ){ + UF_OBJ_delete_object( * temp_it ); + } + + store_inter_curves[i].pop_front(); + + multimap< list< tag_t >*, list< tag_t >* >::iterator temp_it_mul; + + temp_it_mul = + ( Sum_closing_curves_store[i] ). + lower_bound( & ( * ( Sum_closing_curves_store_list.begin() ) ) ); + + store_inter_curves[i].push_front( *( ( * temp_it_mul ).second ) ); + } + +//下面进行内环的偏置 + //首先将内环想大方向偏置 4.5*offset 距离 + list< list< tag_t > > temp_sum_hole_store; + list< list< tag_t > > temp_sum_hole_big_store; + list< tag_t > temp_output_curves; + + list< list< tag_t > >::iterator temp_it1; + list< list< tag_t > >::iterator temp_it2; + for ( int i = 0; i < store_inter_curves.size(); i++ ){ + //提取当前层的孔位 + temp_sum_hole_store.clear(); + temp_it1 = store_inter_curves[i].begin(); + temp_it1 ++; + temp_it2 = store_inter_curves[i].end(); + + if( temp_it1 != temp_it2 ){ + temp_sum_hole_store.insert( temp_sum_hole_store.end(), temp_it1, temp_it2 ); + } + + temp_sum_hole_big_store.clear(); + + //处理临时大孔位 + for( temp_it1 = temp_sum_hole_store.begin(); + temp_it1 != temp_sum_hole_store.end(); temp_it1 ++ ){ + //偏置线 + temp_output_curves.clear(); + creat_offset_curve_big//12.18 + ( * temp_it1, offset_distance * ( 0.5 + (double)offset_num ), temp_output_curves ); + + temp_sum_hole_big_store.push_back( temp_output_curves ) ; + + //删除内环 + for( list< tag_t >::iterator temp_it = ( * temp_it1 ).begin(); + temp_it != ( * temp_it1 ).end(); temp_it ++ ){ + UF_OBJ_delete_object( * temp_it ); + } + } + + //判断大孔位与最大轮廓的位置关系,进行异常剔除 + int sign_pos_relship_holes = 1; + int temp_sign = 0; + temp_it2 = store_inter_curves[i].begin(); + + for( temp_it1 = temp_sum_hole_big_store.begin(); + temp_it1 != temp_sum_hole_big_store.end(); temp_it1 ++ ){ + + temp_sign = ask_position_along_two_curves ( * temp_it2, * temp_it1 ); + + if ( temp_sign != 4 ){//环大了 + sign_pos_relship_holes = 0; + break; + } + } + + //异常剔除 + if( sign_pos_relship_holes == 0 ){ + delete_all_closing_curves ( Sum_closing_curves_store_list ); + delete_all_closing_curves ( temp_sum_hole_big_store ); + sign_result = 3; + break; + } + + //进行大孔位的位置处理,并进行新的大环位生成 + for( temp_it1 = temp_sum_hole_big_store.begin(); + temp_it1 != -- ( temp_sum_hole_big_store.end() ); temp_it1 ++ ){ + temp_it2 = temp_it1; + temp_it2 ++; + + if( ( * temp_it1 ).size() == 0 ){ + continue; + } + for( ;temp_it2 != temp_sum_hole_big_store.end(); temp_it2 ++ ){ + //空环继续 + if( ( * temp_it2 ).size() == 0 ){ + continue; + } + + //无交环继续 + int sign_position = ask_position_along_two_curves ( * temp_it1, * temp_it2 ); + + if( sign_position != 1 && sign_position != 2 ){//没有相交或者外离 + continue; + } + + //处理有交环 + list< tag_t > temp_output_curves; + edit_insert_curves + ( * temp_it1, * temp_it2, temp_output_curves ); + + temp_sum_hole_big_store.push_back( temp_output_curves ); + } + } + + //进行大环位的储存+大环位在指针中的储存 + //进行输入的处理 + temp_it1 = store_inter_curves[i].begin(); + temp_it1 ++; + store_inter_curves[i].erase( temp_it1, store_inter_curves[i].end() ); + vector< list< list< tag_t > * > > big_hole_ref_store( offset_num + 1 ); + + for( temp_it1 = temp_sum_hole_big_store.begin(); + temp_it1 != temp_sum_hole_big_store.end(); temp_it1 ++ ){ + if( ( * temp_it1 ).size() != 0 ){ + store_inter_curves[i].push_back( * temp_it1 ); + Sum_closing_curves_store_list.push_back( * temp_it1 ); + + temp_it2 = Sum_closing_curves_store_list.end(); + temp_it2 --; + list< tag_t > * temp_list_ref = & ( * temp_it2 ); + + Sum_closing_curves_store[i]. + insert( pair< list< tag_t > *, list< tag_t > * > ( NULL, temp_list_ref ) ); + + store_inter_curves_pt[i].push_back( temp_list_ref ); + big_hole_ref_store[0].push_back( temp_list_ref ); + + } + + else{ + temp_it2 = temp_it1; + temp_it2 ++; + temp_sum_hole_big_store.erase( temp_it1, temp_it2 ); + } + } + + //进行大环位的小方向偏置+储存 + //vector< list< list< tag_t > * > > big_hole_ref_store(4); + vector< list< list< tag_t > > > temp_store_inter_curves; + list< list< tag_t > * >::iterator temp_it_1; + list< list< tag_t > * >::iterator temp_it_2; + + for( int j = 0; j < offset_num ; j ++ ){ + + for( temp_it_1 = big_hole_ref_store[j].begin(); + temp_it_1 != big_hole_ref_store[j].end() ; temp_it_1 ++ ){ + + temp_store_inter_curves.clear(); + + creat_offset_curve_small + ( * ( * temp_it_1 ), offset_distance, temp_store_inter_curves ); + + for( temp_it1 = temp_store_inter_curves[0].begin(); + temp_it1 != temp_store_inter_curves[0].end(); temp_it1 ++ ){ + + Sum_closing_curves_store_list.push_back( * temp_it1 ); + + temp_it2 = Sum_closing_curves_store_list.end(); + temp_it2 --; + list< tag_t > * temp_list_ref = & ( * temp_it2 ); + + big_hole_ref_store[ j+1 ].push_back( temp_list_ref ); + + Sum_closing_curves_store[i]. + insert( + pair< list< tag_t > *, list< tag_t > * > + ( * temp_it_1, temp_list_ref ) + ); + }//循环偏置得到的小环进行储存处理 + + }//循环 j 对应的曲线环 + + }//end j < num_off 循环总小偏层数 + }//i 循环每个大层i + + return 1; + //return sign_result; +} + +//得到中间截面 +int AQ_creat_curves_along_body::creat_mid_closing_curves + ( list< list< tag_t > * > & layer_closing_curves, + double offset_distance, + list< list< tag_t > > & closing_curves_store_list, + multimap< list< tag_t >*, list< tag_t >* > & closing_curves_store ){ + + vector< list< list< tag_t > > > temp_store_inter_curves; + + //进行偏置 + int sign_offset_curves = creat_offset_curve_small + ( *( * ( layer_closing_curves.begin() ) ), offset_distance, temp_store_inter_curves ); + + if( sign_offset_curves == 0 ){//曲线无法偏置 + return 0; + } + else{//曲线有可能生成多环 + //将曲线进行提环,2级主轮廓环数据转移mid_layer_closing_curves中 + list< list< tag_t > > mid_layer_closing_curves; + list< list< tag_t > * > island_closing_curves; + + list< list< tag_t > * > ::iterator temp_it = layer_closing_curves.begin(); + temp_it ++; + + for( ; temp_it != layer_closing_curves.end(); temp_it ++ ){ + island_closing_curves.push_back( * temp_it ) ; + } + + for( list< list< tag_t > > ::iterator temp_it = temp_store_inter_curves[0].begin(); + temp_it != temp_store_inter_curves[0].end(); temp_it ++ ){ + mid_layer_closing_curves.push_back( * temp_it ) ; + } + + //进行它交有效环处理,利用孔位信息处理轮廓信息 + //处理它交环 + int sign_ask_position = -5; + list< list< tag_t > >::iterator temp_it_1; + list< list< tag_t > * >::iterator temp_it_2; + + list< list< tag_t > * > temp_holes_pt; + + for( + temp_it_1 = mid_layer_closing_curves.begin(); + temp_it_1 != mid_layer_closing_curves.end(); temp_it_1 ++ ){ + for( + temp_it_2 = island_closing_curves.begin(); + temp_it_2 != island_closing_curves.end(); temp_it_2 ++ ){ + + //主线环为空 + if( ( * temp_it_1 ).size() == 0 ){ + break; + } + if( ( * temp_it_2 ) -> size() == 0 ){ + continue; + } + + sign_ask_position = + ask_position_along_two_curves ( * temp_it_1, * ( * temp_it_2 ) ); + + //无需操作:4 内含、1 外切 0 相离 + if( sign_ask_position == 4 || sign_ask_position == 1 || sign_ask_position == 0 ){ + continue; + } + + //进行它交环处理:2 相交 3 内切 + if( sign_ask_position == 2 || sign_ask_position == 3 ){ + //交环处理 + list< list< tag_t > > store_inter_curves_other; + + ask_useful_curves_along_other( + * temp_it_1, *( * temp_it_2 ), store_inter_curves_other ); + + //清除环向 + ( * temp_it_1 ).clear(); + ( * temp_it_2 )->clear(); + + //放置新生成的环 + for( list< list< tag_t > >::iterator temp_it = store_inter_curves_other.begin(); + temp_it != store_inter_curves_other.end(); temp_it ++ ){ + mid_layer_closing_curves.push_back( * temp_it ); + } + + //将用于生成新环的小环的指针储存下来 + //找寻空环的儿子,并储存 + multimap< list< tag_t >*, list< tag_t >* >::iterator lower_curves_pt_it; + for( lower_curves_pt_it = closing_curves_store.lower_bound( * temp_it_2 ) ; + lower_curves_pt_it != closing_curves_store.upper_bound( * temp_it_2 ) ; + lower_curves_pt_it ++ ){ + temp_holes_pt.push_back( ( * lower_curves_pt_it ).second ); + } + + continue; + } + + //进行环向删除:-4 curve2环面积大,内含 、-3 curve2环面积大,内切 、 -1 重合 + if( sign_ask_position == -4 || sign_ask_position == -3 || sign_ask_position == -1 ){ + //删除1环中曲线 + list< tag_t >::iterator temp_it; + for( temp_it = ( * temp_it_1 ).begin(); + temp_it != ( * temp_it_1 ).end(); temp_it ++ ){ + UF_OBJ_delete_object( * temp_it ); + } + + //清除一种曲线,由于迭代器不好处理,最好先将环链表清除,以证明没有曲线 + ( * temp_it_1 ).clear(); + + //将2环中的曲线,与主环的指针连接 + closing_curves_store.insert + ( pair< list< tag_t > * , list< tag_t > * > + ( * ( layer_closing_curves.begin() ), * temp_it_2 ) ); + + continue; + } + //return -1;//异常抛出 + } + } + + //清除两链表中空的曲线 + list< list< tag_t > >::iterator temp_it_2_; + + for( + temp_it_1 = mid_layer_closing_curves.begin(); + temp_it_1 != mid_layer_closing_curves.end(); temp_it_1 ++ ){ + if( ( * temp_it_1 ).size() == 0 ){ + temp_it_2_ = temp_it_1; + temp_it_2_ ++; + mid_layer_closing_curves.erase( temp_it_1, temp_it_2_ ); + } + } + + list< list< tag_t > * >::iterator temp_it_1_; + + for( + temp_it_1_ = island_closing_curves.begin(); + temp_it_1_ != island_closing_curves.end(); temp_it_1_ ++ ){ + if( ( * temp_it_1_ ) -> size() == 0 ){ + temp_it_2 = temp_it_1_; + temp_it_2 ++; + island_closing_curves.erase( temp_it_1_, temp_it_2 ); + } + } + + //将环向曲线进行分类 + vector< list< list< tag_t > * > > temp_mid_layer_closing_curves + ( mid_layer_closing_curves.size() ); + int i = 0; + + for( + temp_it_1 = mid_layer_closing_curves.begin(); + temp_it_1 != mid_layer_closing_curves.end(); temp_it_1 ++ ){ + + //进行主环放置 + closing_curves_store_list.push_back( * temp_it_1 ); + + temp_mid_layer_closing_curves[i].push_back + ( &( * ( -- ( closing_curves_store_list.end() ) ) ) ); + + closing_curves_store.insert( + pair< list< tag_t > *, list< tag_t > * > ( + * ( layer_closing_curves.begin() ), + &( * ( -- ( closing_curves_store_list.end() ) ) ) + ) + ); + + for( + temp_it_2 = island_closing_curves.begin(); + temp_it_2 != island_closing_curves.end(); temp_it_2 ++ ){ + if( ( * temp_it_2 )->size() == 0 ){ + continue; + } + + if( ask_position_along_two_curves ( * temp_it_1, *( * temp_it_2 ) ) != 4 ){ + continue; + } + + temp_mid_layer_closing_curves[i].push_back( * temp_it_2 ); + } + + i ++; + } + + //将已经被处理过的它交环进行辅助找父环并进行储存指针对操作 + //list< list< tag_t > * > temp_holes_pt + //vector< list< list< tag_t > * > > temp_mid_layer_closing_curves + //现在所有被处理过的环的子环储存在list< list< tag_t > * > temp_holes_pt中 + //所有大环储存在temp_mid_layer_closing_curves的第一个指针中 + //目的为:以小孔为纲,进行1.1offset_distance距离的大偏置 + //找到与其相交的最大面积的环,然后储存指针对 + //multimap< list< tag_t >*, list< tag_t >* > & closing_curves_store + for( list< list< tag_t > * >::iterator temp_it = temp_holes_pt.begin(); + temp_it != temp_holes_pt.end(); temp_it ++ ){ + + //定义数据 + double temp_max_area = 0; + list< tag_t > * temp_father_curves_pt = NULL; + list< tag_t > temp_big_hole;//1.1偏置 + + //进行偏置(1.1 offset_distance) + creat_offset_curve_big + ( * ( * temp_it ) , 1.1 * offset_distance, temp_big_hole ); + + for( int i = 0; i < temp_mid_layer_closing_curves.size(); i ++ ){ + int sign_position = ask_position_along_two_curves + ( * ( *( temp_mid_layer_closing_curves[i].begin() ) ), temp_big_hole ); + + if( sign_position == 2 ){ + double temp_area = ask_area_along_closing_curves + ( * ( *( temp_mid_layer_closing_curves[i].begin() ) ) ); + + if( temp_max_area < temp_area ){ + temp_max_area = temp_area; + temp_father_curves_pt = *( temp_mid_layer_closing_curves[i].begin() ); + } + } + } + + for( list< tag_t >::iterator temp_it = temp_big_hole.begin(); + temp_it != temp_big_hole.end(); temp_it ++ ){ + UF_OBJ_delete_object( * temp_it ); + } + + closing_curves_store.insert + ( pair< list< tag_t > *, list< tag_t > * > ( temp_father_curves_pt, * temp_it ) ); + + //char msg[64]; + //UF_UI_open_listing_window(); + + //sprintf( msg, " < %d , %d > \n", temp_father_curves_pt, * temp_it ); + //UF_UI_write_listing_window( msg ); + //uc1601( "1", 1 ); + + } + + //分好环的曲线环,进行递归操作 + for (int i = 0; i < temp_mid_layer_closing_curves.size(); i++){ + + //启动循环,进行下一步偏置 + creat_mid_closing_curves + ( temp_mid_layer_closing_curves[i], + offset_distance, + closing_curves_store_list, + closing_curves_store ); + + } + } + + return 1; +} + +int AQ_creat_curves_along_body::delete_all_closing_curves + ( list< list< tag_t > > & Sum_closing_curves_store_list ){ + + for ( list< list< tag_t > >::iterator temp_it1 = Sum_closing_curves_store_list.begin(); + temp_it1 != Sum_closing_curves_store_list.end(); temp_it1 ++ ){ + for ( list< tag_t >::iterator temp_it2 = ( * temp_it1 ).begin(); + temp_it2 != ( * temp_it1 ).end(); temp_it2 ++ ){ + if( * temp_it2 != NULL_TAG ) + UF_OBJ_delete_object( * temp_it2 ); + } + } + + return 1; +} + +//小面积方向偏置 +int AQ_creat_curves_along_body::creat_offset_curve_small + ( list &input_curves, double distance, + vector< list< list< tag_t > > > &store_inter_curves ){ + +//创建拉伸 + //创建链表 + uf_list_t *objectslsit = NULL; + UF_MODL_create_list ( &objectslsit ); + for ( list::iterator temp_it = input_curves.begin(); + temp_it != input_curves.end(); temp_it ++){ + UF_MODL_put_list_item ( objectslsit, *temp_it ); + } + + //定义参数 + char *taper_angle = "0"; + char *limit[2] = {"-0.5","0.5"}; + double point[3] = {0.0,0.0,0.0}; + double direction[3] = {0.0,0.0,1.0}; + UF_FEATURE_SIGN sign = UF_NULLSIGN; + uf_list_t * Features = NULL; + + UF_MODL_create_extruded2 ( objectslsit, taper_angle, limit, point, direction, sign, &Features); + +//特征找体 + tag_t feature_obj_id; + tag_t body_obj_id; + + UF_MODL_ask_list_item ( Features, 0, &feature_obj_id ); + UF_MODL_ask_feat_body( feature_obj_id, &body_obj_id ); + +//删除链表 + UF_MODL_delete_list ( &objectslsit ); + UF_MODL_delete_list ( &Features ); + +//创建抽壳 + //特征找面 + uf_list_p_t faceList; + uf_list_p_t faceList_temp; + UF_MODL_create_list( &faceList_temp ); + + int listcount = 0; + UF_MODL_ask_feat_faces( feature_obj_id, &faceList ); + UF_MODL_ask_list_count( faceList, &listcount ); + + tag_t faceTag = NULL_TAG; + tag_t deleteFaceTag = NULL_TAG; + + //设定面的参数 + int type; + double point_o [ 3 ]; + double dir [ 3 ]; + double box [ 6 ]; + double radius; + double rad_data; + int norm_dir ; + + for (int i = 0; i < listcount; ++i){ + //获取TAG + UF_MODL_ask_list_item( faceList, i, &faceTag ); + UF_MODL_ask_face_data + ( faceTag, &type, point_o, dir, box , & radius, & rad_data, & norm_dir ); + if( type == 22 + && fabs( dir[2] ) >= 0.9 + && fabs( dir[1] ) <= 0.1 + && fabs( dir[0] ) <= 0.1 ){ + UF_MODL_put_list_item( faceList_temp, faceTag ); + } + } + UF_MODL_delete_list( &faceList ); + +//text_Code + + //抽壳 + tag_t hollowFeatureTag = NULL_TAG; + char thick[64]; + + for (int i = 0; i < 2 && hollowFeatureTag == NULL_TAG; i++){ + sprintf( thick, "%f", distance + ( i * 0.01 ) ); + UF_MODL_create_hollow( thick, faceList_temp, &hollowFeatureTag ); + } + + if( hollowFeatureTag == NULL_TAG ){ + //抽壳失败 + UF_OBJ_delete_object( body_obj_id ); + UF_DISP_refresh(); + + return 0; + } + UF_MODL_delete_list( &faceList_temp ); + +//体交面得线 + //获取Z的值 + double outputpoint [3]; + ask_curve_point_along_parm + ( *( input_curves.begin() ), 0, outputpoint ); + + //创建平面 + tag_t plane_tag = NULL_TAG; + creat_plane_along_Zcoor( outputpoint[2], &plane_tag ); + + //特征找体 + tag_t hollow_body_TAG = NULL_TAG; + UF_MODL_ask_feat_body( hollowFeatureTag, &hollow_body_TAG ); + + //进行交线求解 + list< tag_t > curves_TAG; + ask_inter_curves_along_body_plane + ( hollow_body_TAG, plane_tag, curves_TAG ); + +//进行环的提取 + store_inter_curves.resize( 1 ); + store_inter_curves[0].push_back( curves_TAG ); + + //首次提环 + edit_infor_inter_curves( store_inter_curves ); + + //删除最大环对应的曲线TAG + for( list< tag_t >::iterator temp_it = ( * ( ( store_inter_curves[0] ).begin() ) ).begin(); + temp_it != ( * ( ( store_inter_curves[0] ).begin() ) ).end(); temp_it ++ ){ + + UF_OBJ_delete_object( * temp_it ); + } + store_inter_curves[0].pop_front(); + +//删除拉伸、抽壳特征 + UF_OBJ_delete_object( plane_tag ); + UF_OBJ_delete_object( hollow_body_TAG ); + //UF_MODL_delete_feature( Features ); + +//更新显示 + UF_DISP_refresh(); + + return 1; +} + +int AQ_creat_curves_along_body::creat_offset_curve_big + ( list &input_curves, double offset_distance, list &output_curves ){ +//对于偏置之后产生多环现象,暂时不予处理,就先完成最简单的偏置功能 + output_curves.clear(); + int number = (int)input_curves.size(); + + //生成tag集链表 + UF_STRING_t string_list1;//定义链表 + UF_MODL_init_string_list(&string_list1);//初始化链表 + UF_MODL_create_string_list(1, number, &string_list1);//分配链表空间,将来释放1 + string_list1.num = 1;//截面数量 + string_list1.string[0] = number;//曲线的数量,建立6边形是不是按照一个曲线算的,这个没有验证,疑问1 + + list< tag_t > ::iterator temp_it = input_curves.begin(); + for (int i = 0; i < number; i++ ){//获取inputcurves的tag + string_list1.id[i] = * temp_it; + temp_it ++ ; + } + + //将来用算法处理 + string_list1.dir[0] = UF_MODL_CURVE_START_FROM_BEGIN;//将来变方向,UF_MODL_CURVE_START_FROM_END. + + + UF_CURVE_offset_data_t offset_data_pointer; + offset_data_pointer.input_curves = &string_list1; + offset_data_pointer.approximation_tolerance = 1.0;//控制偏移曲线精度 + offset_data_pointer.string_tolerance = 0.05;//距离公差,以确定两条曲线是否足够接近,可以认为是连续的 + offset_data_pointer.offset_type = UF_CURVE_OFFSET_DISTANCE_TANGENT;//相切延伸 + + //距离 + char distance_string[64] = {0}; + sprintf( distance_string, "%f", offset_distance ); + + UF_CURVE_offset_distance_tangent_data_t distance_type2;//弄offset_type这个参数,设置偏置种类以及距离的 + offset_data_pointer.offset_def.distance_type2 = &distance_type2; + distance_type2.distance = distance_string;//偏置距离 + + tag_t offset_curve_object; + UF_CURVE_create_offset_object(&offset_data_pointer, &offset_curve_object);//创建偏置 + +//输出tags + //获取tags + int num_curves = 0; + tag_t *offset_curves = NULL; + int sign_ask_offset_curves = UF_CURVE_ask_offset_curves + ( offset_curve_object, &num_curves, &offset_curves ); + + //分配地址并转移 + tag_t temp_curve_TAG = NULL_TAG; + for ( int i = 0; i < num_curves; i++ ){ + copy_obj( offset_curves[i], &temp_curve_TAG ); + output_curves.push_back( temp_curve_TAG ); + } + +//比较面积是否变大 + + //获取偏置前曲线面积 + double first_area_along_curves = ask_area_along_closing_curves( input_curves ); + double second_area_along_curves = ask_area_along_closing_curves( output_curves ); + + //判定面积是否变小 + if( first_area_along_curves < second_area_along_curves ){//面积变大 + //释放内存 + if( num_curves > 0 ) + UF_free(offset_curves); + + //删除特征,不知道曲线会不会被删除,不行的话将来就得先复制一份 + int sign_delete_obj = UF_OBJ_delete_object( offset_curve_object ); + //更新显示 + int sign_regenerate_display = UF_DISP_regenerate_display(); + } + + else{//面积变小,变换方向 + + //删除之前复制的tag,与偏置特征 + if( num_curves > 0 ) + UF_free(offset_curves); + + for ( list< tag_t >::iterator temp_it = output_curves.begin(); + temp_it != output_curves.end(); temp_it ++ ){ + UF_OBJ_delete_object( * temp_it ); + } + UF_OBJ_delete_object(offset_curve_object); + + //变换方向,并重新创建 + sprintf( distance_string, "%f", (-1) * offset_distance ); + distance_type2.distance = distance_string;//偏置距离 + UF_CURVE_create_offset_object( &offset_data_pointer, &offset_curve_object );//创建偏置 + + //输出tags + //获取tags + //int num_curves = 0; + //tag_t *offset_curves = NULL; + sign_ask_offset_curves = UF_CURVE_ask_offset_curves + (offset_curve_object, &num_curves, &offset_curves ); + + //重新,分配地址并转移 + output_curves.clear(); + + tag_t temp_curve_TAG = NULL_TAG; + for ( int i = 0; i < num_curves; i++ ){ + copy_obj( offset_curves[i], &temp_curve_TAG ); + output_curves.push_back( temp_curve_TAG ); + } + + if( num_curves > 0 ) + UF_free(offset_curves); + + //删除特征,不知道曲线会不会被删除,不行的话将来就得先复制一份 + UF_OBJ_delete_object( offset_curve_object ); + + //更新显示 + UF_DISP_regenerate_display(); + } + + return 1; +} + +//它交环处理 +int AQ_creat_curves_along_body::ask_useful_curves_along_other( + list & closing_curves1, //输入tag + list & closing_curves2, + list< list< tag_t > > &store_inter_curves ){ +//进行环的预处理 + double area1 = ask_area_along_closing_curves( closing_curves1 ); + double area2 = ask_area_along_closing_curves( closing_curves2 ); + + list text_temp_curves; + text_temp_curves.insert + ( text_temp_curves.end(), closing_curves1.begin(), closing_curves1.end() ); + text_temp_curves.insert + ( text_temp_curves.end(), closing_curves2.begin(), closing_curves2.end() ); + + double area3 = ask_area_along_closing_curves( text_temp_curves ); + + if( area3 > 0 ){//线没有相交 + if( area1 > area2 ){//第一个线在外边 + return 0; + } + if( area1 < area2 ){//已经偏进去了 + return -1; + } + } + +//创建拉伸1,找到拉伸件1的体的tag_t + //创建链表1 + uf_list_t *objectslsit1 = NULL; + UF_MODL_create_list ( &objectslsit1 ); + for ( list< tag_t >::iterator temp_it = closing_curves1.begin(); + temp_it != closing_curves1.end(); + temp_it ++ ){ + UF_MODL_put_list_item ( objectslsit1, *temp_it ); + } + + //定义参数 + char *taper_angle1 = "0"; + char *limit1[2] = {"-0.5","0.5"}; + double point1[3] = {0.0,0.0,0.0}; + double direction1[3] = {0.0,0.0,1.0}; + UF_FEATURE_SIGN sign1 = UF_NULLSIGN; + uf_list_t * Features1 = NULL; + + UF_MODL_create_extruded2 ( objectslsit1, taper_angle1, limit1, point1, direction1, sign1, &Features1 ); + +//特征找体 + tag_t feature_obj_id1; + tag_t body_obj_id1; + + UF_MODL_ask_list_item ( Features1, 0, &feature_obj_id1 ); + UF_MODL_ask_feat_body( feature_obj_id1, &body_obj_id1 ); + +//删除链表 + UF_MODL_delete_list ( &objectslsit1 ); + UF_MODL_delete_list ( &Features1 ); + +//创建拉伸2,找到拉伸件1的体的tag_t + //创建链表2 + uf_list_t *objectslsit2 = NULL; + UF_MODL_create_list ( &objectslsit2 ); + for ( list< tag_t >::iterator temp_it = closing_curves2.begin(); + temp_it != closing_curves2.end(); + temp_it ++ ){ + UF_MODL_put_list_item ( objectslsit2, *temp_it ); + } + + //定义参数 + char *taper_angle2 = "0"; + char *limit2[2] = {"-1.0","1.0"}; + double point2[3] = {0.0,0.0,0.0}; + double direction2[3] = {0.0,0.0,1.0}; + UF_FEATURE_SIGN sign2 = UF_NULLSIGN; + uf_list_t * Features2 = NULL; + + UF_MODL_create_extruded2 + ( objectslsit2, taper_angle2, limit2, point2, direction2, sign2, &Features2 ); + +//特征找体 + tag_t feature_obj_id2; + tag_t body_obj_id2; + + UF_MODL_ask_list_item ( Features2, 0, &feature_obj_id2 ); + UF_MODL_ask_feat_body( feature_obj_id2, &body_obj_id2 ); + +//删除链表 + UF_MODL_delete_list ( &objectslsit2 ); + UF_MODL_delete_list ( &Features2 ); + + int num_results = 0; + tag_t *resulting_bodies = NULL; + + int sign_subtract_bodies = UF_MODL_subtract_bodies + ( body_obj_id1, body_obj_id2, &num_results, &resulting_bodies); + + if ( num_results > 0 ){//求减成功,进行提线储存 + store_inter_curves.resize( num_results ); + + for (int i = 0; i < num_results; i++){ + //体交面得线 + //获取Z的值 + double outputpoint [3]; + ask_curve_point_along_parm + ( *( closing_curves1.begin() ), 0, outputpoint ); + + //创建平面 + tag_t plane_tag = NULL_TAG; + creat_plane_along_Zcoor( outputpoint[2], &plane_tag ); + + //进行交线求解 + list< tag_t > curves_TAG; + ask_inter_curves_along_body_plane + ( resulting_bodies[i], plane_tag, curves_TAG ); + + store_inter_curves.push_back( curves_TAG ); + + //删除体 + UF_OBJ_delete_object( resulting_bodies[i] ); + UF_OBJ_delete_object( plane_tag ); + } + + UF_free( resulting_bodies ); + + //删除原始线 + for ( list< tag_t >::iterator temp_it = closing_curves1.begin(); + temp_it != closing_curves1.end(); + temp_it ++ ){ + UF_OBJ_delete_object( * temp_it ); + } + + for ( list< tag_t >::iterator temp_it = closing_curves2.begin(); + temp_it != closing_curves2.end(); + temp_it ++ ){ + UF_OBJ_delete_object( * temp_it ); + } + } + + if( num_results == 0 ){//求交失败,重新偏置,并进行提取有效环 + //删除体 + UF_OBJ_delete_object( body_obj_id1 ); + UF_OBJ_delete_object( body_obj_id2 ); + + vector < list< list< tag_t > > > temp_store_inter_curves; + + creat_offset_curve_small + ( closing_curves1, 0.01, temp_store_inter_curves ); + + for( list< tag_t >::iterator temp_it = closing_curves1.begin(); + temp_it != closing_curves1.end() ; temp_it ++ ){ + UF_OBJ_delete_object( * temp_it ); + } + + ask_useful_curves_along_other( + * ( temp_store_inter_curves[0].begin() ), //输入tag + closing_curves2, + store_inter_curves ); + return 1; + } +} + +//相交求并环处理 +int AQ_creat_curves_along_body::edit_insert_curves + ( list & closing_curves1, list & closing_curves2 , list & output_curves ){ + + int result = ask_position_along_two_curves( closing_curves1, closing_curves2 ); + + if( result == 2 ){//曲线相交 + //创建拉伸,并进行求并操作 + //创建拉伸1,找到拉伸件1的体的tag_t + //创建链表1 + uf_list_t *objectslsit1 = NULL; + UF_MODL_create_list ( &objectslsit1 ); + for ( list< tag_t >::iterator temp_it = closing_curves1.begin(); + temp_it != closing_curves1.end(); + temp_it ++ ){ + UF_MODL_put_list_item ( objectslsit1, *temp_it ); + } + + //定义参数 + char *taper_angle1 = "0"; + char *limit1[2] = {"-0.5","0.5"}; + double point1[3] = {0.0,0.0,0.0}; + double direction1[3] = {0.0,0.0,1.0}; + UF_FEATURE_SIGN sign1 = UF_NULLSIGN; + uf_list_t * Features1 = NULL; + + UF_MODL_create_extruded2 ( objectslsit1, taper_angle1, limit1, point1, direction1, sign1, &Features1 ); + + //特征找体 + tag_t feature_obj_id1; + tag_t body_obj_id1; + + UF_MODL_ask_list_item ( Features1, 0, &feature_obj_id1 ); + UF_MODL_ask_feat_body( feature_obj_id1, &body_obj_id1 ); + + //删除链表 + UF_MODL_delete_list ( &objectslsit1 ); + UF_MODL_delete_list ( &Features1 ); + + //创建拉伸2,找到拉伸件1的体的tag_t + //创建链表2 + uf_list_t *objectslsit2 = NULL; + UF_MODL_create_list ( &objectslsit2 ); + for ( list< tag_t >::iterator temp_it = closing_curves2.begin(); + temp_it != closing_curves2.end(); + temp_it ++ ){ + UF_MODL_put_list_item ( objectslsit2, *temp_it ); + } + + //定义参数 + char *taper_angle2 = "0"; + char *limit2[2] = {"-0.5","0.5"}; + double point2[3] = {0.0,0.0,0.0}; + double direction2[3] = {0.0,0.0,1.0}; + UF_FEATURE_SIGN sign2 = UF_NULLSIGN; + uf_list_t * Features2 = NULL; + + UF_MODL_create_extruded2 + ( objectslsit2, taper_angle2, limit2, point2, direction2, sign2, &Features2 ); + + //特征找体 + tag_t feature_obj_id2; + tag_t body_obj_id2; + + UF_MODL_ask_list_item ( Features2, 0, &feature_obj_id2 ); + UF_MODL_ask_feat_body( feature_obj_id2, &body_obj_id2 ); + + //删除链表 + UF_MODL_delete_list ( &objectslsit2 ); + UF_MODL_delete_list ( &Features2 ); + + //进行求并 + UF_MODL_unite_bodies + ( body_obj_id1, body_obj_id2 ); + + //获取Z的值 + double outputpoint [3]; + ask_curve_point_along_parm + ( *( closing_curves1.begin() ), 0, outputpoint ); + + //创建平面 + tag_t plane_tag = NULL_TAG; + creat_plane_along_Zcoor( outputpoint[2], &plane_tag ); + + //进行交线求解 + //list< tag_t > curves_TAG; + output_curves.clear(); + + ask_inter_curves_along_body_plane + ( body_obj_id1, plane_tag, output_curves ); + + UF_OBJ_delete_object( body_obj_id1 ); + UF_OBJ_delete_object( body_obj_id2 ); + UF_OBJ_delete_object( plane_tag ); + + for( list< tag_t >::iterator temp_it = closing_curves1.begin(); + temp_it != closing_curves1.end(); temp_it ++ ){ + UF_OBJ_delete_object( * temp_it ); + } + + for( list< tag_t >::iterator temp_it = closing_curves2.begin(); + temp_it != closing_curves2.end(); temp_it ++ ){ + UF_OBJ_delete_object( * temp_it ); + } + closing_curves1.clear(); + closing_curves2.clear(); + + return 1; + } + + else if( result == 1 ){//外切 + //将closing_curves2向外偏置0.01mm + list< tag_t > temp_closing_curves2; + creat_offset_curve_big + ( closing_curves2, 0.01, temp_closing_curves2 ); + + for( list< tag_t >::iterator temp_it = closing_curves2.begin(); + temp_it != closing_curves2.end(); temp_it ++ ){ + UF_OBJ_delete_object( * temp_it ); + } + + closing_curves2.clear(); + closing_curves2.insert( closing_curves2.end(), + temp_closing_curves2.begin(), temp_closing_curves2.end() ); + + temp_closing_curves2.clear(); + + edit_insert_curves + ( closing_curves1, closing_curves2 , output_curves ); + + return 2; + } + + else{ + return 0; + } + +} + +/* +-2:异常 +-1:重合 +0:相离 +1:外切 +2:相交 +3:内切 +-3:curve2环面积大,内切 +4:内含 +-4:curve2环面积大,内含 +*/ +int AQ_creat_curves_along_body::ask_position_along_two_curves + ( list & closing_curves1, list & closing_curves2 ){ + + //利用截面环形成面积,判断内含 + double area1 = ask_area_along_closing_curves( closing_curves1 ); + double area2 = ask_area_along_closing_curves( closing_curves2 ); + + list text_temp_curves; + text_temp_curves.insert + ( text_temp_curves.end(), closing_curves1.begin(), closing_curves1.end() ); + text_temp_curves.insert + ( text_temp_curves.end(), closing_curves2.begin(), closing_curves2.end() ); + + double area3 = ask_area_along_closing_curves( text_temp_curves ); + + if( area3 > 0 ){//线内含 + if( area1 > area2 ){//第一个线在外边 + return 4; + } + if( area1 < area2 ){//已经偏进去了 + return -4; + } + } + + //创建拉伸,并进行求交操作 +//创建拉伸1,找到拉伸件1的体的tag_t + //创建链表1 + uf_list_t *objectslsit1 = NULL; + UF_MODL_create_list ( &objectslsit1 ); + for ( list< tag_t >::iterator temp_it = closing_curves1.begin(); + temp_it != closing_curves1.end(); + temp_it ++ ){ + UF_MODL_put_list_item ( objectslsit1, *temp_it ); + } + + //定义参数 + char *taper_angle1 = "0"; + char *limit1[2] = {"-0.5","0.5"}; + double point1[3] = {0.0,0.0,0.0}; + double direction1[3] = {0.0,0.0,1.0}; + UF_FEATURE_SIGN sign1 = UF_NULLSIGN; + uf_list_t * Features1 = NULL; + + UF_MODL_create_extruded2 ( objectslsit1, taper_angle1, limit1, point1, direction1, sign1, &Features1 ); + +//特征找体 + tag_t feature_obj_id1; + tag_t body_obj_id1; + + UF_MODL_ask_list_item ( Features1, 0, &feature_obj_id1 ); + UF_MODL_ask_feat_body( feature_obj_id1, &body_obj_id1 ); + +//删除链表 + UF_MODL_delete_list ( &objectslsit1 ); + UF_MODL_delete_list ( &Features1 ); + +//创建拉伸2,找到拉伸件1的体的tag_t + //创建链表2 + uf_list_t *objectslsit2 = NULL; + UF_MODL_create_list ( &objectslsit2 ); + for ( list< tag_t >::iterator temp_it = closing_curves2.begin(); + temp_it != closing_curves2.end(); + temp_it ++ ){ + UF_MODL_put_list_item ( objectslsit2, *temp_it ); + } + + //定义参数 + char *taper_angle2 = "0"; + char *limit2[2] = {"-0.5","0.5"}; + double point2[3] = {0.0,0.0,0.0}; + double direction2[3] = {0.0,0.0,1.0}; + UF_FEATURE_SIGN sign2 = UF_NULLSIGN; + uf_list_t * Features2 = NULL; + + UF_MODL_create_extruded2 + ( objectslsit2, taper_angle2, limit2, point2, direction2, sign2, &Features2 ); + +//特征找体 + tag_t feature_obj_id2; + tag_t body_obj_id2; + + UF_MODL_ask_list_item ( Features2, 0, &feature_obj_id2 ); + UF_MODL_ask_feat_body( feature_obj_id2, &body_obj_id2 ); + +//删除链表 + UF_MODL_delete_list ( &objectslsit2 ); + UF_MODL_delete_list ( &Features2 ); + + int num_intersect_results = 0; + tag_t *resulting_intersect_bodies = NULL; + + int sign_intersect_bodies = UF_MODL_intersect_bodies + ( body_obj_id1, body_obj_id2, &num_intersect_results, &resulting_intersect_bodies); + + if( num_intersect_results == 0 ){//没有交集,分离或外切 + + //并集排除 + int sign_unite_bodies = UF_MODL_unite_bodies + ( body_obj_id1, body_obj_id2 ); + + UF_OBJ_delete_object( body_obj_id1 ); + UF_OBJ_delete_object( body_obj_id2 ); + + if( sign_unite_bodies == 0 ){//求并成功,外切中的一种 + return 1; + } + + //曲线求交排除 + int num_intersections = 0; + double* point_date = NULL; + + for( list< tag_t >::iterator temp_it1 = closing_curves1.begin(); + temp_it1 != closing_curves1.end(); temp_it1 ++ ){ + for( list< tag_t >::iterator temp_it2 = closing_curves2.begin(); + temp_it2 != closing_curves2.end(); temp_it2 ++ ){ + + UF_MODL_intersect_curve_to_curve + ( *temp_it1, *temp_it2, &num_intersections, &point_date ); + if( num_intersections > 0 ){ + UF_free( point_date ); + return 1; + } + } + } + + //剩下即为相离 + return 0; + + } + + +//-1:重合 +//2:相交 +//3:内切 +//-3:curve2环面积大,内切 + + //求各个相交体的截面积 + double sum_area_along_other_body = 0; + list curves_TAG; + tag_t plane_TAG = NULL_TAG; + + double point[3]; + ask_curve_point_along_parm( *( closing_curves1.begin() ), 0, point ); + creat_plane_along_Zcoor( point[2], &plane_TAG ); + + for (int i = 0; i < num_intersect_results; i ++){ + //curves_TAG.clear(); + + ask_inter_curves_along_body_plane + ( resulting_intersect_bodies[i], plane_TAG, curves_TAG ); + sum_area_along_other_body += ask_area_along_closing_curves( curves_TAG ); + + UF_OBJ_delete_object( resulting_intersect_bodies[i] ); + for ( list< tag_t >::iterator temp_it = curves_TAG.begin(); + temp_it != curves_TAG.end(); temp_it ++ ){ + UF_OBJ_delete_object( * temp_it ); + } + } + + UF_OBJ_delete_object( plane_TAG ); + if( area1 > 0.99 * area2 && area1 < 1.01 * area2 ){ + if( area1 > 0.98 * sum_area_along_other_body && area1 < 1.02 * sum_area_along_other_body ){ + return -1; + } + if( area2 > sum_area_along_other_body ){ + return 2; + } + } + if( area1 > area2 ){ + if( area2 > sum_area_along_other_body ){ + return 2; + } + if( area2 == sum_area_along_other_body ){ + return 3; + } + } + if( area2 > area1 ){ + if( area1 > sum_area_along_other_body ){ + return 2; + } + if( area1 == sum_area_along_other_body ){ + return -3; + } + } + //抛出异常 + return -2; +} + +//把线打断为开环的线 +int AQ_creat_curves_along_body::ask_right_curves + ( tag_t curve_TAG, list *output_curves_list ){ + + //排错 + if( curve_TAG == NULL_TAG ){ + return 0; + } + + //开线,入链表 + if( is_curve_open( curve_TAG ) ){ + output_curves_list -> push_back(curve_TAG); + + return 1; + } + + else{ + tag_t another_curve_TAG; + double mid_point[3]; + int sign_ask_point = ask_curve_point_along_parm( curve_TAG, 0.5, mid_point ); + + int sign_edit_curve = edit_cute_curve_along_point_length + ( curve_TAG, mid_point, 0, &another_curve_TAG); + + ask_right_curves( curve_TAG, output_curves_list ); + ask_right_curves( another_curve_TAG, output_curves_list ); + } +} + +int AQ_creat_curves_along_body::is_curve_open(tag_t curve_TAG){ + //排错,没有线 + if(curve_TAG == NULL_TAG){ + return -1; + } + +//求线两端点 + double start_point[3] = { 0 }; + double end_point[3] = { 0 } ; + int sign_ask_point = ask_curve_point_along_parm( curve_TAG, 0, start_point ); + sign_ask_point = ask_curve_point_along_parm( curve_TAG, 1, end_point ); + +//闭环线,建模公差内起点重点重合 + if( point_distance(start_point, end_point) < 0.01 ){ + return 0; + } +//开环线 + //获取线的种类 + int curve_type ; + int curve_subtype ; + UF_OBJ_ask_type_and_subtype( curve_TAG, &curve_type, &curve_subtype); + if( curve_type != UF_spline_type ){//开线非样条一定没有问题 + return 1; + } + + //样条线 + else{ + logical is_self_intersecting ; + int sign_is_close = UF_CURVE_is_spline_self_int( curve_TAG, &is_self_intersecting ); + return (-1) * ( is_self_intersecting - 1 ); + } +} + +//环形面积 +double AQ_creat_curves_along_body::ask_area_along_closing_curves( list< tag_t > & input_curves ){ + if( input_curves.size() == 0 ){ + return 0; + } + + //生成tag集链表 + int number = (int)input_curves.size(); + + UF_STRING_t string_list;//定义链表 + UF_MODL_init_string_list(&string_list);//初始化链表 + UF_MODL_create_string_list(1, number, &string_list);//分配链表空间,将来释放1 + string_list.num = 1;//截面数量 + string_list.string[0] = number;//曲线的数量 + + list< tag_t >::iterator temp_it = input_curves.begin(); + for (int i = 0; i < number; i++){//获取inputcurves的tag + string_list.id[i] = * temp_it; + temp_it ++; + } + + string_list.dir[0] = UF_MODL_CURVE_START_FROM_BEGIN; + + double tol [ 3 ] = {0.01, 0.01,0} ; + tag_t body_obj_TAG = NULL_TAG; + + //生成有界平面 + int sign_create_bplane = UF_MODL_create_bplane(&string_list, tol, &body_obj_TAG ); + + if(body_obj_TAG == NULL_TAG) + return -1;//曲线自交,出现异常 + + double acc_value [ 11 ] ={1}; + double mass_props [ 47 ] ; + double statistics [ 13 ] ; + + int ask_area = UF_MODL_ask_mass_props_3d + (&body_obj_TAG, 1, 2, 4, 1, 1, acc_value, mass_props, statistics); + + //删除有界平面 + int sign_delete_obj = UF_OBJ_delete_object(body_obj_TAG); + + //释放链表地址 + //UF_MODL_delete_list( &string_list); + + //返回面积 + return mass_props[0]; + +} + +//多态拐角处理 +void AQ_creat_curves_along_body::edit_curves_inter + ( list< list< tag_t > > & Sum_closing_curves_store_list, + double degree, double cute_length ){ + + for ( list< list< tag_t > >::iterator + temp_it_1 = Sum_closing_curves_store_list.begin(); + temp_it_1 != Sum_closing_curves_store_list.end(); + temp_it_1 ++ ){ + if( ( * temp_it_1 ).size() ==0 ) + continue; + + list< tag_t >::iterator temp_it ; + + for ( list< tag_t >::iterator + temp_it_2 = ( * temp_it_1 ).begin() ; + temp_it_2 != ( * temp_it_1 ).end() ; temp_it_2 ++ ){ + + for ( temp_it = ( * temp_it_1 ).begin(); + temp_it != ( * temp_it_1 ).end() ; temp_it ++ ){ + + edit_curves_inter ( * temp_it_2, * temp_it, degree, cute_length ); + + } + } + } +} +tag_t AQ_creat_curves_along_body::edit_curves_inter + ( tag_t curve1, tag_t curve2, double degree, double cute_length ){ + if( curve1 == curve2 ){ + return NULL_TAG; + } + + //处理两个直线 + tag_t curves[2] = { curve1, curve2 }; + + //得到第一个交点 + double startpoint[3]; + int num_intersections = 0; + double* data = NULL; + + int sign_intersect_curve = + UF_MODL_intersect_curve_to_curve + ( curve1, curve2, &num_intersections, &data ); + + if( num_intersections > 0 ){ + for (int i = 0; i < 3; i++){ + startpoint[i] = data[i]; + } + + UF_free(data); + } + + else{//没有交点,结束 + return NULL_TAG; + } + + //处理曲线方向 + double output_points[2][3]; + double parameter = 0; + double curve_length = 0; + int direction_sign = 1; + + for( int i = 0; i < 2 ; i ++ ){ + curve_length = 0; + + UF_CURVE_ask_arc_length( curves[i], 0, 1, UF_MODL_MMETER , &curve_length ); + + curve_length /= 2; + + if( cute_length > curve_length ){ + cute_length = curve_length ; + } + + if( curve_length > 0.05 ){//控制精度,用以定位夹角 + curve_length = 0.05; + } + + direction_sign = 1; + UF_MODL_ask_point_along_curve_2 + ( startpoint, curves[i], curve_length, + direction_sign, 0.001, output_points[i], ¶meter ); + + if( parameter>1||parameter<0 ){ + direction_sign = -1; + } + + UF_MODL_ask_point_along_curve_2 + ( startpoint, curves[i], curve_length, + direction_sign, 0.001, output_points[i], ¶meter ); + + }//end for + +//求解角度,用以判断阈值 + //处理向量 + double temp_degree_cos; + for( int i = 0; i < 2; i ++ ){ + for (int j = 0; j < 3; j++){ + output_points[i][j] = output_points[i][j] - startpoint[j]; + } + }//end for + + //单位化处理 + for( int i = 0; i < 2; i ++ ){ + double temp_length = 0; + for (int j = 0; j < 3; j++){ + temp_length += output_points[i][j] * output_points[i][j]; + } + + temp_length = sqrt( temp_length ); + + for (int j = 0; j < 3; j++){ + output_points[i][j] = output_points[i][j] / temp_length; + } + + }//end for + + //求解角度的余弦值 + temp_degree_cos = 0; + for ( int i = 0; i < 3; i++ ){ + temp_degree_cos += output_points[0][i] * output_points[1][i]; + } + + //return (int) ( temp_degree_cos * 1000 ) ; + + if( temp_degree_cos < cos( degree / 180 * 3.1415926 ) ){//余弦值约大,角度越小 + return NULL_TAG;//无需操作 + } + + //打点 + double key_cut_points[2][3]; + double ref_points[2][3]; + + for (int i = 0; i < 2; i++){ + + direction_sign = 1; + + UF_MODL_ask_point_along_curve_2 + ( startpoint, curves[i], cute_length / 10, + direction_sign, 0.001, key_cut_points[i], & parameter ); + + if( parameter > 1 || parameter < 0 ){ + direction_sign = -1; + } + + UF_MODL_ask_point_along_curve_2 + ( startpoint, curves[i], cute_length, + direction_sign, 0.001, key_cut_points[i], & parameter ); + + UF_MODL_ask_point_along_curve_2 + ( startpoint, curves[i], cute_length * 0.75, + direction_sign, 0.001, ref_points[i], & parameter ); + } + + //编辑曲线 + for (int i = 0; i < 2; i++){ + tag_t temp_point = NULL_TAG; + + UF_CURVE_create_point( key_cut_points[i], & temp_point ); + + UF_CURVE_edit_trim_curve + ( curves[i], temp_point, ref_points[i], startpoint, UF_CURVE_NATURAL_SHAPE ); + + UF_OBJ_delete_object( temp_point ); + } + + //创建直线 + UF_CURVE_line_t line_date; + tag_t temp_line_TAG = NULL_TAG; + + for (int i = 0; i < 3; i++){ + line_date.start_point[i] = key_cut_points[0][i]; + line_date.end_point[i] = key_cut_points[1][i]; + } + + int sign_creat_line = UF_CURVE_create_line + ( &line_date, &temp_line_TAG ); + + //返回值 + return temp_line_TAG; + +} + +//裁剪连接准备小函数 +//编辑连接 +//层间连接 +int AQ_creat_curves_along_body::edit_layer_curves_creat_bridges + ( double R, double L, //第一层的起始过度圆环半径,及外连直线 + double ref_start_point[3], double ref_end_point[3], + vector< list< tag_t >* > & layer_first_curves_store, double cute_distance ){ + + int layer_num = 0; + +//首先处理第0层曲线 + //得到新的参考点和线段 + tag_t temp_start_curveTAG= 0; + tag_t temp_ref_curveTAG1 = 0; + tag_t temp_ref_curveTAG2 = 0; + double temp_out_start_point[3]; + double temp_out_end_point[3]; + + ask_two_ref_points + ( ref_start_point, ref_end_point, + * ( layer_first_curves_store[layer_num] ), + & temp_ref_curveTAG1, & temp_ref_curveTAG2, + temp_out_start_point, temp_out_end_point ); + + temp_start_curveTAG = temp_ref_curveTAG1; + + //将新终点创建圆弧及直线 + + //数据转移 + for (int i = 0; i < 3; i++){ + ref_start_point[i] = temp_out_start_point[i]; + ref_end_point[i] = temp_out_end_point[i]; + } + +//处理其他层 + + for( layer_num = 1; layer_num < layer_first_curves_store.size(); layer_num ++ ){ + + //得到新的参考点和线段 + ask_two_ref_points + ( ref_start_point, ref_end_point, + * layer_first_curves_store[ layer_num ], + & temp_ref_curveTAG1, & temp_ref_curveTAG2, + temp_out_start_point, temp_out_end_point ); + + //temp_start_curveTAG 于 temp_ref_curveTAG2 进行曲线桥接 + //对应ref_start_point 于 temp_out_end_point 坐标点 + tag_t curvesTAG [2] = { temp_start_curveTAG, temp_ref_curveTAG2 }; + double parm[2]; + tag_t bridge_curve; + + ask_curve_parm_along_point + ( temp_start_curveTAG, ref_start_point, parm ); + ask_curve_parm_along_point + ( temp_ref_curveTAG2, temp_out_end_point, parm + 1 ); + + create_bridge_curve_along_two_curves_points + ( UF_CURVE_TANGENT, curvesTAG, parm, & bridge_curve ); + + //当前层曲线、参考点转移 + temp_start_curveTAG = temp_ref_curveTAG1; + for (int i = 0; i < 3; i++){ + ref_start_point[i] = temp_out_start_point[i]; + ref_end_point[i] = temp_out_end_point[i]; + } + } + + return 1; +} + +int AQ_creat_curves_along_body::ask_two_ref_points + ( double ref_start_point[3], double ref_end_point[3], + list< tag_t > & curves, + tag_t * ref_curveTAG1, tag_t * ref_curveTAG2, + double out_start_point[3], double out_end_point[3] ){ + +//得到线集 + //得到最近距离 + double min_dist = 10000; + double temp_dist = 10000; + double temp_min_dist_point0[3]; + + for( list< tag_t >::iterator temp_it = curves.begin(); + temp_it != curves.end(); temp_it ++ ){ + + temp_dist = ask_min_dist_pt_curve + ( ref_start_point, * temp_it, temp_min_dist_point0 ); + + if( min_dist > temp_dist ) + min_dist = temp_dist; + } + + //处理最短距离 + if( 0.1 * min_dist > 1.1 ){ + min_dist += 1.1; + } + else{ + min_dist *= 1.1; + } + + //得到处理后最短距离对应的曲线集 + list< tag_t > temp_curves_store; + double temp_min_dist_point[3]; + + for( list< tag_t >::iterator temp_it = curves.begin(); + temp_it != curves.end(); temp_it ++ ){ + + temp_dist = ask_min_dist_pt_curve + ( ref_start_point, * temp_it, temp_min_dist_point ); + + if( temp_dist < min_dist ){ + temp_curves_store.push_back( * temp_it ); + } + } + +//在线集中找寻最好的一条 + //截取2点,同时满足在线上 & 向量夹角最小 & 长度足够,的线 + tag_t ready_curveTAG = 0; + double v1_v2 = 0; + double vector1[3]; + double vector2[3]; + + //V1 + for (int i = 0; i < 3; i++){ + vector1[i] = ref_end_point[i] - ref_start_point[i]; + v1_v2 -= ( vector1[i] * vector1[i] *100 ); + } + + //通过最佳的V2找寻最优解 + double temp_start_point[3]; + double temp_end_point[3]; + double temp_parameter; + double temp_v1_v2 = 0; + double temp_curve_length = 0; + + int sign_direction = 0; + + for( list< tag_t >::iterator temp_it = temp_curves_store.begin(); + temp_it != temp_curves_store.end(); temp_it ++ ){ + + UF_CURVE_ask_arc_length( * temp_it, 0, 1, UF_MODL_MMETER, & temp_curve_length ); + + for ( int i = -1; i < 2; i += 2 ){ + //找最近点 + ask_min_dist_pt_curve + ( ref_start_point, * temp_it, temp_start_point ); + //打点 + UF_MODL_ask_point_along_curve_2 + ( temp_start_point, * temp_it, 0.1, i, 0.001, temp_end_point, & temp_parameter ); + + //V2 + temp_v1_v2 = 0; + for (int j = 0; j < 3; j++){ + vector2[j] = temp_end_point[j] - temp_start_point[j]; + temp_v1_v2 += ( vector1[j] * vector2[j] ); + } + + if( 0 <= temp_parameter && temp_parameter <= 1 //在线上 + && temp_v1_v2 > v1_v2 //夹角较小,点乘越大 + && temp_curve_length > 1.1 ){ //长度足够 + v1_v2 = temp_v1_v2 ; + sign_direction = i; + ready_curveTAG = * temp_it; + } + } + } + +//对于新的线进行新点定位,暂时先不进行往中点偏移 + //找最近点 + ask_min_dist_pt_curve + ( ref_start_point, ready_curveTAG, temp_start_point ); + //打点 + UF_MODL_ask_point_along_curve_2 + ( temp_start_point, ready_curveTAG, 0.1, sign_direction, 0.001, + out_start_point, & temp_parameter ); + + UF_MODL_ask_point_along_curve_2 + ( temp_start_point, ready_curveTAG, 1.1, sign_direction, 0.001, + out_end_point, & temp_parameter ); + +//对应裁剪 + + //复制曲线 + ( * ref_curveTAG1 ) = ready_curveTAG; + copy_obj( ready_curveTAG, ref_curveTAG2 ); + curves.push_back( * ref_curveTAG2 ); + + //创建参考中间点 + double ref_mid_point[3]; + UF_MODL_ask_point_along_curve_2 + ( temp_start_point, ready_curveTAG, 0.6, sign_direction, 0.001, + ref_mid_point, & temp_parameter ); + + //进行曲线修剪 + double real_sta_point[3]; + double real_end_point[3]; + int parm[2] = { 0,1 }; + double parm1, parm2; + + ask_curve_parm_along_point( ready_curveTAG, out_start_point, & parm1 ); + ask_curve_parm_along_point( ready_curveTAG, out_end_point , & parm2 ); + + if( parm1 > parm2 ){//反 + parm[0] = 1; + parm[1] = 0; + } + + //求取起终点 + ask_curve_point_along_parm( ready_curveTAG, parm[0], real_sta_point ); + ask_curve_point_along_parm( ready_curveTAG, parm[1], real_end_point ); + + //编辑曲线 + tag_t out_start_pointTAG = 0; + tag_t out_end_pointTAG = 0; + + UF_CURVE_create_point( out_start_point, & out_start_pointTAG ); + UF_CURVE_create_point( out_end_point, & out_end_pointTAG ); + + UF_CURVE_edit_trim_curve + ( ready_curveTAG , out_start_pointTAG, ref_mid_point, out_start_point, UF_CURVE_NATURAL_SHAPE ); + UF_CURVE_edit_trim_curve + ( * ref_curveTAG2, out_end_pointTAG, ref_mid_point, out_end_point, UF_CURVE_NATURAL_SHAPE ); + + UF_OBJ_delete_object( out_start_pointTAG ); + UF_OBJ_delete_object( out_end_pointTAG ); + + return 1; +} + +//层内连接 +int AQ_creat_curves_along_body::edit_closing_curves_creat_bridges + ( + multimap< list< tag_t >*, list< tag_t >* >::iterator & father_it, + multimap< list< tag_t >*, list< tag_t >* > & closing_curves_store, double cute_distance ){ + + //找寻father_pt对应的首位对应的迭代器 + for( multimap< list< tag_t >*, list< tag_t >* >::iterator + temp_it = closing_curves_store.lower_bound( ( * father_it ).second ); + temp_it!= closing_curves_store.upper_bound( ( * father_it ).second ); temp_it ++ ){ + + //进行编辑 + edit_closing_curves_creat_bridges + ( temp_it, + closing_curves_store, cute_distance ); + } + + edit_curves_creat_bridge + ( * ( ( * father_it ).first ), * ( ( * father_it ).second ), cute_distance ); + + return 1; +} + +int AQ_creat_curves_along_body::edit_curves_creat_bridge + ( list< tag_t > & curves1, list< tag_t > & curves2, double cute_distance ){ + +//找寻两条线,距离,小于偏置距离 + //double curve_length, tag_t curve_TAG + //首先将曲线的长度进行排序 + multimap< double , tag_t > temp_sort_store; + pair< double , tag_t > temp_pair; + + for ( list< tag_t >::iterator temp_it = curves2.begin(); + temp_it != curves2.end(); temp_it ++ ){ + + UF_CURVE_ask_arc_length(* temp_it, 0, 1, UF_MODL_MMETER, & ( temp_pair.first ) ); + temp_pair.second = * temp_it; + + temp_sort_store.insert( temp_pair ); + } + + //按照顺序进行迭代找线 + int sign_find_two_curves = 0; + tag_t two_curves[2] = { 0, 0 }; + + list< double > temp_parm_curve_list; + double parm_curve[2][2] = { { 0, 0 }, { 0, 0 } }; + + double temp_point[3]; + double temp_parm = 0; + + for( multimap< double , tag_t >::iterator temp_it = -- temp_sort_store.end(); + temp_it != -- temp_sort_store.begin(); temp_it -- ){ + + for ( list< tag_t >::iterator temp_it1 = curves1.begin(); + temp_it1 != curves1.end(); temp_it1 ++ ){ + + double sign_is_offset = is_curves_have_off_part + ( * temp_it1, ( * temp_it ).second, cute_distance ); + + if( sign_is_offset > 0 ){ + cute_distance = sign_is_offset; + sign_find_two_curves = 1; + + two_curves[1] = ( * temp_it ).second; + two_curves[0] = * temp_it1; + } + + } + if( sign_find_two_curves == 1 ) + break; + } + + if( sign_find_two_curves == 0 ){//没有找到线 + return 0; + } + +//将曲线进行对应位置找寻 + //找到两个曲线对应段的参数 + for( int i = 0; i < 2; i ++ ){//处理第i条线 + temp_parm_curve_list.clear(); + for ( double j = 0; j < 2; j ++ ){//另一条线的参数是j + + //用2线的起终点来截取1曲线的参数 + ask_curve_point_along_parm( two_curves[ 1-i ], j, temp_point ); + + ask_min_dist_pt_curve( temp_point, two_curves[i], temp_point ); + + ask_curve_parm_along_point( two_curves[i], temp_point, & temp_parm ); + + //放置参数 + temp_parm_curve_list.push_back( j ); + temp_parm_curve_list.push_back( temp_parm ); + } + + temp_parm_curve_list.sort(); + temp_parm_curve_list.pop_back(); + temp_parm_curve_list.pop_front(); + + list< double >::iterator temp_it = temp_parm_curve_list.begin(); + for ( int j = 0; j < 2; j ++ ){ + parm_curve[i][j] = * temp_it; + temp_it ++; + } + } + + //得到裁剪距离 + double curve2_length = 0; + UF_CURVE_ask_arc_length( two_curves[1], parm_curve[1][0], parm_curve[1][1], + UF_MODL_MMETER, & curve2_length ); + + if( ( 0.8 * curve2_length ) < cute_distance ){ + cute_distance = 0.8 * curve2_length; + } + +//得到裁剪点的参数及tag + //定义存储 + double start_point2[3]; + double end_point2[3]; + double curve2_point1[3]; + double curve2_point2[3]; + + //临时变量 + double parameter; + int direction_sign = 1; + + //求2线取始末点 + ask_curve_point_along_parm( two_curves[1], 0, start_point2 ); + ask_curve_point_along_parm( two_curves[1], 1, end_point2 ); + +//取得两线裁剪中点 + double curve1_mid_point[3]; + double curve2_mid_point[3]; + + //得到裁剪中点的距离 + double dist1 = 0; + double dist2 = 0; + UF_CURVE_ask_arc_length( two_curves[1], 0, parm_curve[1][0], UF_MODL_MMETER, & dist1 ); + UF_CURVE_ask_arc_length( two_curves[1], parm_curve[1][0], parm_curve[1][1], UF_MODL_MMETER, & dist2 ); + + UF_MODL_ask_point_along_curve_2 + ( start_point2, two_curves[1], cute_distance / 2, direction_sign, 0.001, curve1_mid_point, & parameter); + + if( parameter < 0 || parameter > 1 ){ + direction_sign = -1; + } + + //得到2线的裁剪中点 + UF_MODL_ask_point_along_curve_2 + ( start_point2, two_curves[1], dist1 + dist2 / 2, + direction_sign, 0.001, curve2_mid_point, & parameter ); + + //得到1线的裁剪中点 + ask_min_dist_pt_curve + ( curve2_mid_point, two_curves[0], curve1_mid_point ); + +//得到2线对应的裁剪点 +//求取1线的两个中间点 + double start_point1 [3]; + double end_point1 [3]; + double curve1_point1 [3]; + double curve1_point2 [3]; + + double parameter1, parameter2; + + UF_MODL_ask_point_along_curve_2 + ( curve1_mid_point, two_curves[0], cute_distance / 2, + 1, 0.001, curve1_point1, & parameter1 ); + + UF_MODL_ask_point_along_curve_2 + ( curve1_mid_point, two_curves[0], cute_distance / 2, + -1, 0.001, curve1_point2, & parameter2 ); + + double parm[2] = { 0, 1 }; + + if( parameter1 > parameter2 ){ + parm[0] = 1; + parm[1] = 0; + } + + //求1线取始末点 + ask_curve_point_along_parm( two_curves[0], parm[0], start_point1 ); + ask_curve_point_along_parm( two_curves[0], parm[1], end_point1 ); + +//求取2线的两个中间点 + UF_MODL_ask_point_along_curve_2 + ( curve2_mid_point, two_curves[1], cute_distance / 2, + 1, 0.001, curve2_point1, & parameter1 ); + + UF_MODL_ask_point_along_curve_2 + ( curve2_mid_point, two_curves[1], cute_distance / 2, + -1, 0.001, curve2_point2, & parameter2 ); + + if( parameter1 > parameter2 ){ + parm[0] = 1; + parm[1] = 0; + } + else{ + parm[0] = 0; + parm[1] = 1; + } + + //求2线取始末点 + ask_curve_point_along_parm( two_curves[1], parm[0], start_point2 ); + ask_curve_point_along_parm( two_curves[1], parm[1], end_point2 ); + +//进行裁剪 + //将原曲线在链表中清除 + curves1.remove( two_curves[0] ); + curves2.remove( two_curves[1] ); + + //复制曲线 + tag_t temp_two_curves[2] = { 0, 0 }; + + for (int i = 0; i < 2; i++){ + copy_obj( two_curves[i], temp_two_curves + i ); + UF_OBJ_delete_object( two_curves[i] ); + } + for (int i = 0; i < 2; i++){ + two_curves[i] = temp_two_curves[i]; + } + + tag_t curve1_copy = 0; + copy_obj( two_curves[0], & curve1_copy ); + curves1.push_back( curve1_copy ); + curves1.push_back( two_curves[0] ); + + tag_t curve2_copy = 0; + copy_obj( two_curves[1], & curve2_copy ); + curves2.push_back( curve2_copy ); + curves2.push_back( two_curves[1] ); + + //创建截取点的tag + tag_t curve1_point1_TAG = 0; + tag_t curve1_point2_TAG = 0; + tag_t curve2_point1_TAG = 0; + tag_t curve2_point2_TAG = 0; + + UF_CURVE_create_point( curve1_point1, & curve1_point1_TAG ); + UF_CURVE_create_point( curve1_point2, & curve1_point2_TAG ); + UF_CURVE_create_point( curve2_point1, & curve2_point1_TAG ); + UF_CURVE_create_point( curve2_point2, & curve2_point2_TAG ); + + //进行曲线的截取操作 + UF_CURVE_edit_trim_curve + ( two_curves[0], curve1_point1_TAG, curve1_mid_point, start_point1, UF_CURVE_NATURAL_SHAPE ); + UF_CURVE_edit_trim_curve + ( curve1_copy, curve1_point2_TAG, curve1_mid_point, end_point1, UF_CURVE_NATURAL_SHAPE ); + UF_CURVE_edit_trim_curve + ( two_curves[1], curve2_point1_TAG, curve2_mid_point, start_point2, UF_CURVE_NATURAL_SHAPE ); + UF_CURVE_edit_trim_curve + ( curve2_copy, curve2_point2_TAG, curve2_mid_point, end_point2, UF_CURVE_NATURAL_SHAPE ); + + //删除辅助点 + UF_OBJ_delete_object( curve1_point1_TAG ); + UF_OBJ_delete_object( curve1_point2_TAG ); + UF_OBJ_delete_object( curve2_point1_TAG ); + UF_OBJ_delete_object( curve2_point2_TAG ); + +//创建桥接 + //数据对接 + tag_t four_curves_TAG[4]; + double four_parm[4]; + + if( point_distance( curve1_point1, curve2_point1 ) + <= point_distance( curve1_point1, curve2_point2 ) ){//两线参数顺 + four_curves_TAG[0] = two_curves[0];//1s + four_curves_TAG[1] = curve2_copy;//2e + four_curves_TAG[2] = two_curves[1];//2s + four_curves_TAG[3] = curve1_copy;//1e + + ask_curve_parm_along_point( four_curves_TAG[0], curve1_point1, four_parm + 0 ); + ask_curve_parm_along_point( four_curves_TAG[1], curve2_point2, four_parm + 1 ); + ask_curve_parm_along_point( four_curves_TAG[2], curve2_point1, four_parm + 2 ); + ask_curve_parm_along_point( four_curves_TAG[3], curve1_point2, four_parm + 3 ); + } + else{//两线参数反 + four_curves_TAG[0] = two_curves[0];//1s + four_curves_TAG[1] = two_curves[1];//2s + four_curves_TAG[2] = curve1_copy;//1e + four_curves_TAG[3] = curve2_copy;//2e + + ask_curve_parm_along_point( four_curves_TAG[0], curve1_point1, four_parm + 0 ); + ask_curve_parm_along_point( four_curves_TAG[1], curve2_point1, four_parm + 1 ); + ask_curve_parm_along_point( four_curves_TAG[2], curve1_point2, four_parm + 2 ); + ask_curve_parm_along_point( four_curves_TAG[3], curve2_point2, four_parm + 3 ); + } + + //创建桥接 + tag_t bridge_curves[2]; + + for( int i = 0; i < 2 ; i ++ ){ + create_bridge_curve_along_two_curves_points + ( UF_CURVE_TANGENT, four_curves_TAG + ( 2 * i ) , + four_parm + ( 2 * i ) , bridge_curves + i ); + } + + return 1; +} + +double AQ_creat_curves_along_body::is_curves_have_off_part + ( tag_t curve1, tag_t curve2, double offset_dist ){ + + tag_t T_curves[2] = { curve1, curve2 }; + +//求解去掉两端的合适距离 + double cute_dist[2] = { 0, 0 }; + + for( int i = 0; i < 2; i ++ ){ + UF_CURVE_ask_arc_length( T_curves[i], 0, 1, UF_MODL_MMETER, cute_dist + i ); + + if( ( 0.5 * cute_dist[i] ) < offset_dist ){ + //return 0; + cute_dist[i] = cute_dist[i] / 4; + } + else{ + cute_dist[i] = 0.2; + } + } + +//复制曲线并截断 + //复制曲线 + tag_t curve_copy[2] = { 0, 0 }; + + for( int i = 0; i < 2; i ++ ){ + copy_obj( T_curves[i], curve_copy + i ); + } + + double s_e_point[2][2][3]; + for (int i = 0; i < 2; i ++ ){//求起终点 + for (int j = 0; j < 2; j ++ ){ + ask_curve_point_along_parm + ( T_curves[i], j, s_e_point[i][j] ); + } + } + + tag_t another_curve_TAG; + for ( int i = 0; i < 2; i++ ){//进行截取 + for (int j = 0; j < 2; j ++ ){ + edit_cute_curve_along_point_length + ( curve_copy[i], s_e_point[i][j], cute_dist[i], & another_curve_TAG ); + } + } + +//求解2线与截后的最短距离是否在公差范围内满足 + //设置相关参数 + double guess1 [ 3 ] ; + double guess2 [ 3 ] ; + + double min_dist; + double pt_on_obj1 [ 3 ]; + double pt_on_obj2 [ 3 ]; + + //求解 + UF_MODL_ask_minimum_dist + ( curve_copy[0], curve_copy[1], + 1, guess1, + 1, guess2, + & min_dist, pt_on_obj1, pt_on_obj2 ); + + for( int i = 0; i < 2; i++ ){ + UF_OBJ_delete_object( curve_copy[i] ); + } + + if( min_dist > 1.01 * offset_dist ){//|| min_dist < 0.999 * offset_dist + return 0; + } + + //char msg[64]; + //sprintf( msg, "\n %f \n", min_dist ); + //UF_UI_write_listing_window( msg ); + + return min_dist; +} + +//点线最短距离 +double AQ_creat_curves_along_body::ask_min_dist_pt_curve + ( double point[3], tag_t curve_TAG, double min_dist_point[3] ){ + //创建点 + tag_t point_TAG = NULL_TAG; + UF_CURVE_create_point( point, & point_TAG ); + + //设置相关参数 + double guess1 [ 3 ] ; + double guess2 [ 3 ] ; + + double min_dist; + double pt_on_obj1 [ 3 ]; + double pt_on_obj2 [ 3 ]; + + //求解 + UF_MODL_ask_minimum_dist + ( point_TAG, curve_TAG, + 1, guess1, + 1, guess2, + & min_dist, pt_on_obj1, pt_on_obj2 ); + + //返回值 + for (int i = 0; i < 3; i++){ + min_dist_point[i] = pt_on_obj2[i]; + } + + //清除辅助点 + UF_OBJ_delete_object( point_TAG ); + + return min_dist; +} + +//剪切曲线 +int AQ_creat_curves_along_body::edit_cute_curve_along_point_length + ( tag_t curve_TAG, double point[3], double length, tag_t *another_curve_TAG ){ + *another_curve_TAG = NULL_TAG; + +//将点打到曲线上,得到两个边界点的参数 + int direction_sign = 1; + double output_point1[3]; + double parameter1; + int sign = UF_MODL_ask_point_along_curve_2 + (point, curve_TAG, length/2, direction_sign, 0.001, output_point1, ¶meter1);//取第一个边界点 + + direction_sign = -1; + double output_point2[3]; + double parameter2; + sign = UF_MODL_ask_point_along_curve_2 + (point, curve_TAG, length/2, direction_sign, 0.001, output_point2, ¶meter2);//取第一个边界点 + +//判定截的情况 + //参数排序顺序 + if(parameter1 > parameter2){ + double temp_parameter = parameter1; + parameter1 = parameter2; + parameter2 = temp_parameter; + double temp_point [3]; + for (int i = 0; i < 3; i++){ + temp_point[i] = output_point1[i]; + output_point1[i] = output_point2[i]; + output_point2[i] = temp_point[i]; + } + } + //裁切边界在曲线外部,不必要裁切,返回0 + if(parameter2 <= 0 || parameter1 >= 1){ + *another_curve_TAG = NULL_TAG; + return 0; + } + + //裁切包围整条曲线全部裁剪,返回-1 + if(parameter1 <= 0 && parameter2 >= 1){ + *another_curve_TAG = NULL_TAG; + int sign_delete_curve = UF_OBJ_delete_object(curve_TAG); + return -1; + } + + //裁切边界在曲线内部,需要复制曲线,进行必要裁切,返回2 + if(parameter2 < 1 && parameter1 > 0){ + //复制曲线 + int sign_copy_curve = copy_obj(curve_TAG, another_curve_TAG); + + //取得参数0-p1、p2-1的曲线 + //创建点 + tag_t point1_TAG = NULL_TAG; + int sign_creat_point = UF_CURVE_create_point + (output_point1, &point1_TAG); + tag_t point2_TAG = NULL_TAG; + sign_creat_point = UF_CURVE_create_point + (output_point2, &point2_TAG); + + //得起点终点坐标 + double startpoint[3]; + int sign_ask_curve_point = ask_curve_point_along_parm + (curve_TAG, 0, startpoint); + + double endpoint[3]; + sign_ask_curve_point = ask_curve_point_along_parm + (curve_TAG, 1, endpoint); + + //得参考点坐标 + double ref_point1[3]; + double ref_point2[3]; + if(parameter1 < parameter2){ + for (int i = 0; i < 3; i++){ + ref_point1[i] = point[i]; + ref_point2[i] = point[i]; + } + } + else{//parameter1 == parameter2 + int sign_ask_curve_ref_point1 = ask_curve_point_along_parm + (curve_TAG, parameter1/2, ref_point1); + int sign_ask_curve_ref_point2 = ask_curve_point_along_parm + (curve_TAG, (1+parameter2)/2, ref_point2); + } + + //裁剪两条线 + int sign_edit_trim1 = UF_CURVE_edit_trim_curve + (curve_TAG, point1_TAG, ref_point1, startpoint, UF_CURVE_NATURAL_SHAPE ); + int sign_edit_trim2 = UF_CURVE_edit_trim_curve + (*another_curve_TAG, point2_TAG, ref_point2, endpoint, UF_CURVE_NATURAL_SHAPE ); + + //删除辅助点 + int sign_delete_point1 = UF_OBJ_delete_object( point1_TAG ); + int sign_delete_point2 = UF_OBJ_delete_object( point2_TAG ); + + return 2; + } + + //其他情况,需要裁切一边,返回1 + if(parameter1 < 0 && parameter2 <1 && parameter2 > 0){//裁切左边 + *another_curve_TAG = NULL_TAG; + //取得参数p2-1的曲线 + tag_t point2_TAG = NULL_TAG; + int sign_creat_point = UF_CURVE_create_point + (output_point2, &point2_TAG); + + double endpoint[3]; + int sign_ask_curve_point = ask_curve_point_along_parm + (curve_TAG, 1, endpoint); + + int sign_edit_trim2 = UF_CURVE_edit_trim_curve + (curve_TAG, point2_TAG, point, endpoint, UF_CURVE_NATURAL_SHAPE ); + + int sign_delete_point = UF_OBJ_delete_object( point2_TAG );//删除辅助点 + + return 1; + } + + if(parameter2 > 1 && parameter1 <1 && parameter1 > 0){//裁切右边 + *another_curve_TAG = NULL_TAG; + //取得参数0-p1的曲线 + tag_t point1_TAG = NULL_TAG; + int sign_creat_point = UF_CURVE_create_point + (output_point1, &point1_TAG); + + double startpoint[3]; + int sign_ask_curve_point = ask_curve_point_along_parm + (curve_TAG, 0, startpoint); + + int sign_edit_trim1 = UF_CURVE_edit_trim_curve + (curve_TAG, point1_TAG, point, startpoint, UF_CURVE_NATURAL_SHAPE ); + + int sign_delete_point = UF_OBJ_delete_object( point1_TAG );//删除辅助点 + + return 1; + } + //异常,其他未被考虑到的情况 + return -2; +} + +//桥接相切曲线 +int AQ_creat_curves_along_body::create_bridge_curve_along_two_curves_points + ( int bridge_method, tag_t curve_ids [2] ,double parms [ 2 ] , tag_t * bridge_id ){ + + //定义辅助数据 + double parameter; + double P1[3]; + double P2[3]; + double P1_curve1[3]; + double P2_curve2[3]; + double P1_bridge[3]; + double P2_bridge[3]; + int direction_sign = 1; + tag_t temp_bridge_TAG = NULL_TAG; + int sign = 0; + + //参数得点 + int sign_1 = ask_curve_point_along_parm(curve_ids[0], parms[0], P1); + sign_1 = ask_curve_point_along_parm(curve_ids[1], parms[1], P2); + + //创建线头的相切曲线,用于代替曲线进行桥接 + tag_t lines_TAG[2] = {NULL_TAG, NULL_TAG}; + + int creat_tangent_line = creat_tangent_line_along_curve + (P1, curve_ids[0], 5, lines_TAG); + creat_tangent_line = creat_tangent_line_along_curve + (P2, curve_ids[1], 5, lines_TAG+1); + //得到点在直线上的参数 + double point_temp [3] = {0, 0, 0}; + int ask_curve_parm = UF_MODL_ask_curve_parm + (lines_TAG[0], P1 , parms, point_temp ); + ask_curve_parm = UF_MODL_ask_curve_parm + (lines_TAG[1], P2 , parms+1, point_temp ); + + //循环创建对象,并检验,成功返回1,曲线tag,不成功删除,最终不成功返回0 + for (int i = 0; i < 2; i++){ + for (int j = 0; j < 2; j++){ + + int reverse_tangent [2]={ i, j };//回头方向 + int sign_create_bridge = UF_CURVE_create_bridge_curve + (bridge_method, lines_TAG, parms, reverse_tangent, &temp_bridge_TAG); + + //打点p1在line1 + double dis = 0.1; + double tol = 0.001; + direction_sign = 1; + + //获取适宜的dis + double temp_dist = 0; + + for (int i = 0; i < 2; i++){ + UF_CURVE_ask_arc_length( lines_TAG[i], 0, 1, UF_MODL_MMETER, & temp_dist ); + if( dis > ( temp_dist / 2 ) ) + dis = temp_dist / 2 ; + } + + UF_CURVE_ask_arc_length( temp_bridge_TAG, 0, 1, UF_MODL_MMETER, & temp_dist ); + if( dis > ( temp_dist / 2 ) ) + dis = temp_dist / 2 ; + + //开始打点 + + UF_MODL_ask_point_along_curve_2 + (P1, lines_TAG[0], dis, direction_sign, tol, P1_curve1, ¶meter);//取第一个点 + if( parameter>1 || parameter<0 ){ + direction_sign = -1; + UF_MODL_ask_point_along_curve_2 + (P1, lines_TAG[0], dis, direction_sign, tol, P1_curve1, ¶meter); + } + + + + //打点p1在bridge曲线 + direction_sign = 1; + UF_MODL_ask_point_along_curve_2 + (P1, temp_bridge_TAG, dis, direction_sign, tol, P1_bridge, ¶meter);//取第一个点 + if(parameter>1 || parameter<0){ + direction_sign = -1; + UF_MODL_ask_point_along_curve_2 + (P1, temp_bridge_TAG, dis, direction_sign, tol, P1_bridge, ¶meter); + } + + //打点p2在line2 + direction_sign = 1; + UF_MODL_ask_point_along_curve_2 + (P2, lines_TAG[1], dis, direction_sign, tol, P2_curve2, ¶meter);//取第一个点 + if(parameter>1 || parameter<0){ + direction_sign = -1; + UF_MODL_ask_point_along_curve_2 + (P2, lines_TAG[1], dis, direction_sign, tol, P2_curve2, ¶meter); + } + + //打点p2在bridge曲线 + direction_sign = 1; + UF_MODL_ask_point_along_curve_2 + (P2, temp_bridge_TAG, dis, direction_sign, tol, P2_bridge, ¶meter);//取第一个点 + if( parameter > 1 || parameter < 0 ){ + direction_sign = -1; + UF_MODL_ask_point_along_curve_2 + ( P2, temp_bridge_TAG, dis, direction_sign, tol, P2_bridge, ¶meter ); + } + + //下面判断已经创建的bridge曲线的方向是否正确 + double sign_strat_dir = (P1_bridge[0] - P1[0])*(P1[0] - P1_curve1[0]) + +(P1_bridge[1] - P1[1])*(P1[1] - P1_curve1[1]) + +(P1_bridge[2] - P1[2])*(P1[2] - P1_curve1[2]); + + double sign_end_dir = (P2_bridge[0] - P2[0])*(P2[0] - P2_curve2[0]) + +(P2_bridge[1] - P2[1])*(P2[1] - P2_curve2[1]) + +(P2_bridge[2] - P2[2])*(P2[2] - P2_curve2[2]); + + if(sign_strat_dir > 0 && sign_end_dir > 0){//创建成功 + *bridge_id = temp_bridge_TAG; + + //删除辅助直线 + UF_OBJ_delete_object( lines_TAG[0] ); + UF_OBJ_delete_object( lines_TAG[1] ); + + return 1; + } + else{ + UF_OBJ_delete_object( temp_bridge_TAG ); + } + }//endfor_j + }//endfor_i + + return 0; +} +int AQ_creat_curves_along_body::creat_tangent_line_along_curve + (double startpoint[3], tag_t curve_TAG, double length, tag_t *line_TAG){ + //获取曲线该点得参数 + double parm = 0; + int sign_ask_curve_parm = ask_curve_parm_along_point + (curve_TAG, startpoint, &parm); + //获取改参数得切矢量 + double point [3]; + double tangent [3]; //我只关注这个信息 + double p_norm [3]; + double b_norm [3]; + double torsion; + double rad_of_cur; + + int sign_infor = UF_MODL_ask_curve_props + (curve_TAG, parm, point, tangent, p_norm, b_norm, &torsion,& rad_of_cur); + + //创建一条直线 + UF_CURVE_line_t line_date; + tag_t temp_line_TAG = NULL_TAG; + + for (int i = 0; i < 3; i++){ + line_date.start_point[i] = startpoint[i]; + line_date.end_point[i] = + startpoint[i] + length * ( tangent[i]/sqrt( pow(tangent[0],2)+pow(tangent[1],2)+pow(tangent[2],2) ) ); + } + + int sign_creat_line = UF_CURVE_create_line + (&line_date, &temp_line_TAG); + + //判断终点方向是否正确 + //1.线上取点 + double dis = 0.01; + double tol = 0.001; + int direction_sign = 1; + double parameter = 0; + double point_along_curve[3]={0,0,0}; + int sign_ask_point = UF_MODL_ask_point_along_curve_2 + (startpoint, curve_TAG, dis, direction_sign, tol, point_along_curve, ¶meter);//取第一个点 + if(parameter>1 || parameter<0){ + direction_sign = -1; + sign_ask_point = UF_MODL_ask_point_along_curve_2 + (startpoint, curve_TAG, dis, direction_sign, tol, point_along_curve, ¶meter); + } + + //判断曲线的方向是否正确 + double sign_point_dir = 0; + for (int i = 0; i < 3; i++){ + sign_point_dir += (point_along_curve[i] - startpoint[i]) + *(line_date.end_point[i] - startpoint[i]); + } + + //处理直线方向 + if(sign_point_dir > 0){ + *line_TAG = temp_line_TAG; + return 1; + } + else{ + int sign_delete_line = UF_OBJ_delete_object( temp_line_TAG ); + for (int i = 0; i < 3; i++){ + line_date.end_point[i] = + startpoint[i] - length * ( tangent[i]/sqrt( pow(tangent[0],2)+pow(tangent[1],2)+pow(tangent[2],2) ) ); + } + + sign_creat_line = UF_CURVE_create_line(&line_date, &temp_line_TAG); + + *line_TAG = temp_line_TAG; + return 1; + } + return 0; +} + +//复制对象 +int AQ_creat_curves_along_body::copy_obj(tag_t obj, tag_t *copyed_obj){ + //定义移动相关数据 + double translation [ 3 ] ={0, 0, 1};//移动向量 + double matrix [ 12 ] ; + uf5943(translation, matrix );//通过函数转变为,变换矩阵 + //下边参数uf讲的很详细 + int n_objects = 1; + int move_or_copy = 2; + int dest_layer = 0; + int trace_curves = 2;//是否要追踪曲线 + tag_t input[1];//数量根据对象的多少定吧 + input[0] = obj; + tag_t output[1]; + tag_t trace_curve_group[2]; + int status = 0; + + //第一次复制移动0,0,1 + uf5947 + (matrix, input, &n_objects, &move_or_copy, &dest_layer, + &trace_curves, output, trace_curve_group, &status ); + //if(status) + // return 0; + + //第二次移动数据准备 + translation [ 2 ] = -1;//再变换为反方向 + uf5943(translation, matrix ); + + move_or_copy = 1; + + uf5947 + (matrix, output, &n_objects, &move_or_copy, &dest_layer, + &trace_curves, copyed_obj, trace_curve_group, &status ); + if(status) + return 0; + + *copyed_obj = output[0];//返回对象的tag + + return 1; + +} + +//线上点和参数相互转换 +int AQ_creat_curves_along_body::ask_curve_point_along_parm + (tag_t curve_id, double parm, double outputpoint [3] ){ + + double tangent [ 3 ] ; + double p_norm [ 3 ] ; + double b_norm [ 3 ] ; + double torsion ; + double rad_of_cur ; + + return UF_MODL_ask_curve_props(curve_id, parm, outputpoint , tangent , p_norm , b_norm , & torsion, & rad_of_cur ); +} + +int AQ_creat_curves_along_body::ask_curve_parm_along_point + (tag_t curve_id, double point [ 3 ] , double * parm){ + double point_temp [ 3 ] = {0, 0, 0}; + return UF_MODL_ask_curve_parm(curve_id, point , parm, point_temp ); +} + +//两线相交 +int AQ_creat_curves_along_body::intersect_curve_along_curve + (tag_t curve1_TAG, tag_t curve2_TAG, vector *points_TAG ){ + int num_intersections = 0; + double* data = NULL; + + int sign_intersect_curve = + UF_MODL_intersect_curve_to_curve + (curve1_TAG, curve2_TAG, &num_intersections, &data ); + + points_TAG->resize(num_intersections+1); + + tag_t temp_point_TAG ; + int sign_create_point =0; + for (int i = 0; i < num_intersections; i++){ + //创建点 + sign_create_point = UF_CURVE_create_point(data+(5*i), &temp_point_TAG ); + (*points_TAG)[i] = temp_point_TAG; + } + + //释放内存 + UF_free(data); + + return num_intersections; +} + +//起点判断 +int AQ_creat_curves_along_body::is_start_point_along_curve + ( double*start_point, tag_t curve, double modeling_tolerance, double parameter_tolerance ){ + double parameter; + double output_points[3]; + + int sign = UF_MODL_ask_point_along_curve_2 + (start_point, curve, 0, 1, 0.001, output_points, ¶meter); + return + (int)(point_distance(start_point, output_points) <= modeling_tolerance //在线上 + && + ( fabs(parameter) &direction, + ExPolygon expolygon, + Polylines &polylines_out) override; + + coord_t _min_spacing; + coord_t _line_spacing; + // distance threshold for allowing the horizontal infill lines to be connected into a continuous path + coord_t _diagonal_distance; + // only for line infill + coord_t _line_oscillation; + + Line _line(int i, coord_t x, coord_t y_min, coord_t y_max) const { + coord_t osc = (i & 1) ? this->_line_oscillation : 0; + return Line(Point(x - osc, y_min), Point(x + osc, y_max)); + } + + bool _can_connect(coord_t dist_X, coord_t dist_Y) + { + const auto TOLERANCE = coord_t(10 * SCALED_EPSILON); + return (dist_X >= (this->_line_spacing - this->_line_oscillation) - TOLERANCE) + && (dist_X <= (this->_line_spacing + this->_line_oscillation) + TOLERANCE) + && (dist_Y <= this->_diagonal_distance); + } +}; + +}; // namespace Slic3r + +#endif // slic3r_FillLine_hpp_ diff --git a/libslic3r/GCode.cpp b/libslic3r/GCode.cpp index f19ae16..d9451c2 100644 --- a/libslic3r/GCode.cpp +++ b/libslic3r/GCode.cpp @@ -4103,7 +4103,7 @@ double GCode::get_path_speed(const ExtrusionPath &path) // cap speed with max_volumetric_speed anyway (even if user is not using autospeed) speed = std::min(speed, extrude_speed); } - + //speed = m_config.get_abs_value("default_print_speed"); return speed; } @@ -4113,10 +4113,15 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou // next copies (if any) would not detect the correct orientation // extrude all loops ccw + //获取一份副本;否则,不要修改原始循环对象的方向 + //下一个副本(如果有的话)无法检测到正确的方向 + //挤出所有循环ccw bool was_clockwise = loop.make_counter_clockwise(); bool is_hole = loop.loop_role() == elrPerimeterHole; // find the point of the loop that is closest to the current extruder position // or randomize if requested + //找到最接近当前挤出机位置的环路点 + //或根据要求随机化 Point last_pos = this->last_pos(); if (!m_config.spiral_mode && description == "perimeter") { assert(m_layer != nullptr); @@ -4127,6 +4132,7 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou const auto seam_scarf_type = m_config.seam_slope_type.value; // BBS: not apply on fist layer, too small E has stick issue with hotend plate + //BBS:不适用于第一层,太小的E与热端板有粘连问题 bool enable_seam_slope = ((seam_scarf_type == SeamScarfType::External && !is_hole) || seam_scarf_type == SeamScarfType::All) && !m_config.spiral_mode && @@ -4136,12 +4142,16 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou if (enable_seam_slope && m_config.seam_slope_conditional.value) { //BBS: the seam has been decide, only check the seam position angle + //BBS:接缝已确定,只检查接缝位置角度 enable_seam_slope = loop.check_seam_point_angle(m_config.scarf_angle_threshold.value * M_PI / 180.0); } // clip the path to avoid the extruder to get exactly on the first point of the loop; // if polyline was shorter than the clipping distance we'd get a null polyline, so // we discard it in that case + //夹紧路径,避免挤出机精确地到达环路的第一点; + //如果折线短于剪切距离,我们将得到一条空折线,因此 + //那样的话,我们就把它扔掉了 const double seam_gap = scale_(EXTRUDER_CONFIG(nozzle_diameter)) * (m_config.seam_gap.value / 100); const double clip_length = m_enable_loop_clipping && !enable_seam_slope ? seam_gap : 0; // get paths @@ -4151,29 +4161,35 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou double small_peri_speed=-1; // apply the small perimeter speed + //应用小圆周速度 if (speed==-1 && loop.length() <= SMALL_PERIMETER_LENGTH(m_config.small_perimeter_threshold.value)) small_peri_speed = m_config.small_perimeter_speed.get_abs_value(m_config.outer_wall_speed); // extrude along the path + //沿路径拉伸 std::string gcode; bool is_small_peri=false; const auto speed_for_path = [&speed, &small_peri_speed](const ExtrusionPath &path) { // don't apply small perimeter setting for overhangs/bridges/non-perimeters + //不要对悬垂/桥梁/非周界应用小周界设置 const bool is_small_peri = is_perimeter(path.role()) && !is_bridge(path.role()) && small_peri_speed > 0 && (path.get_overhang_degree() == 0 || path.get_overhang_degree() > 5); return is_small_peri ? small_peri_speed : speed; }; //BBS: avoid overhang on conditional scarf mode + //BBS:避免有条件围巾模式的悬垂 bool slope_has_overhang = false; if (enable_seam_slope) { // Create seam slope + //创建接缝坡度 double start_slope_ratio; if (m_config.seam_slope_start_height.percent) { start_slope_ratio = m_config.seam_slope_start_height.value / 100.; } else { // Get the ratio against current layer height + //获取与当前图层高度的比率 double h = paths.front().height; start_slope_ratio = m_config.seam_slope_start_height.value / h; } @@ -4187,19 +4203,25 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou const int slope_steps = m_config.seam_slope_steps; const double slope_max_segment_length = scale_(slope_min_length / slope_steps); // BBS: check if has overhang on slope path + //BBS:检查斜坡路径上是否有悬垂物 if (m_config.seam_slope_conditional.value) slope_has_overhang = has_overhang_path_on_slope(loop.paths, slope_min_length); if (!slope_has_overhang) { // Calculate the sloped loop //BBS: should has smaller e at start to get better seam + //计算倾斜环路 + //BBS:开始时应该有较小的e,以获得更好的接缝 ExtrusionLoopSloped new_loop(paths, seam_gap, slope_min_length, slope_max_segment_length, start_slope_ratio, loop.loop_role()); //BBS: clip end and start to get better seam + //BBS:剪尾开始缝得更好 new_loop.clip_slope(seam_gap); // BBS: slowdown speed to improve seam, to be fix, cooling need to be apply correctly //new_loop.target_speed = get_path_speed(new_loop.starts.back()); //new_loop.slowdown_slope_speed(); // BBS: smooth speed of discontinuity areas + //BBS:放慢速度以改善接缝,需要修复,冷却需要正确应用 + //BBS:不连续区域的平滑速度 if (m_config.detect_overhang_wall && m_config.smooth_speed_discontinuity_area && (loop.role() == erExternalPerimeter || loop.role() == erPerimeter)) smooth_speed_discontinuity_area(new_loop.paths); // Then extrude it @@ -4208,9 +4230,11 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou } // Fix path for wipe + //修复擦拭路径 if (!new_loop.ends.empty()) { paths.clear(); // The start slope part is ignored as it overlaps with the end part + //起始坡度部分与结束部分重叠时将被忽略 paths.reserve(new_loop.paths.size() + new_loop.ends.size()); paths.insert(paths.end(), new_loop.paths.begin(), new_loop.paths.end()); paths.insert(paths.end(), new_loop.ends.begin(), new_loop.ends.end()); @@ -4224,6 +4248,7 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou if (!enable_seam_slope || slope_has_overhang) { // BBS: smooth speed of discontinuity areas + //BBS:不连续区域的平滑速度 if (m_config.detect_overhang_wall && m_config.smooth_speed_discontinuity_area && (loop.role() == erExternalPerimeter || loop.role() == erPerimeter)) smooth_speed_discontinuity_area(paths); @@ -4233,8 +4258,10 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou } //BBS: don't reset acceleration when printing first layer. During first layer, acceleration is always same value. + //BBS:打印第一层时不要重置加速。在第一层,加速度总是相同的值。 if (!this->on_first_layer()) { // reset acceleration + //重置加速度 gcode += m_writer.set_acceleration((unsigned int) (m_config.default_acceleration.value + 0.5)); if (!this->is_BBL_Printer()) gcode += m_writer.set_jerk_xy(m_config.default_jerk.value); @@ -4246,6 +4273,7 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou m_wipe.path = Polyline(); for (ExtrusionPath &path : paths) { //BBS: Don't need to save duplicated point into wipe path + //BBS:不需要将重复点保存到擦除路径中 if (!m_wipe.path.empty() && !path.empty() && m_wipe.path.last_point() == path.first_point()) m_wipe.path.append(path.polyline.points.begin() + 1, path.polyline.points.end()); @@ -4789,25 +4817,34 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, // go to first point of extrusion path //BBS: path.first_point is 2D point. But in lazy raise case, lift z is done in travel_to function. //Add m_need_change_layer_lift_z when change_layer in case of no lift if m_last_pos is equal to path.first_point() by chance + //转到挤出路径的第一点 + //BBS:path.first_point是二维点。但在懒惰提升的情况下,提升z是在travel_to函数中完成的。 + //如果m_last_pos偶然等于path.first_point(),则在没有提升的情况下,在change_layer时添加m_need_change_layer_lift_z if (!m_last_pos_defined || m_last_pos != path.first_point() || m_need_change_layer_lift_z || (sloped != nullptr && !sloped->is_flat())) { gcode += this->travel_to( path.first_point(), path.role(), "move to first " + description + " point", sloped == nullptr ? DBL_MAX : get_sloped_z(sloped->slope_begin.z_ratio) + ); + //gcode += m_writer.extrude_to_xy(this->point_to_gcode(line.b),e_per_mm * line_length,comment); m_need_change_layer_lift_z = false; } // if needed, write the gcode_label_objects_end then gcode_label_objects_start // should be already done by travel_to, but just in case + //如果需要,编写gcode_label_objects_end,然后编写gcode-label_objects/start + //应该已经通过travel-to完成了,但以防万一 m_writer.add_object_change_labels(gcode); // compensate retraction + //补偿回缩 gcode += this->unretract(); m_config.apply(m_calib_config); // adjust acceleration + //调整加速度 if (m_config.default_acceleration.value > 0) { double acceleration; if (this->on_first_layer() && m_config.initial_layer_acceleration.value > 0) { @@ -4821,6 +4858,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, } else if (m_config.outer_wall_acceleration.value > 0 //BBS: FIXME, in fact,we only need to set acceleration for outer wall. But we don't know //whether the overhang perimeter is outer or not. So using specific acceleration together. + //BBS:FIXME,事实上,我们只需要为外墙设置加速度。但我们不知道 + //无论悬垂周界是否在外部。所以一起使用特定的加速度。 && (path.role() == erExternalPerimeter || path.role() == erOverhangPerimeter)) { acceleration = m_config.outer_wall_acceleration.value; } else if (m_config.top_surface_acceleration.value > 0 && is_top_surface(path.role())) { @@ -4851,9 +4890,11 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, gcode += m_writer.set_jerk_xy(jerk); } // calculate extrusion length per distance unit + //计算每距离单位的挤出长度 auto _mm3_per_mm = path.mm3_per_mm * double(m_curr_print->calib_mode() == CalibMode::Calib_Flow_Rate ? this->config().print_flow_ratio.value : 1); // calculate extrusion length per distance unit + //计算每距离单位的挤出长度 if( path.role() == erTopSolidInfill ) _mm3_per_mm *= m_config.top_solid_infill_flow_ratio.value; else if (this->on_first_layer()) @@ -4910,6 +4951,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, } } //BBS: if not set the speed, then use the filament_max_volumetric_speed directly + //BBS:如果不设置速度,则直接使用film_max_volumetric_speed if( speed == 0 ) { if (_mm3_per_mm>0) @@ -4920,6 +4962,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, if (this->on_first_layer()) { //BBS: for solid infill of initial layer, speed can be higher as long as //wall lines have be attached + //BBS:对于初始层的固体填充,速度可以更高,只要 + //已附加墙线 if (path.role() != erBottomSurface) speed = m_config.get_abs_value("initial_layer_speed"); } @@ -4939,11 +4983,13 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, extrude_speed = EXTRUDER_CONFIG(filament_max_volumetric_speed) / _mm3_per_mm; // cap speed with max_volumetric_speed anyway (even if user is not using autospeed) + //无论如何,使用max_volumetric_speed限制速度(即使用户没有使用autospeed) speed = std::min(speed, extrude_speed); } double F = speed * 60; // convert mm/sec to mm/min // extrude arc or line + //拉伸圆弧或直线 if (m_enable_extrusion_role_markers) { if (path.role() != m_last_extrusion_role) @@ -4961,6 +5007,9 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, // adds processor tags and updates processor tracking data // PrusaMultiMaterial::Writer may generate GCodeProcessor::Height_Tag lines without updating m_last_height // so, if the last role was erWipeTower we force export of GCodeProcessor::Height_Tag lines + //添加处理器标签并更新处理器跟踪数据 + //PrusaMultiMaterial::编写器可能生成GCodeProcessor::Height_Tag行,而不更新m_last_Height + //因此,如果最后一个角色是erWipeTower,我们强制导出GCodeProcessor::Height_Tag行 bool last_was_wipe_tower = (m_last_processor_extrusion_role == erWipeTower); char buf[64]; assert(is_decimal_separator_point()); @@ -4995,6 +5044,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, if (m_enable_cooling_markers) { if (EXTRUDER_CONFIG(enable_overhang_bridge_fan)) { //BBS: Overhang_threshold_none means Overhang_threshold_1_4 and forcing cooling for all external perimeter + //BBS:Overhang_threshold _none表示Overhang_tthreshold _1_4,并强制冷却所有外部周边 int overhang_threshold = EXTRUDER_CONFIG(overhang_fan_threshold) == Overhang_threshold_none ? Overhang_threshold_none : EXTRUDER_CONFIG(overhang_fan_threshold) - 1; if ((EXTRUDER_CONFIG(overhang_fan_threshold) == Overhang_threshold_none && path.role() == erExternalPerimeter)) { @@ -5023,6 +5073,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, std::string comment = GCodeWriter::full_gcode_comment ? description : ""; //BBS: use G1 if not enable arc fitting or has no arc fitting result or in spiral_mode mode //Attention: G2 and G3 is not supported in spiral_mode mode + //BBS:如果未启用圆弧拟合或没有圆弧拟合结果或处于spiral_mode模式,则使用G1 + //注意:在spiral_mode模式下不支持G2和G3 if (!m_config.enable_arc_fitting || path.polyline.fitting_result.empty() || m_config.spiral_mode || @@ -5032,6 +5084,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, for (const Line &line : path.polyline.lines()) { const double line_length = line.length() * SCALING_FACTOR; // BBS: extursion cmd should E0 on cmd line + //BBS:扩展cmd应该在cmd行上显示E0 if (line_length < EPSILON) continue; path_length += line_length; @@ -5042,19 +5095,23 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, comment); } else { // Sloped extrusion + //倾斜挤压 auto dE = e_per_mm * line_length; auto [z_ratio, e_ratio, slope_speed] = sloped->interpolate(path_length / total_length); //FIX: cooling need to apply correctly + //修复:冷却需要正确应用 //gcode += m_writer.set_speed(slope_speed * 60, "", comment); Vec2d dest2d = this->point_to_gcode(line.b); Vec3d dest3d(dest2d(0), dest2d(1), get_sloped_z(z_ratio)); //BBS: todo, should use small e at start to get good seam + //BBS:todo,应该在开始时使用小e来获得良好的接缝 double slope_e = dE * e_ratio; gcode += m_writer.extrude_to_xyz(dest3d, slope_e); } } } else { // BBS: start to generate gcode from arc fitting data which includes line and arc + //BBS:开始从包括直线和圆弧的圆弧拟合数据生成gcode const std::vector& fitting_result = path.polyline.fitting_result; for (size_t fitting_index = 0; fitting_index < fitting_result.size(); fitting_index++) { switch (fitting_result[fitting_index].path_type) { @@ -5065,6 +5122,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, const Line line = Line(path.polyline.points[point_index - 1], path.polyline.points[point_index]); const double line_length = line.length() * SCALING_FACTOR; // BBS: extursion cmd should E0 on cmd line + //BBS:扩展cmd应该在cmd行上显示E0 if (line_length < EPSILON) continue; path_length += line_length; @@ -5080,6 +5138,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, const ArcSegment& arc = fitting_result[fitting_index].arc_data; const double arc_length = fitting_result[fitting_index].arc_data.length * SCALING_FACTOR; // BBS: extursion cmd should E0 on cmd line + //BBS:扩展cmd应该在cmd行上显示E0 if (arc_length < EPSILON) continue; const Vec2d center_offset = this->point_to_gcode(arc.center) - this->point_to_gcode(arc.start_point); @@ -5094,6 +5153,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, } default: //BBS: should never happen that a empty path_type has been stored + //BBS:不应该出现存储了空path_type的情况 assert(0); break; } @@ -5103,6 +5163,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, if (m_enable_cooling_markers) { if (EXTRUDER_CONFIG(enable_overhang_bridge_fan)) { //BBS: Overhang_threshold_none means Overhang_threshold_1_4 and forcing cooling for all external perimeter + //BBS:Overhang_threshold _none表示Overhang_tthreshold _1_4,并强制冷却所有外部周边 int overhang_threshold = EXTRUDER_CONFIG(overhang_fan_threshold) == Overhang_threshold_none ? Overhang_threshold_none : EXTRUDER_CONFIG(overhang_fan_threshold) - 1; if ((EXTRUDER_CONFIG(overhang_fan_threshold) == Overhang_threshold_none && path.role() == erExternalPerimeter)) { @@ -5156,38 +5217,52 @@ std::string GCode::_encode_label_ids_to_base64(std::vector ids) } // This method accepts &point in print coordinates. +//此方法接受打印坐标中的&point。 std::string GCode::travel_to(const Point &point, ExtrusionRole role, std::string comment, double z ) { /* Define the travel move as a line between current position and the taget point. This is expressed in print coordinates, so it will need to be translated by this->origin in order to get G-code coordinates. */ + /*将行程移动定义为当前位置和标记点之间的线。 + 这是以打印坐标表示的,因此需要转换为 + 此->原点,以获得G代码坐标*/ Polyline travel { this->last_pos(), point }; // check whether a straight travel move would need retraction + //检查直线移动是否需要缩回 LiftType lift_type = LiftType::SpiralLift; bool needs_retraction = this->needs_retraction(travel, role, lift_type); // check whether wipe could be disabled without causing visible stringing + //检查是否可以在不造成可见串接的情况下禁用擦拭 bool could_be_wipe_disabled = false; // Save state of use_external_mp_once for the case that will be needed to call twice m_avoid_crossing_perimeters.travel_to. + //为需要调用两次m_avoid_crossing_perimeters.travel_to的情况保存use_external_mp_once的状态。 const bool used_external_mp_once = m_avoid_crossing_perimeters.used_external_mp_once(); // if a retraction would be needed, try to use reduce_crossing_wall to plan a // multi-hop travel path inside the configuration space + //如果需要撤回,请尝试使用reduce_crossing_wall来计划 + //配置空间内的多跳行进路径 if (needs_retraction && m_config.reduce_crossing_wall && ! m_avoid_crossing_perimeters.disabled_once() //BBS: don't generate detour travel paths when current position is unclear + //BBS:当前位置不清楚时,不要生成绕行行驶路径 && m_writer.is_current_position_clear()) { travel = m_avoid_crossing_perimeters.travel_to(*this, point, &could_be_wipe_disabled); // check again whether the new travel path still needs a retraction + //再次检查新的行进路径是否仍需要缩回 needs_retraction = this->needs_retraction(travel, role, lift_type); //if (needs_retraction && m_layer_index > 1) exit(0); + //如果(needs_reduction&&mlayer_index>1)退出(0); } // Re-allow reduce_crossing_wall for the next travel moves + //重新允许reduce_crossing_wall用于下一次行程移动 m_avoid_crossing_perimeters.reset_once_modifiers(); // generate G-code for the travel move + //为行程生成G代码 std::string gcode; if (needs_retraction) { if (m_config.reduce_crossing_wall && could_be_wipe_disabled) @@ -5198,23 +5273,31 @@ std::string GCode::travel_to(const Point &point, ExtrusionRole role, std::string // When "Wipe while retracting" is enabled, then extruder moves to another position, and travel from this position can cross perimeters. // Because of it, it is necessary to call avoid crossing perimeters again with new starting point after calling retraction() // FIXME Lukas H.: Try to predict if this second calling of avoid crossing perimeters will be needed or not. It could save computations. + //当启用“缩回时擦拭”时,挤出机会移动到另一个位置,从这个位置开始移动可以穿过周边。 + //因此,在调用retraction()后,有必要使用新的起点再次调用避免跨越边界 + //FIXME Lukas H.:试着预测是否需要第二次呼吁避免穿越边界。它可以节省计算。 if (last_post_before_retract != this->last_pos() && m_config.reduce_crossing_wall) { // If in the previous call of m_avoid_crossing_perimeters.travel_to was use_external_mp_once set to true restore this value for next call. + //如果在上一次调用m_avoid_crossing_perimeters.travel_to时,use_external_mp_once设置为true,则在下次调用时恢复此值。 if (used_external_mp_once) m_avoid_crossing_perimeters.use_external_mp_once(); travel = m_avoid_crossing_perimeters.travel_to(*this, point); // If state of use_external_mp_once was changed reset it to right value. + //如果use_external_mp_once的状态被更改,则将其重置为正确的值。 if (used_external_mp_once) m_avoid_crossing_perimeters.reset_once_modifiers(); } } else // Reset the wipe path when traveling, so one would not wipe along an old path. + //行驶时重置擦拭路径,这样就不会沿着旧路径擦拭。 m_wipe.reset_path(); // if needed, write the gcode_label_objects_end then gcode_label_objects_start + //如果需要,编写gcode_label_objects_end,然后编写gcode-label_objects/start m_writer.add_object_change_labels(gcode); // use G1 because we rely on paths being straight (G0 may make round paths) + //使用G1,因为我们依赖于直线路径(G0可能会形成圆形路径) if (travel.size() >= 2) { // OrcaSlicer if (this->on_first_layer()) { @@ -5225,30 +5308,39 @@ std::string GCode::travel_to(const Point &point, ExtrusionRole role, std::string if (m_spiral_vase) { // No lazy z lift for spiral vase mode + //螺旋花瓶模式没有懒惰的z型升降机 for (size_t i = 1; i < travel.size(); ++i) gcode += m_writer.travel_to_xy(this->point_to_gcode(travel.points[i]), comment); } else { if (travel.size() == 2) { // No extra movements emitted by avoid_crossing_perimeters, simply move to the end point with z change + //avoid_crossing_perimeters不会发出额外的移动,只需移动到z变化的终点即可 const auto &dest2d = this->point_to_gcode(travel.points.back()); Vec3d dest3d(dest2d(0), dest2d(1), z == DBL_MAX ? m_nominal_z : z); + //zheli**************************************************************************** + //******************************************************************************* + //auto dE = m_extruder->E(); gcode += m_writer.travel_to_xyz(dest3d, comment); } else { // Extra movements emitted by avoid_crossing_perimeters, lift the z to normal height at the beginning, then apply the z // ratio at the last point + //avoid_crossing_perimeters发出的额外运动,在开始时将z提升到正常高度,然后在最后一点应用z比率 for (size_t i = 1; i < travel.size(); ++i) { if (i == 1) { // Lift to normal z at beginning + //开始时提升到正常z Vec2d dest2d = this->point_to_gcode(travel.points[i]); Vec3d dest3d(dest2d(0), dest2d(1), m_nominal_z); gcode += m_writer.travel_to_xyz(dest3d, comment); } else if (z != DBL_MAX && i == travel.size() - 1) { // Apply z_ratio for the very last point + //将z_ratio应用于最后一点 Vec2d dest2d = this->point_to_gcode(travel.points[i]); Vec3d dest3d(dest2d(0), dest2d(1), z); gcode += m_writer.travel_to_xyz(dest3d, comment); } else { // For all points in between, no z change + //对于介于两者之间的所有点,z不变 gcode += m_writer.travel_to_xy(this->point_to_gcode(travel.points[i]), comment ); } } diff --git a/libslic3r/GCodeWriter.cpp b/libslic3r/GCodeWriter.cpp index 3dcb2f0..d97b6f9 100644 --- a/libslic3r/GCodeWriter.cpp +++ b/libslic3r/GCodeWriter.cpp @@ -345,6 +345,28 @@ std::string GCodeWriter::travel_to_xy(const Vec2d &point, const std::string &com return w.string(); } +std::string GCodeWriter::travel_to_xy_test(const Vec2d& point, const std::string& comment) +{ + m_pos(0) = point(0); + m_pos(1) = point(1); + + this->set_current_position_clear(true); + //BBS: take plate offset into consider + Vec2d point_on_plate = { point(0) - m_x_offset, point(1) - m_y_offset }; + + GCodeG1Formatter w; + w.emit_xy(point_on_plate); + w.emit_f(this->config.travel_speed.value * 60.0); + //double dE = 3.6919824438491271030063717038767; + auto dE = m_extruder->E(); + if (dE > 0) { + w.emit_e(dE); + } + //BBS + w.emit_comment(GCodeWriter::full_gcode_comment, comment); + return w.string(); +} + std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &comment) { // FIXME: This function was not being used when travel_speed_z was separated (bd6badf). @@ -357,6 +379,7 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co adjust the nominal Z by reducing the lift amount that will be used for unlift. */ // BBS + /*如果目标Z低于当前Z但高于标称Z,我们不会执行Z移动,而只会在XY平面内移动,并通过减少用于未点火的升程量来调整标称Z*/ Vec3d dest_point = point; //BBS: a z_hop need to be handle when travel if (std::abs(m_to_lift) > EPSILON) { @@ -364,6 +387,8 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co //BBS: don't need to do real lift if the current position is absolutely same with target. //This ususally happens when the last extrusion line is short and the end of wipe position //is same with the traget point by chance. + //BBS:如果当前位置与目标完全相同,则不需要进行真正的提升。 + //这通常发生在最后一条挤出线较短,擦拭位置的末端偶然与托盘点相同的情况下。 if ((!this->is_current_position_clear() || m_pos != dest_point) && m_to_lift + m_pos(2) > point(2)) { m_lifted = m_to_lift + m_pos(2) - point(2); @@ -373,16 +398,20 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co std::string slop_move; //BBS: minus plate offset + //BBS:负板偏移 Vec3d source = { m_pos(0) - m_x_offset, m_pos(1) - m_y_offset, m_pos(2) }; Vec3d target = { dest_point(0) - m_x_offset, dest_point(1) - m_y_offset, dest_point(2) }; Vec3d delta = target - source; Vec2d delta_no_z = { delta(0), delta(1) }; //BBS: don'need slope travel because we don't know where is the source position the first time //BBS: Also don't need to do slope move or spiral lift if x-y distance is absolute zero + //BBS:不需要斜坡旅行,因为我们第一次不知道震源位置在哪里 + //BBS:如果x-y距离为绝对零,也不需要进行斜坡移动或螺旋升降 if (delta(2) > 0 && delta_no_z.norm() != 0.0f) { //BBS: SpiralLift if (m_to_lift_type == LiftType::SpiralLift && this->is_current_position_clear()) { //BBS: todo: check the arc move all in bed area, if not, then use lazy lift + //BBS:todo:检查床区的弧形移动,如果没有,则使用LazyLift double radius = delta(2) / (2 * PI * atan(GCodeWriter::slope_threshold)); Vec2d ij_offset = radius * delta_no_z.normalized(); ij_offset = { -ij_offset(1), ij_offset(0) }; @@ -434,19 +463,23 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co m_lifted -= (point(2) - nominal_z); // In case that z_hop == layer_height we could end up with almost zero in_m_lifted // and a retract could be skipped + //如果z_hop==layer_height,我们最终可能会得到几乎为零的In_m_leed,并且可以跳过收回操作 if (std::abs(m_lifted) < EPSILON) m_lifted = 0.; //BBS this->set_current_position_clear(true); - return this->travel_to_xy(to_2d(point)); + //return this->travel_to_xy(to_2d(point)); + return this->travel_to_xy_test(to_2d(point)); } else { /* In all the other cases, we perform an actual XYZ move and cancel the lift. */ + /*在所有其他情况下,我们执行实际的XYZ移动并取消提升*/ m_lifted = 0; } //BBS: take plate offset into consider + //BBS:考虑板材偏移 Vec3d point_on_plate = { dest_point(0) - m_x_offset, dest_point(1) - m_y_offset, dest_point(2) }; std::string out_string; GCodeG1Formatter w; diff --git a/libslic3r/GCodeWriter.hpp b/libslic3r/GCodeWriter.hpp index 26dd20c..77f4b39 100644 --- a/libslic3r/GCodeWriter.hpp +++ b/libslic3r/GCodeWriter.hpp @@ -67,6 +67,7 @@ public: std::string toolchange(unsigned int extruder_id); std::string set_speed(double F, const std::string &comment = std::string(), const std::string &cooling_marker = std::string()) const; std::string travel_to_xy(const Vec2d &point, const std::string &comment = std::string()); + std::string travel_to_xy_test(const Vec2d &point, const std::string &comment = std::string()); std::string travel_to_xyz(const Vec3d &point, const std::string &comment = std::string()); std::string travel_to_z(double z, const std::string &comment = std::string()); bool will_move_z(double z) const; diff --git a/libslic3r/PrintConfig.cpp b/libslic3r/PrintConfig.cpp index c8cfe40..395e1cf 100644 --- a/libslic3r/PrintConfig.cpp +++ b/libslic3r/PrintConfig.cpp @@ -1867,15 +1867,15 @@ void PrintConfigDef::init_fff_params() def->mode = comSimple; def->set_default_value(new ConfigOptionFloat(0.3)); - def = this->add("fibre_feed_rate", coFloat); + def = this->add("fibre_feed_rate", coFloats); def->label = L("Fibre feed rate"); def->category = L("Others"); //def->tooltip = L("The width within which to jitter. It's adversed to be below outer wall line width"); - def->sidetext = L("mm"); + //def->sidetext = L("mm"); def->min = 0; - def->max = 1; + def->max = 2; def->mode = comSimple; - def->set_default_value(new ConfigOptionFloat(0.3)); + def->set_default_value(new ConfigOptionFloats{ 1. }); def = this->add("fuzzy_skin_point_distance", coFloat); def->label = L("Fuzzy skin point distance"); diff --git a/libslic3r/PrintConfig.hpp b/libslic3r/PrintConfig.hpp index 927e6bf..132860b 100644 --- a/libslic3r/PrintConfig.hpp +++ b/libslic3r/PrintConfig.hpp @@ -895,6 +895,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionString, machine_end_gcode)) ((ConfigOptionStrings, filament_end_gcode)) ((ConfigOptionFloats, filament_flow_ratio)) + ((ConfigOptionFloats, fibre_feed_rate)) ((ConfigOptionBools, enable_pressure_advance)) ((ConfigOptionFloats, pressure_advance)) ((ConfigOptionFloats, filament_diameter)) diff --git a/libslic3r/PrintObject.cpp b/libslic3r/PrintObject.cpp index f373bc8..69e124e 100644 --- a/libslic3r/PrintObject.cpp +++ b/libslic3r/PrintObject.cpp @@ -249,6 +249,9 @@ void PrintObject::prepare_infill() // The preceding step (perimeter generator) only modifies extra_perimeters and the extra perimeters are only used by discover_vertical_shells() // with more than a single region. If this step does not use Surface::extra_perimeters or Surface::extra_perimeters is always zero, it is safe // to reset to the untyped slices before re-runnning detect_surfaces_type(). + //为了在重新切片(使用类型化切片)时提高detect_surfaces_type()的鲁棒性,请参阅GH问题#7442。 + //前面的步骤(周长生成器)仅修改extra_perimeters,并且额外的周长仅由具有多个区域的discover_vertical_shell()使用。 + //如果此步骤不使用Surface::extra_perimeters或Surface::extra_perimeter始终为零,则可以在重新运行detect_surfaces_type()之前重置为非类型切片。 for (Layer* layer : m_layers) { layer->restore_untyped_slices_no_extra_perimeters(); m_print->throw_if_canceled(); @@ -1900,6 +1903,7 @@ void PrintObject::bridge_over_infill() #else // This method applies bridge flow to the first internal solid layer above sparse infill. // This method applies bridge flow to the first internal solid layer above sparse infill. +//该方法将桥流应用于稀疏填充物上方的第一个内部固体层。 void PrintObject::bridge_over_infill() { BOOST_LOG_TRIVIAL(info) << "Bridge over infill - Start" << log_memory_info(); diff --git a/slic3r/GUI/AMSMaterialsSetting.cpp b/slic3r/GUI/AMSMaterialsSetting.cpp index 8a86f42..40d7663 100644 --- a/slic3r/GUI/AMSMaterialsSetting.cpp +++ b/slic3r/GUI/AMSMaterialsSetting.cpp @@ -44,9 +44,11 @@ void AMSMaterialsSetting::create() m_button_confirm = new Button(this, _L("Confirm")); m_btn_bg_green = StateColor(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_button_confirm->SetBackgroundColor(m_btn_bg_green); - m_button_confirm->SetBorderColor(wxColour(0, 174, 66)); + //m_button_confirm->SetBorderColor(wxColour(0, 174, 66)); + m_button_confirm->SetBorderColor(wxColour(0x9A5F21)); m_button_confirm->SetTextColor(wxColour("#FFFFFE")); m_button_confirm->SetMinSize(AMS_MATERIALS_SETTING_BUTTON_SIZE); m_button_confirm->SetCornerRadius(FromDIP(12)); @@ -147,7 +149,8 @@ void AMSMaterialsSetting::create_panel_normal(wxWindow* parent) m_sizer_filament->Add(m_comboBox_filament, 1, wxALIGN_CENTER, 0); m_readonly_filament = new TextInput(parent, wxEmptyString, "", "", wxDefaultPosition, AMS_MATERIALS_SETTING_COMBOX_WIDTH, wxTE_READONLY | wxRIGHT); - m_readonly_filament->SetBorderColor(StateColor(std::make_pair(0xDBDBDB, (int)StateColor::Focused), std::make_pair(0x00AE42, (int)StateColor::Hovered), + //m_readonly_filament->SetBorderColor(StateColor(std::make_pair(0xDBDBDB, (int)StateColor::Focused), std::make_pair(0x00AE42, (int)StateColor::Hovered), + m_readonly_filament->SetBorderColor(StateColor(std::make_pair(0xDBDBDB, (int)StateColor::Focused), std::make_pair(0x215F9A, (int)StateColor::Hovered), std::make_pair(0xDBDBDB, (int)StateColor::Normal))); m_readonly_filament->SetFont(::Label::Body_14); m_readonly_filament->SetLabelColor(AMS_MATERIALS_SETTING_GREY800); @@ -1051,7 +1054,8 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt) } else { m_button_confirm->SetBackgroundColor(m_btn_bg_green); - m_button_confirm->SetBorderColor(wxColour(0, 174, 66)); + //m_button_confirm->SetBorderColor(wxColour(0, 174, 66)); + m_button_confirm->SetBorderColor(wxColour(0x9A5F21)); m_button_confirm->SetTextColor(wxColour("#FFFFFE")); m_button_confirm->Enable(true); } diff --git a/slic3r/GUI/AmsMappingPopup.cpp b/slic3r/GUI/AmsMappingPopup.cpp index f6713d0..0b5914e 100644 --- a/slic3r/GUI/AmsMappingPopup.cpp +++ b/slic3r/GUI/AmsMappingPopup.cpp @@ -1283,7 +1283,8 @@ void AmsReplaceMaterialDialog::create() auto label_title = new Label(this, _L("Auto Refill")); label_title->SetFont(Label::Head_14); - label_title->SetForegroundColour(0x00AE42); + //label_title->SetForegroundColour(0x00AE42); + label_title->SetForegroundColour(0x9A5F21); label_txt = new Label(this, _L("When the current material run out, the printer will continue to print in the following order.")); label_txt->SetFont(Label::Body_13); label_txt->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#323A3C"))); @@ -1318,7 +1319,8 @@ void AmsReplaceMaterialDialog::create() std::pair(wxColour(38, 46, 48), StateColor::Enabled)); - StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(0, 174, 66), StateColor::Normal)); + StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_button_sizer->Add( 0, 0, 1, wxEXPAND, 0 ); m_main_sizer->Add(0,0,0, wxTOP, FromDIP(12)); diff --git a/slic3r/GUI/Auxiliary.hpp b/slic3r/GUI/Auxiliary.hpp index 731c612..470fc97 100644 --- a/slic3r/GUI/Auxiliary.hpp +++ b/slic3r/GUI/Auxiliary.hpp @@ -51,7 +51,8 @@ #define AUFILE_GREY500 wxColour(158, 158, 158) #define AUFILE_GREY300 wxColour(238, 238, 238) #define AUFILE_GREY200 wxColour(248, 248, 248) -#define AUFILE_BRAND wxColour(0, 174, 66) +//#define AUFILE_BRAND wxColour(0, 174, 66) +#define AUFILE_BRAND wxColour(0x9A5F21) #define AUFILE_BRAND_TRANSPARENT wxColour(215, 232, 222) //#define AUFILE_PICTURES_SIZE wxSize(FromDIP(300), FromDIP(300)) //#define AUFILE_PICTURES_PANEL_SIZE wxSize(FromDIP(300), FromDIP(340)) diff --git a/slic3r/GUI/BindDialog.cpp b/slic3r/GUI/BindDialog.cpp index d0d6388..f5532ae 100644 --- a/slic3r/GUI/BindDialog.cpp +++ b/slic3r/GUI/BindDialog.cpp @@ -139,7 +139,8 @@ PingCodeBindDialog::PingCodeBindDialog(Plater* plater /*= nullptr*/) StateColor btn_bg_green(std::pair(wxColour(206, 206, 206), StateColor::Disabled), std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_button_bind->SetBackgroundColor(btn_bg_green); m_button_bind->SetBorderColor(*wxWHITE); m_button_bind->SetTextColor(wxColour("#FFFFFE")); @@ -480,7 +481,8 @@ PingCodeBindDialog::~PingCodeBindDialog() { m_link_Terms_title->SetFont(Label::Head_13); m_link_Terms_title->SetMaxSize(wxSize(FromDIP(450), -1)); m_link_Terms_title->Wrap(FromDIP(450)); - m_link_Terms_title->SetForegroundColour(wxColour(0x00AE42)); + //m_link_Terms_title->SetForegroundColour(wxColour(0x00AE42)); + m_link_Terms_title->SetForegroundColour(wxColour(0x9A5F21)); m_link_Terms_title->Bind(wxEVT_LEFT_DOWN, [this](auto& e) { wxString txt = _L("Thank you for purchasing a Bambu Lab device.Before using your Bambu Lab device, please read the termsand conditions.By clicking to agree to use your Bambu Lab device, you agree to abide by the Privacy Policy and Terms of Use(collectively, the \"Terms\"). If you do not comply with or agree to the Bambu Lab Privacy Policy, please do not use Bambu Lab equipment and services."); ConfirmBeforeSendDialog confirm_dlg(this, wxID_ANY, _L("Terms and Conditions"), ConfirmBeforeSendDialog::ButtonStyle::ONLY_CONFIRM); @@ -499,7 +501,8 @@ PingCodeBindDialog::~PingCodeBindDialog() { m_link_privacy_title->SetFont(Label::Head_13); m_link_privacy_title->SetMaxSize(wxSize(FromDIP(450), -1)); m_link_privacy_title->Wrap(FromDIP(450)); - m_link_privacy_title->SetForegroundColour(wxColour(0x00AE42)); + //m_link_privacy_title->SetForegroundColour(wxColour(0x00AE42)); + m_link_privacy_title->SetForegroundColour(wxColour(0x9A5F21)); m_link_privacy_title->Bind(wxEVT_LEFT_DOWN, [this](auto& e) { std::string url; std::string country_code = Slic3r::GUI::wxGetApp().app_config->get_country_code(); @@ -539,7 +542,8 @@ PingCodeBindDialog::~PingCodeBindDialog() { m_link_notice_title->SetFont(Label::Head_13); m_link_notice_title->SetMaxSize(wxSize(FromDIP(450), -1)); m_link_notice_title->Wrap(FromDIP(450)); - m_link_notice_title->SetForegroundColour(wxColour(0x00AE42)); + //m_link_notice_title->SetForegroundColour(wxColour(0x00AE42)); + m_link_notice_title->SetForegroundColour(wxColour(0x9A5F21)); m_link_notice_title->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_HAND); }); m_link_notice_title->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_ARROW); }); m_link_notice_title->Bind(wxEVT_LEFT_DOWN, [this](auto& e) { @@ -678,7 +682,8 @@ PingCodeBindDialog::~PingCodeBindDialog() { StateColor btn_bg_green(std::pair(wxColour(206, 206, 206), StateColor::Disabled), std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_button_bind->SetBackgroundColor(btn_bg_green); m_button_bind->SetBorderColor(*wxWHITE); m_button_bind->SetTextColor(wxColour("#FFFFFE")); @@ -1032,9 +1037,11 @@ UnBindMachineDialog::UnBindMachineDialog(Plater *plater /*= nullptr*/) m_sizer_button->Add(0, 0, 1, wxEXPAND, 5); m_button_unbind = new Button(this, _L("Confirm")); StateColor btn_bg_green(std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_button_unbind->SetBackgroundColor(btn_bg_green); - m_button_unbind->SetBorderColor(wxColour(0, 174, 66)); + //m_button_unbind->SetBorderColor(wxColour(0, 174, 66)); + m_button_unbind->SetBorderColor(wxColour(0x9A5F21)); m_button_unbind->SetTextColor(wxColour("#FFFFFE")); m_button_unbind->SetSize(BIND_DIALOG_BUTTON_SIZE); m_button_unbind->SetMinSize(BIND_DIALOG_BUTTON_SIZE); diff --git a/slic3r/GUI/BonjourDialog.cpp b/slic3r/GUI/BonjourDialog.cpp index 123f456..1ac33ff 100644 --- a/slic3r/GUI/BonjourDialog.cpp +++ b/slic3r/GUI/BonjourDialog.cpp @@ -85,7 +85,8 @@ BonjourDialog::BonjourDialog(wxWindow *parent, Slic3r::PrinterTechnology tech) auto button_sizer = new wxBoxSizer(wxHORIZONTAL); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), std::pair(*wxWHITE, StateColor::Normal)); diff --git a/slic3r/GUI/CaliHistoryDialog.cpp b/slic3r/GUI/CaliHistoryDialog.cpp index 29b908d..53fd846 100644 --- a/slic3r/GUI/CaliHistoryDialog.cpp +++ b/slic3r/GUI/CaliHistoryDialog.cpp @@ -74,10 +74,12 @@ HistoryWindow::HistoryWindow(wxWindow* parent, const std::vector& Button * mew_btn = new Button(scroll_window, _L("New")); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); mew_btn->SetBackgroundColour(*wxWHITE); mew_btn->SetBackgroundColor(btn_bg_green); - mew_btn->SetBorderColor(wxColour(0, 174, 66)); + //mew_btn->SetBorderColor(wxColour(0, 174, 66)); + mew_btn->SetBorderColor(wxColour(0x9A5F21)); mew_btn->SetTextColor(wxColour("#FFFFFE")); mew_btn->SetMinSize(wxSize(FromDIP(100), FromDIP(24))); mew_btn->SetMaxSize(wxSize(FromDIP(100), FromDIP(24))); @@ -322,10 +324,12 @@ void HistoryWindow::sync_history_data() { auto edit_button = new Button(m_history_data_panel, _L("Edit")); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); edit_button->SetBackgroundColour(*wxWHITE); edit_button->SetBackgroundColor(btn_bg_green); - edit_button->SetBorderColor(wxColour(0, 174, 66)); + //edit_button->SetBorderColor(wxColour(0, 174, 66)); + edit_button->SetBorderColor(wxColour(0x9A5F21)); edit_button->SetTextColor(wxColour("#FFFFFE")); edit_button->SetMinSize(wxSize(-1, FromDIP(24))); edit_button->SetCornerRadius(FromDIP(12)); @@ -438,10 +442,12 @@ EditCalibrationHistoryDialog::EditCalibrationHistoryDialog(wxWindow* parent, con Button* save_btn = new Button(top_panel, _L("Save")); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); save_btn->SetBackgroundColour(*wxWHITE); save_btn->SetBackgroundColor(btn_bg_green); - save_btn->SetBorderColor(wxColour(0, 174, 66)); + //save_btn->SetBorderColor(wxColour(0, 174, 66)); + save_btn->SetBorderColor(wxColour(0x9A5F21)); save_btn->SetTextColor(wxColour("#FFFFFE")); save_btn->SetMinSize(wxSize(-1, FromDIP(24))); save_btn->SetCornerRadius(FromDIP(12)); @@ -653,10 +659,12 @@ NewCalibrationHistoryDialog::NewCalibrationHistoryDialog(wxWindow *parent, const auto btn_sizer = new wxBoxSizer(wxHORIZONTAL); Button * ok_btn = new Button(top_panel, _L("Ok")); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); ok_btn->SetBackgroundColour(*wxWHITE); ok_btn->SetBackgroundColor(btn_bg_green); - ok_btn->SetBorderColor(wxColour(0, 174, 66)); + //ok_btn->SetBorderColor(wxColour(0, 174, 66)); + ok_btn->SetBorderColor(wxColour(0x9A5F21)); ok_btn->SetTextColor(wxColour("#FFFFFE")); ok_btn->SetMinSize(wxSize(-1, FromDIP(24))); ok_btn->SetCornerRadius(FromDIP(12)); diff --git a/slic3r/GUI/CalibrationPanel.hpp b/slic3r/GUI/CalibrationPanel.hpp index a1c23e0..03bdf9a 100644 --- a/slic3r/GUI/CalibrationPanel.hpp +++ b/slic3r/GUI/CalibrationPanel.hpp @@ -10,7 +10,8 @@ namespace Slic3r { namespace GUI { #define SELECT_MACHINE_GREY900 wxColour(38, 46, 48) #define SELECT_MACHINE_GREY600 wxColour(144,144,144) #define SELECT_MACHINE_GREY400 wxColour(206, 206, 206) -#define SELECT_MACHINE_BRAND wxColour(0, 174, 66) +//#define SELECT_MACHINE_BRAND wxColour(0, 174, 66) +#define SELECT_MACHINE_BRAND wxColour(0x9A5F21) #define SELECT_MACHINE_REMIND wxColour(255,111,0) #define SELECT_MACHINE_LIGHT_GREEN wxColour(219, 253, 231) diff --git a/slic3r/GUI/CalibrationWizard.cpp b/slic3r/GUI/CalibrationWizard.cpp index 8c1d876..dacd188 100644 --- a/slic3r/GUI/CalibrationWizard.cpp +++ b/slic3r/GUI/CalibrationWizard.cpp @@ -528,6 +528,7 @@ static bool get_preset_info(const DynamicConfig& config, const BedType plate_typ static bool get_flow_ratio(const DynamicConfig& config, float& flow_ratio) { const ConfigOptionFloats *flow_ratio_opt = config.option("filament_flow_ratio"); + //const ConfigOptionFloats *flow_ratio_opt = config.option("fibre_feed_rate"); if (flow_ratio_opt) { flow_ratio = flow_ratio_opt->get_at(0); if (flow_ratio > 0) @@ -1057,6 +1058,7 @@ void FlowRateWizard::on_cali_start(CaliPresetStage stage, float cali_value, Flow else if (stage == CaliPresetStage::CALI_MANUAL_STAGE_2) { cali_stage = 2; temp_filament_preset->config.set_key_value("filament_flow_ratio", new ConfigOptionFloats{ cali_value }); + //temp_filament_preset->config.set_key_value("fibre_feed_rate", new ConfigOptionFloats{ cali_value }); if (from_page == FlowRatioCaliSource::FROM_PRESET_PAGE) { calib_info.process_bar = preset_page->get_sending_progress_bar(); } @@ -1135,6 +1137,7 @@ void FlowRateWizard::on_cali_save() for (int i = 0; i < new_results.size(); i++) { std::map key_value_map; key_value_map.insert(std::make_pair("filament_flow_ratio", new ConfigOptionFloats{ new_results[i].second })); + //key_value_map.insert(std::make_pair("fibre_feed_rate", new ConfigOptionFloats{ new_results[i].second })); wxString message; if (!save_preset(old_preset_name, into_u8(new_results[i].first), key_value_map, message)) { MessageDialog error_msg_dlg(nullptr, message, wxEmptyString, wxICON_WARNING | wxOK); @@ -1181,6 +1184,7 @@ void FlowRateWizard::on_cali_save() } std::map key_value_map; key_value_map.insert(std::make_pair("filament_flow_ratio", new ConfigOptionFloats{ new_flow_ratio })); + //key_value_map.insert(std::make_pair("fibre_feed_rate", new ConfigOptionFloats{ new_flow_ratio })); wxString message; if (!save_preset(old_preset_name, into_u8(new_preset_name), key_value_map, message)) { diff --git a/slic3r/GUI/CalibrationWizardPage.cpp b/slic3r/GUI/CalibrationWizardPage.cpp index cb5b911..b4cec0c 100644 --- a/slic3r/GUI/CalibrationWizardPage.cpp +++ b/slic3r/GUI/CalibrationWizardPage.cpp @@ -144,7 +144,8 @@ CaliPageButton::CaliPageButton(wxWindow* parent, CaliPageActionType type, wxStri StateColor btn_bg_green(std::pair(wxColour(206, 206, 206), StateColor::Disabled), std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Disabled), std::pair(wxColour(206, 206, 206), StateColor::Pressed), @@ -152,7 +153,8 @@ CaliPageButton::CaliPageButton(wxWindow* parent, CaliPageActionType type, wxStri std::pair(wxColour(255, 255, 255), StateColor::Normal)); StateColor btn_bd_green(std::pair(wxColour(255, 255, 254), StateColor::Disabled), - std::pair(wxColour(0, 174, 66), StateColor::Enabled)); + //std::pair(wxColour(0, 174, 66), StateColor::Enabled)); + std::pair(wxColour(0x9A5F21), StateColor::Enabled)); StateColor btn_bd_white(std::pair(wxColour(255, 255, 254), StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); diff --git a/slic3r/GUI/CalibrationWizardPresetPage.cpp b/slic3r/GUI/CalibrationWizardPresetPage.cpp index 972e935..198d4fa 100644 --- a/slic3r/GUI/CalibrationWizardPresetPage.cpp +++ b/slic3r/GUI/CalibrationWizardPresetPage.cpp @@ -927,6 +927,7 @@ void CalibrationPresetPage::on_recommend_input_value() Preset *selected_filament_preset = selected_filaments.begin()->second; if (selected_filament_preset) { const ConfigOptionFloats* flow_ratio_opt = selected_filament_preset->config.option("filament_flow_ratio"); + //const ConfigOptionFloats* flow_ratio_opt = selected_filament_preset->config.option("fibre_feed_rate"); if (flow_ratio_opt) { m_cali_stage_panel->set_flow_ratio_value(flow_ratio_opt->get_at(0)); } @@ -1770,6 +1771,7 @@ void CalibrationPresetPage::get_cali_stage(CaliPresetStage& stage, float& value) std::map selected_filaments = get_selected_filaments(); if (!selected_filaments.empty()) { const ConfigOptionFloats* flow_ratio_opt = selected_filaments.begin()->second->config.option("filament_flow_ratio"); + //const ConfigOptionFloats* flow_ratio_opt = selected_filaments.begin()->second->config.option("fibre_feed_rate"); if (flow_ratio_opt) { m_cali_stage_panel->set_flow_ratio_value(flow_ratio_opt->get_at(0)); value = flow_ratio_opt->get_at(0); diff --git a/slic3r/GUI/ConnectPrinter.cpp b/slic3r/GUI/ConnectPrinter.cpp index 5a57ef1..c1a27d3 100644 --- a/slic3r/GUI/ConnectPrinter.cpp +++ b/slic3r/GUI/ConnectPrinter.cpp @@ -55,10 +55,12 @@ ConnectPrinterDialog::ConnectPrinterDialog(wxWindow *parent, wxWindowID id, cons StateColor btn_bg( std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal) + //std::pair(wxColour(0, 174, 66), StateColor::Normal) + std::pair(wxColour(0x9A5F21), StateColor::Normal) ); - StateColor btn_bd(std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //StateColor btn_bd(std::pair(wxColour(0, 174, 66), StateColor::Normal)); + StateColor btn_bd(std::pair(wxColour(0x9A5F21), StateColor::Normal)); StateColor btn_text(std::pair(wxColour(255, 255, 255), StateColor::Normal)); diff --git a/slic3r/GUI/CreatePresetsDialog.cpp b/slic3r/GUI/CreatePresetsDialog.cpp index 27034b1..a06fd9a 100644 --- a/slic3r/GUI/CreatePresetsDialog.cpp +++ b/slic3r/GUI/CreatePresetsDialog.cpp @@ -912,7 +912,8 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item() bSizer_button->Add(0, 0, 1, wxEXPAND, 0); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_button_create = new Button(this, _L("Create")); m_button_create->SetBackgroundColor(btn_bg_green); @@ -1848,7 +1849,8 @@ wxBoxSizer *CreatePrinterPresetDialog::create_hot_bed_stl_item(wxWindow *parent) StateColor flush_bg_col(std::pair(wxColour(219, 253, 231), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), std::pair(wxColour(238, 238, 238), StateColor::Normal)); - StateColor flush_bd_col(std::pair(wxColour(0, 174, 66), StateColor::Pressed), std::pair(wxColour(0, 174, 66), StateColor::Hovered), + //StateColor flush_bd_col(std::pair(wxColour(0, 174, 66), StateColor::Pressed), std::pair(wxColour(0, 174, 66), StateColor::Hovered), + StateColor flush_bd_col(std::pair(wxColour(0x9A5F21), StateColor::Pressed), std::pair(wxColour(0x9A5F21), StateColor::Hovered), std::pair(wxColour(172, 172, 172), StateColor::Normal)); m_button_bed_stl = new Button(parent, _L("Load stl")); @@ -1885,7 +1887,8 @@ wxBoxSizer *CreatePrinterPresetDialog::create_hot_bed_svg_item(wxWindow *parent) StateColor flush_bg_col(std::pair(wxColour(219, 253, 231), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), std::pair(wxColour(238, 238, 238), StateColor::Normal)); - StateColor flush_bd_col(std::pair(wxColour(0, 174, 66), StateColor::Pressed), std::pair(wxColour(0, 174, 66), StateColor::Hovered), + //StateColor flush_bd_col(std::pair(wxColour(0, 174, 66), StateColor::Pressed), std::pair(wxColour(0, 174, 66), StateColor::Hovered), + StateColor flush_bd_col(std::pair(wxColour(0x9A5F21), StateColor::Pressed), std::pair(wxColour(0x9A5F21), StateColor::Hovered), std::pair(wxColour(172, 172, 172), StateColor::Normal)); m_button_bed_svg = new Button(parent, _L("Load svg")); @@ -1933,7 +1936,8 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page1_btns_item(wxWindow *parent) bSizer_button->Add(0, 0, 1, wxEXPAND, 0); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_button_OK = new Button(parent, _L("OK")); m_button_OK->SetBackgroundColor(btn_bg_green); @@ -2514,7 +2518,8 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent) bSizer_button->Add(0, 0, 1, wxEXPAND, 0); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), std::pair(*wxWHITE, StateColor::Normal)); @@ -3243,7 +3248,8 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con break; } StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), std::pair(*wxWHITE, StateColor::Normal)); @@ -4101,7 +4107,8 @@ wxBoxSizer *ExportConfigsDialog::create_button_item(wxWindow* parent) bSizer_button->Add(0, 0, 1, wxEXPAND, 0); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_button_ok = new Button(this, _L("OK")); m_button_ok->SetBackgroundColor(btn_bg_green); @@ -4610,7 +4617,8 @@ wxBoxSizer *EditFilamentPresetDialog::create_add_filament_btn() StateColor flush_fg_col(std::pair(wxColour(107, 107, 106), StateColor::Pressed), std::pair(wxColour(107, 107, 106), StateColor::Hovered), std::pair(wxColour(107, 107, 106), StateColor::Normal)); - StateColor flush_bd_col(std::pair(wxColour(0, 174, 66), StateColor::Pressed), std::pair(wxColour(0, 174, 66), StateColor::Hovered), + //StateColor flush_bd_col(std::pair(wxColour(0, 174, 66), StateColor::Pressed), std::pair(wxColour(0, 174, 66), StateColor::Hovered), + StateColor flush_bd_col(std::pair(wxColour(0x9A5F21), StateColor::Pressed), std::pair(wxColour(0x9A5F21), StateColor::Hovered), std::pair(wxColour(172, 172, 172), StateColor::Normal)); m_add_filament_btn->SetBackgroundColor(flush_bg_col); @@ -4670,7 +4678,8 @@ wxBoxSizer *EditFilamentPresetDialog::create_button_sizer() bSizer_button->Add(0, 0, 1, wxEXPAND, 0); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_ok_btn = new Button(this, _L("OK")); m_ok_btn->SetBackgroundColor(btn_bg_green); @@ -4870,7 +4879,8 @@ wxBoxSizer *CreatePresetForPrinterDialog::create_button_sizer() bSizer_button->Add(0, 0, 1, wxEXPAND, 0); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_ok_btn = new Button(this, _L("OK")); m_ok_btn->SetBackgroundColor(btn_bg_green); @@ -5016,11 +5026,13 @@ wxPanel *PresetTree::get_child_item(wxPanel *parent, std::shared_ptr pre StateColor flush_fg_col(std::pair(wxColour(107, 107, 106), StateColor::Pressed), std::pair(wxColour(107, 107, 106), StateColor::Hovered), std::pair(wxColour(107, 107, 106), StateColor::Normal)); - StateColor flush_bd_col(std::pair(wxColour(0, 174, 66), StateColor::Pressed), std::pair(wxColour(0, 174, 66), StateColor::Hovered), + //StateColor flush_bd_col(std::pair(wxColour(0, 174, 66), StateColor::Pressed), std::pair(wxColour(0, 174, 66), StateColor::Hovered), + StateColor flush_bd_col(std::pair(wxColour(0x9A5F21), StateColor::Pressed), std::pair(wxColour(0x9A5F21), StateColor::Hovered), std::pair(wxColour(172, 172, 172), StateColor::Normal)); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); Button *edit_preset_btn = new Button(panel, _L("Edit Preset")); edit_preset_btn->SetFont(Label::Body_10); diff --git a/slic3r/GUI/DailyTips.cpp b/slic3r/GUI/DailyTips.cpp index 5aba776..d432684 100644 --- a/slic3r/GUI/DailyTips.cpp +++ b/slic3r/GUI/DailyTips.cpp @@ -485,7 +485,8 @@ void DailyTipsPanel::render_controller_buttons(const ImVec2& pos, const ImVec2& button_text = ImGui::PrevArrowBtnIcon; if (ImGui::IsMouseHoveringRect(prev_button_pos, prev_button_pos + button_size, true)) { - button_text_color = ImColor(0, 174, 66, (int)(255 * m_fade_opacity)); + //button_text_color = ImColor(0, 174, 66, (int)(255 * m_fade_opacity)); + button_text_color = ImColor(33, 95, 154, (int)(255 * m_fade_opacity)); if (ImGui::IsMouseClicked(ImGuiMouseButton_Left)) retrieve_data_from_hint_database(HintDataNavigation::Prev); } @@ -500,7 +501,8 @@ void DailyTipsPanel::render_controller_buttons(const ImVec2& pos, const ImVec2& button_text = ImGui::NextArrowBtnIcon; if (ImGui::IsMouseHoveringRect(next_button_pos, next_button_pos + button_size, true)) { - button_text_color = ImColor(0, 174, 66, (int)(255 * m_fade_opacity)); + //button_text_color = ImColor(0, 174, 66, (int)(255 * m_fade_opacity)); + button_text_color = ImColor(33, 95, 154, (int)(255 * m_fade_opacity)); if (ImGui::IsMouseClicked(ImGuiMouseButton_Left)) retrieve_data_from_hint_database(HintDataNavigation::Next); } diff --git a/slic3r/GUI/ExtrusionCalibration.cpp b/slic3r/GUI/ExtrusionCalibration.cpp index 945069b..1de5f8a 100644 --- a/slic3r/GUI/ExtrusionCalibration.cpp +++ b/slic3r/GUI/ExtrusionCalibration.cpp @@ -172,10 +172,12 @@ void ExtrusionCalibration::create() m_button_cali = new Button(m_step_1_panel, _L("Start calibration")); m_btn_bg_green = StateColor(std::pair(wxColour(238, 238, 238), StateColor::Disabled), std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_button_cali->SetBackgroundColor(m_btn_bg_green); m_button_cali->SetFont(Label::Body_13); - m_button_cali->SetBorderColor({ std::pair(wxColour(238, 238, 238), StateColor::Disabled), std::pair(wxColour(0, 174, 66), StateColor::Enabled) }); + //m_button_cali->SetBorderColor({ std::pair(wxColour(238, 238, 238), StateColor::Disabled), std::pair(wxColour(0, 174, 66), StateColor::Enabled) }); + m_button_cali->SetBorderColor({ std::pair(wxColour(238, 238, 238), StateColor::Disabled), std::pair(wxColour(0x9A5F21), StateColor::Enabled) }); m_button_cali->SetTextColor({ std::pair(wxColour(172, 172, 172), StateColor::Disabled), std::pair(EXTRUSION_CALIBRATION_GREY200, StateColor::Enabled) }); m_button_cali->SetCornerRadius(FromDIP(12)); m_button_cali->SetMinSize(wxSize(-1, FromDIP(24))); @@ -183,9 +185,11 @@ void ExtrusionCalibration::create() m_cali_cancel = new Button(m_step_1_panel, _L("Cancel")); m_btn_bg_green = StateColor(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_cali_cancel->SetBackgroundColor(m_btn_bg_green); - m_cali_cancel->SetBorderColor(wxColour(0, 174, 66)); + //m_cali_cancel->SetBorderColor(wxColour(0, 174, 66)); + m_cali_cancel->SetBorderColor(wxColour(0x9A5F21)); m_cali_cancel->SetTextColor(EXTRUSION_CALIBRATION_GREY200); m_cali_cancel->SetMinSize(EXTRUSION_CALIBRATION_BUTTON_SIZE); m_cali_cancel->SetCornerRadius(FromDIP(12)); @@ -258,10 +262,12 @@ void ExtrusionCalibration::create() // save button m_button_save_result = new Button(m_step_2_panel, _L("Save")); m_btn_bg_green = StateColor(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_button_save_result->SetBackgroundColor(m_btn_bg_green); m_button_save_result->SetFont(Label::Body_13); - m_button_save_result->SetBorderColor(wxColour(0, 174, 66)); + //m_button_save_result->SetBorderColor(wxColour(0, 174, 66)); + m_button_save_result->SetBorderColor(wxColour(0x9A5F21)); m_button_save_result->SetTextColor(EXTRUSION_CALIBRATION_GREY200); m_button_save_result->SetMinSize(EXTRUSION_CALIBRATION_BUTTON_SIZE); m_button_save_result->SetCornerRadius(FromDIP(12)); diff --git a/slic3r/GUI/GCodeViewer.cpp b/slic3r/GUI/GCodeViewer.cpp index 1bce721..32a1f70 100644 --- a/slic3r/GUI/GCodeViewer.cpp +++ b/slic3r/GUI/GCodeViewer.cpp @@ -589,8 +589,10 @@ void GCodeViewer::SequentialView::GCodeWindow::render(float top, float bottom, f return ret; }; - static const ImVec4 LINE_NUMBER_COLOR = { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f }; - static const ImVec4 SELECTION_RECT_COLOR = { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f }; + //static const ImVec4 LINE_NUMBER_COLOR = { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f }; + static const ImVec4 LINE_NUMBER_COLOR = { 33.0f / 255.0f, 95.0f / 255.0f, 154.0f / 255.0f, 1.0f }; + //static const ImVec4 SELECTION_RECT_COLOR = { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f }; + static const ImVec4 SELECTION_RECT_COLOR = { 33.0f / 255.0f, 95.0f / 255.0f, 154.0f / 255.0f, 1.0f }; static const ImVec4 COMMAND_COLOR = m_is_dark ? ImVec4( 240.0f / 255.0f, 240.0f / 255.0f, 240.0f / 255.0f, 1.0f ) : ImVec4( 1.0f, 1.0f, 1.0f, 1.0f ); static const ImVec4 PARAMETERS_COLOR = m_is_dark ? ImVec4( 179.0f / 255.0f, 179.0f / 255.0f, 179.0f / 255.0f, 1.0f ) : ImVec4( 206.0f / 255.0f, 206.0f / 255.0f, 206.0f / 255.0f, 1.0f ); static const ImVec4 COMMENT_COLOR = m_is_dark ? ImVec4(129.0f / 255.0f, 129.0f / 255.0f, 129.0f / 255.0f, 1.0f) : ImVec4( 172.0f / 255.0f, 172.0f / 255.0f, 172.0f / 255.0f, 1.0f ); diff --git a/slic3r/GUI/GLCanvas3D.cpp b/slic3r/GUI/GLCanvas3D.cpp index 3d724db..e1bc240 100644 --- a/slic3r/GUI/GLCanvas3D.cpp +++ b/slic3r/GUI/GLCanvas3D.cpp @@ -233,9 +233,13 @@ void GLCanvas3D::LayersEditing::render_variable_layer_height_dialog(const GLCanv ImGuiWrapper& imgui = *wxGetApp().imgui(); const Size& cnv_size = canvas.get_canvas_size(); float zoom = (float)wxGetApp().plater()->get_camera().get_zoom(); - float left_pos = canvas.m_main_toolbar.get_item("layersediting")->render_left_pos; - const float x = 0.5 * cnv_size.get_width() + left_pos * zoom; - imgui.set_next_window_pos(x, canvas.m_main_toolbar.get_height(), ImGuiCond_Always, 0.0f, 0.0f); + //float left_pos = canvas.m_main_toolbar.get_item("layersediting")->render_left_pos; + float top_pos = canvas.m_main_toolbar.get_item("layersediting")->render_top_pos; + //const float x = 0.5 * cnv_size.get_width() + left_pos * zoom; + const float x = canvas.m_main_toolbar.get_width(); + const float y = 0.5 * cnv_size.get_height() - top_pos * zoom; + //imgui.set_next_window_pos(x, canvas.m_main_toolbar.get_height(), ImGuiCond_Always, 0.0f, 0.0f); + imgui.set_next_window_pos(x, y, ImGuiCond_Always, 0.0f, 0.0f); imgui.push_toolbar_style(canvas.get_scale()); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(6.0f * canvas.get_scale(), 4.0f * canvas.get_scale())); @@ -315,7 +319,8 @@ void GLCanvas3D::LayersEditing::render_variable_layer_height_dialog(const GLCanv ImGui::Separator(); - float get_cur_y = ImGui::GetContentRegionMax().y + ImGui::GetFrameHeight() + canvas.m_main_toolbar.get_height(); + //float get_cur_y = ImGui::GetContentRegionMax().y + ImGui::GetFrameHeight() + canvas.m_main_toolbar.get_height(); + float get_cur_y = y - ImGui::GetContentRegionMax().y - ImGui::GetFrameHeight(); std::map captions_texts = { {_L("Left mouse button:") ,_L("Add detail")}, {_L("Right mouse button:"), _L("Remove detail")}, @@ -323,6 +328,7 @@ void GLCanvas3D::LayersEditing::render_variable_layer_height_dialog(const GLCanv {_L("Shift + Right mouse button:"), _L("Smoothing")}, {_L("Mouse wheel:"), _L("Increase/decrease edit area")} }; + //show_tooltip_information(canvas, captions_texts, x, get_cur_y); show_tooltip_information(canvas, captions_texts, x, get_cur_y); ImGui::SameLine(); if (imgui.button(_L("Reset"))) @@ -1132,6 +1138,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D &bed) #endif , m_in_render(false) , m_main_toolbar(GLToolbar::Normal, "Main") + //, m_left_toolbar(GLToolbar::Normal, "Left") , m_separator_toolbar(GLToolbar::Normal, "Separator") , m_assemble_view_toolbar(GLToolbar::Normal, "Assembly_View") , m_return_toolbar() @@ -1318,6 +1325,7 @@ void GLCanvas3D::on_change_color_mode(bool is_dark, bool reinit) { // set dirty to re-generate icon texture m_separator_toolbar.set_icon_dirty(); m_main_toolbar.set_icon_dirty(); + //m_left_toolbar.set_icon_dirty(); wxGetApp().plater()->get_collapse_toolbar().set_icon_dirty(); m_assemble_view_toolbar.set_icon_dirty(); m_gizmos.set_icon_dirty(); @@ -1689,6 +1697,11 @@ void GLCanvas3D::enable_main_toolbar(bool enable) m_main_toolbar.set_enabled(enable); } +//void GLCanvas3D::enable_left_toolbar(bool enable) +//{ +// m_left_toolbar.set_enabled(enable); +//} + void GLCanvas3D::reset_select_plate_toolbar_selection() { if (m_sel_plate_toolbar.m_all_plates_stats_item) m_sel_plate_toolbar.m_all_plates_stats_item->selected = false; @@ -3006,6 +3019,7 @@ void GLCanvas3D::on_idle(wxIdleEvent& evt) return; m_dirty |= m_main_toolbar.update_items_state(); + //m_dirty |= m_left_toolbar.update_items_state(); //BBS: GUI refactor: GLToolbar m_dirty |= m_assemble_view_toolbar.update_items_state(); // BBS @@ -5503,8 +5517,11 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo #if BBS_TOOLBAR_ON_TOP float zoom = (float)wxGetApp().plater()->get_camera().get_zoom(); float left_pos = m_main_toolbar.get_item("arrange")->render_left_pos; - const float x = 0.5 * canvas_w + left_pos * zoom; - imgui->set_next_window_pos(x, m_main_toolbar.get_height(), ImGuiCond_Always, 0.0f, 0.0f); + float top_pos = m_main_toolbar.get_item("arrange")->render_top_pos; + //const float x = 0.5 * canvas_w + left_pos * zoom; + const float y = 0.5 * canvas_h - top_pos * zoom; + //imgui->set_next_window_pos(x, m_main_toolbar.get_height(), ImGuiCond_Always, 0.0f, 0.0f); + imgui->set_next_window_pos(m_main_toolbar.get_width(), y, ImGuiCond_Always, 0.0f, 0.0f); #else const float x = canvas_w - m_main_toolbar.get_width(); @@ -6171,6 +6188,7 @@ void GLCanvas3D::_switch_toolbars_icon_filename() background_data.right = 16; background_data.bottom = 16; m_main_toolbar.init(background_data); + //m_left_toolbar.init(background_data); m_assemble_view_toolbar.init(background_data); m_separator_toolbar.init(background_data); wxGetApp().plater()->get_collapse_toolbar().init(background_data); @@ -6275,10 +6293,10 @@ bool GLCanvas3D::_init_main_toolbar() BOOST_LOG_TRIVIAL(error) << "Gizmos manager failed to load arrow texture."; } - m_main_toolbar.set_layout_type(GLToolbar::Layout::Horizontal); + m_main_toolbar.set_layout_type(GLToolbar::Layout::Vertical); //BBS: main toolbar is at the top and left, we don't need the rounded-corner effect at the right side and the top side - m_main_toolbar.set_horizontal_orientation(GLToolbar::Layout::HO_Right); - m_main_toolbar.set_vertical_orientation(GLToolbar::Layout::VO_Top); + m_main_toolbar.set_horizontal_orientation(GLToolbar::Layout::HO_Left); + m_main_toolbar.set_vertical_orientation(GLToolbar::Layout::VO_Center); m_main_toolbar.set_border(5.0f); m_main_toolbar.set_separator_size(5); m_main_toolbar.set_gap_size(4); @@ -7287,7 +7305,7 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale() //use the same value as horizon float new_v_scale = new_h_scale; #else - float top_tb_width = = collapse_toolbar.get_width(); + float top_tb_width = collapse_toolbar.get_width(); int items_cnt = collapse_toolbar.get_visible_items_cnt(); float noitems_width = top_tb_width - size * items_cnt; // width of separators and borders in top toolbars @@ -7346,6 +7364,7 @@ void GLCanvas3D::_render_overlays() //BBS: GUI refactor: GLToolbar m_main_toolbar.set_icons_size(gizmo_size); + //m_left_toolbar.set_icons_size(gizmo_size); m_assemble_view_toolbar.set_icons_size(gizmo_size); m_separator_toolbar.set_icons_size(gizmo_size); wxGetApp().plater()->get_collapse_toolbar().set_icons_size(size); @@ -7563,15 +7582,18 @@ void GLCanvas3D::_render_main_toolbar() Size cnv_size = get_canvas_size(); float inv_zoom = (float)wxGetApp().plater()->get_camera().get_inv_zoom(); - + auto canvas_w = float(get_canvas_size().get_width()); #if BBS_TOOLBAR_ON_TOP GLToolbar& collapse_toolbar = wxGetApp().plater()->get_collapse_toolbar(); float collapse_toolbar_width = collapse_toolbar.is_enabled() ? collapse_toolbar.get_width() : 0.0f; float gizmo_width = m_gizmos.get_scaled_total_width(); float assemble_width = m_assemble_view_toolbar.get_width(); float separator_width = m_separator_toolbar.get_width(); - float top = 0.5f * (float)cnv_size.get_height() * inv_zoom; - float left = std::max(-0.5f * cnv_size.get_width(), -0.5f * (m_main_toolbar.get_width() + separator_width + gizmo_width + assemble_width - collapse_toolbar_width)) * inv_zoom; + //float top = 0.5f * (float)cnv_size.get_height() * inv_zoom; + float top = 0.5f * (float)m_main_toolbar.get_width(); + //float left = std::max(-0.5f * cnv_size.get_width(), -0.5f * (m_main_toolbar.get_width() + separator_width + gizmo_width + assemble_width - collapse_toolbar_width)) * inv_zoom; + //float left = -0.12f * (float)cnv_size.get_width(); + float left = -0.5f * (float)cnv_size.get_width() * inv_zoom; #else float gizmo_height = m_gizmos.get_scaled_total_height(); float space_height = GLGizmosManager::Default_Icons_Size * wxGetApp().toolbar_icon_scale(); @@ -7581,6 +7603,7 @@ void GLCanvas3D::_render_main_toolbar() float left = (0.5f * (float)cnv_size.get_width() - m_main_toolbar.get_width()) * inv_zoom; //BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": top %1%, main_toolbar_height %2%, space_height %3% gizmo_height %4%") % top % main_toolbar_height % space_height % gizmo_height; #endif + //m_main_toolbar.set_position(top, left); m_main_toolbar.set_position(top, left); m_main_toolbar.render(*this); if (m_toolbar_highlighter.m_render_arrow) @@ -7762,12 +7785,14 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar() ImTextureID btn_texture_id; if (all_plates_stats_item->slice_state == IMToolbarItem::SliceState::UNSLICED || all_plates_stats_item->slice_state == IMToolbarItem::SliceState::SLICING || all_plates_stats_item->slice_state == IMToolbarItem::SliceState::SLICE_FAILED) { - text_clr = ImVec4(0, 174.0f / 255.0f, 66.0f / 255.0f, 0.2f); + //text_clr = ImVec4(0, 174.0f / 255.0f, 66.0f / 255.0f, 0.2f); + text_clr = ImVec4(33.0f / 255.0f, 95.0f / 255.0f, 154.0f / 255.0f, 0.2f); btn_texture_id = (ImTextureID)(intptr_t)(all_plates_stats_item->image_texture_transparent.get_id()); } else { - text_clr = ImVec4(0, 174.0f / 255.0f, 66.0f / 255.0f, 1); + //text_clr = ImVec4(0, 174.0f / 255.0f, 66.0f / 255.0f, 1); + text_clr = ImVec4(33.0f / 255.0f, 95.0f / 255.0f, 154.0f / 255.0f, 1); btn_texture_id = (ImTextureID)(intptr_t)(all_plates_stats_item->image_texture.get_id()); } diff --git a/slic3r/GUI/GLCanvas3D.hpp b/slic3r/GUI/GLCanvas3D.hpp index 5df5ee2..6424502 100644 --- a/slic3r/GUI/GLCanvas3D.hpp +++ b/slic3r/GUI/GLCanvas3D.hpp @@ -520,6 +520,8 @@ private: GLGizmosManager m_gizmos; //BBS: GUI refactor: GLToolbar mutable GLToolbar m_main_toolbar; + //mutable GLToolbar m_left_toolbar; + //mutable GLToolbar m_top_toolbar; mutable GLToolbar m_separator_toolbar; mutable IMToolbar m_sel_plate_toolbar; mutable GLToolbar m_assemble_view_toolbar; @@ -797,6 +799,7 @@ public: void enable_gizmos(bool enable); void enable_selection(bool enable); void enable_main_toolbar(bool enable); + //void enable_left_toolbar(bool enable); //BBS: GUI refactor: GLToolbar void _update_select_plate_toolbar_stats_item(bool force_selected = false); void reset_select_plate_toolbar_selection(); diff --git a/slic3r/GUI/GLToolbar.cpp b/slic3r/GUI/GLToolbar.cpp index 1fc2fb7..e61d792 100644 --- a/slic3r/GUI/GLToolbar.cpp +++ b/slic3r/GUI/GLToolbar.cpp @@ -96,6 +96,7 @@ GLToolbarItem::GLToolbarItem(GLToolbarItem::EType type, const GLToolbarItem::Dat , m_highlight_state(NotHighlighted) { render_left_pos = 0.0f; + render_top_pos = 0.0f; } void GLToolbarItem::set_state(EState state) @@ -1459,12 +1460,13 @@ void GLToolbar::render_horizontal(const GLCanvas3D& parent,GLToolbarItem::EType if (!item->is_visible()) continue; - if (item->is_separator()) + if (item->is_separator()) left += separator_stride; else { //BBS GUI refactor item->render_left_pos = left; + item->render_top_pos = top; if (!item->is_action_with_text_image()) { unsigned int tex_id = m_icons_texture.get_id(); int tex_width = m_icons_texture.get_width(); @@ -1515,9 +1517,11 @@ void GLToolbar::render_vertical(const GLCanvas3D& parent) if (!item->is_visible()) continue; - if (item->is_separator()) + if (item->is_separator()) top -= separator_stride; else { + item->render_left_pos = left; + item->render_top_pos = top; unsigned int tex_id; int tex_width, tex_height; if (item->is_action_with_text_image()) { diff --git a/slic3r/GUI/GLToolbar.hpp b/slic3r/GUI/GLToolbar.hpp index 25291ec..b3581ed 100644 --- a/slic3r/GUI/GLToolbar.hpp +++ b/slic3r/GUI/GLToolbar.hpp @@ -181,6 +181,8 @@ public: // remember left position for rendering menu mutable float render_left_pos; + mutable float render_top_pos; + std::chrono::system_clock::time_point get_start_time_point() const { return start; } GLToolbarItem(EType type, const Data& data); diff --git a/slic3r/GUI/GUI_App.cpp b/slic3r/GUI/GUI_App.cpp index 4e372f2..1ea89de 100644 --- a/slic3r/GUI/GUI_App.cpp +++ b/slic3r/GUI/GUI_App.cpp @@ -416,7 +416,8 @@ public: int logo_margin = FromDIP(72 * m_scale); int logo_size = FromDIP(122 * m_scale); int logo_width = FromDIP(94 * m_scale); - wxBitmap logo_bmp = *bmp_cache.load_svg("splash_logo", logo_size, logo_size); + //wxBitmap logo_bmp = *bmp_cache.load_svg("splash_logo", logo_size, logo_size); + wxBitmap logo_bmp = *bmp_cache.load_svg("machine_logo", logo_size, logo_size); int logo_y = top_margin + title_rect.GetHeight() + logo_margin; memDc.DrawBitmap(logo_bmp, 900, 0, true); diff --git a/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp b/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp index d4c0e2d..63647ed 100644 --- a/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp +++ b/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp @@ -2023,7 +2023,8 @@ void GLGizmoMeasure::show_face_face_assembly_common() { m_imgui->disabled_begin(!(action.can_set_to_center_coincidence)); { ImGui::PushItemWidth(set_to_center_coincidence_size); - ImGui::PushStyleColor(ImGuiCol_Button, m_is_dark_mode ? ImVec4(0 / 255.0, 174 / 255.0, 66 / 255.0, 1.0) : ImVec4(0 / 255.0, 174 / 255.0, 66 / 255.0, 1.0)); + //ImGui::PushStyleColor(ImGuiCol_Button, m_is_dark_mode ? ImVec4(0 / 255.0, 174 / 255.0, 66 / 255.0, 1.0) : ImVec4(0 / 255.0, 174 / 255.0, 66 / 255.0, 1.0)); + ImGui::PushStyleColor(ImGuiCol_Button, m_is_dark_mode ? ImVec4(33.0f / 255.0f, 95.0f / 255.0f, 154.0f / 255.0f, 1.0) : ImVec4(33.0f / 255.0f, 95.0f / 255.0f, 154.0f / 255.0f, 1.0)); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, m_is_dark_mode ? ImVec4(50 / 255.0f, 238 / 255.0f, 61 / 255.0f, 1.00f) : ImVec4(50 / 255.0f, 238 / 255.0f, 61 / 255.0f, 1.00f)); ImGui::PushStyleColor(ImGuiCol_ButtonActive, diff --git a/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp b/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp index 235d31b..8a73092 100644 --- a/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp +++ b/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp @@ -205,13 +205,18 @@ void GLGizmoMeshBoolean::on_render_input_window(float x, float y, float bottom_l if (selected || hovered) { ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.0f)); - ImGui::PushStyleColor(ImGuiCol_Button, { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f }); - ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f }); - ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f }); + //ImGui::PushStyleColor(ImGuiCol_Button, { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f }); + ImGui::PushStyleColor(ImGuiCol_Button, { 33.0f / 255.0f, 95.0f / 255.0f, 154.0f / 255.0f, 1.0f }); + //ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f }); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 33.0f / 255.0f, 95.0f / 255.0f, 154.0f / 255.0f, 1.0f }); + //ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f }); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 33.0f / 255.0f, 95.0f / 255.0f, 154.0f / 255.0f, 1.0f }); } else { - ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f }); - ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f }); + //ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f }); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 33.0f / 255.0f, 95.0f / 255.0f, 154.0f / 255.0f, 1.0f }); + //ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f }); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 33.0f / 255.0f, 95.0f / 255.0f, 154.0f / 255.0f, 1.0f }); } bool res = ImGui::Button(label.c_str(), size_arg); diff --git a/slic3r/GUI/IMSlider.cpp b/slic3r/GUI/IMSlider.cpp index 7299c4e..e933d18 100644 --- a/slic3r/GUI/IMSlider.cpp +++ b/slic3r/GUI/IMSlider.cpp @@ -25,7 +25,8 @@ static const ImU32 BACKGROUND_COLOR_DARK = IM_COL32(65, 65, 71, 255); static const ImU32 BACKGROUND_COLOR_LIGHT = IM_COL32(255, 255, 255, 255); static const ImU32 GROOVE_COLOR_DARK = IM_COL32(45, 45, 49, 255); static const ImU32 GROOVE_COLOR_LIGHT = IM_COL32(206, 206, 206, 255); -static const ImU32 BRAND_COLOR = IM_COL32(0, 174, 66, 255); +//static const ImU32 BRAND_COLOR = IM_COL32(0, 174, 66, 255); +static const ImU32 BRAND_COLOR = IM_COL32(33, 95, 154, 255); static int m_tick_value = -1; diff --git a/slic3r/GUI/MainFrame.cpp b/slic3r/GUI/MainFrame.cpp index 7e95b32..42e1a66 100644 --- a/slic3r/GUI/MainFrame.cpp +++ b/slic3r/GUI/MainFrame.cpp @@ -1987,8 +1987,10 @@ void MainFrame::update_side_button_style() m_slice_btn->SetBottomColour(wxColour(0x3B4446));*/ StateColor m_btn_bg_enable = StateColor( std::pair(wxColour(27, 136, 68), StateColor::Pressed), - std::pair(wxColour(48, 221, 112), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal) + //std::pair(wxColour(48, 221, 112), StateColor::Hovered), + std::pair(0x0073BC, StateColor::Hovered), + //std::pair(wxColour(0, 174, 66), StateColor::Normal) + std::pair(wxColour(0x9A5F21), StateColor::Normal) ); m_publish_btn->SetMinSize(wxSize(FromDIP(125), FromDIP(24))); diff --git a/slic3r/GUI/MsgDialog.cpp b/slic3r/GUI/MsgDialog.cpp index ede723e..3162ab0 100644 --- a/slic3r/GUI/MsgDialog.cpp +++ b/slic3r/GUI/MsgDialog.cpp @@ -153,11 +153,13 @@ Button* MsgDialog::add_button(wxWindowID btn_id, bool set_focus /*= false*/, con StateColor btn_bg_green( std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal) + //std::pair(wxColour(0, 174, 66), StateColor::Normal) + std::pair(wxColour(0x9A5F21), StateColor::Normal) ); StateColor btn_bd_green( - std::pair(wxColour(0, 174, 66), StateColor::Normal) + //std::pair(wxColour(0, 174, 66), StateColor::Normal) + std::pair(wxColour(0x9A5F21), StateColor::Normal) ); StateColor btn_text_green( @@ -554,7 +556,8 @@ wxBoxSizer *Newer3mfVersionDialog::get_btn_sizer() wxBoxSizer *horizontal_sizer = new wxBoxSizer(wxHORIZONTAL); horizontal_sizer->Add(0, 0, 1, wxEXPAND, 0); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), std::pair(*wxWHITE, StateColor::Normal)); bool file_version_newer = (*m_file_version) > (*m_cloud_version); diff --git a/slic3r/GUI/MultiMachineManagerPage.cpp b/slic3r/GUI/MultiMachineManagerPage.cpp index 02613c2..20691f5 100644 --- a/slic3r/GUI/MultiMachineManagerPage.cpp +++ b/slic3r/GUI/MultiMachineManagerPage.cpp @@ -186,7 +186,8 @@ void MultiMachineItem::doRender(wxDC& dc) } else if (state_device > 2 && state_device < 7) { dc.SetFont(Label::Body_12); - dc.SetTextForeground(wxColour(0, 174, 66)); + //dc.SetTextForeground(wxColour(0, 174, 66)); + dc.SetTextForeground(wxColour(0x9A5F21)); if (obj_->get_curr_stage().IsEmpty() && obj_->subtask_) { //wxString layer_info = wxString::Format(_L("Layer: %d/%d"), obj_->curr_layer, obj_->total_layers); wxString progress_info = wxString::Format("%d", obj_->subtask_->task_progress); @@ -199,8 +200,10 @@ void MultiMachineItem::doRender(wxDC& dc) dc.SetBrush(wxBrush(wxColour(233,233,233))); dc.DrawRoundedRectangle(left, FromDIP(30), FromDIP(DEVICE_LEFT_PRO_INFO), FromDIP(10), 2); - dc.SetPen(wxPen(wxColour(0, 174, 66))); - dc.SetBrush(wxBrush(wxColour(0, 174, 66))); + //dc.SetPen(wxPen(wxColour(0, 174, 66))); + dc.SetPen(wxPen(wxColour(0x9A5F21))); + //dc.SetBrush(wxBrush(wxColour(0, 174, 66))); + dc.SetBrush(wxBrush(wxColour(0x9A5F21))); dc.DrawRoundedRectangle(left, FromDIP(30), FromDIP(DEVICE_LEFT_PRO_INFO) * (static_cast(obj_->subtask_->task_progress) / 100.0f), FromDIP(10), 2); } else { @@ -226,7 +229,8 @@ void MultiMachineItem::doRender(wxDC& dc) } if (m_hover) { - dc.SetPen(wxPen(wxColour(0, 174, 66))); + //dc.SetPen(wxPen(wxColour(0, 174, 66))); + dc.SetPen(wxPen(wxColour(0x9A5F21))); dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.DrawRoundedRectangle(0, 0, size.x, size.y, 3); } @@ -283,7 +287,8 @@ MultiMachineManagerPage::MultiMachineManagerPage(wxWindow* parent) auto m_btn_bg_enable = StateColor( std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal) + //std::pair(wxColour(0, 174, 66), StateColor::Normal) + std::pair(wxColour(0x9A5F21), StateColor::Normal) ); diff --git a/slic3r/GUI/MultiTaskManagerPage.cpp b/slic3r/GUI/MultiTaskManagerPage.cpp index 3c78c3f..fe3a5f3 100644 --- a/slic3r/GUI/MultiTaskManagerPage.cpp +++ b/slic3r/GUI/MultiTaskManagerPage.cpp @@ -36,7 +36,8 @@ MultiTaskItem::MultiTaskItem(wxWindow* parent, MachineObject* obj, int type) auto m_btn_bg_enable = StateColor( std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal) + //std::pair(wxColour(0, 174, 66), StateColor::Normal) + std::pair(wxColour(0x9A5F21), StateColor::Normal) ); m_button_resume = new Button(this, _L("Resume")); @@ -376,7 +377,8 @@ void MultiTaskItem::doRender(wxDC& dc) DrawTextWithEllipsis(dc, get_state_device(), FromDIP(DEVICE_LEFT_PRO_INFO), left); } else if (state_device == 1) { - dc.SetTextForeground(wxColour(0, 174, 66)); + //dc.SetTextForeground(wxColour(0, 174, 66)); + dc.SetTextForeground(wxColour(0x9A5F21)); DrawTextWithEllipsis(dc, get_state_device(), FromDIP(DEVICE_LEFT_PRO_INFO), left); } else if (state_device == 2) @@ -386,7 +388,8 @@ void MultiTaskItem::doRender(wxDC& dc) } else if (state_device > 2 && state_device < 7) { dc.SetFont(Label::Body_12); - dc.SetTextForeground(wxColour(0, 174, 66)); + //dc.SetTextForeground(wxColour(0, 174, 66)); + dc.SetTextForeground(wxColour(0x9A5F21)); if (obj_->get_curr_stage().IsEmpty()) { //wxString layer_info = wxString::Format(_L("Layer: %d/%d"), obj_->curr_layer, obj_->total_layers); wxString progress_info = wxString::Format("%d", obj_->subtask_->task_progress); @@ -398,8 +401,10 @@ void MultiTaskItem::doRender(wxDC& dc) dc.SetBrush(wxBrush(wxColour(233, 233, 233))); dc.DrawRoundedRectangle(left, FromDIP(30), FromDIP(TASK_LEFT_PRO_INFO), FromDIP(10), 2); - dc.SetPen(wxPen(wxColour(0, 174, 66))); - dc.SetBrush(wxBrush(wxColour(0, 174, 66))); + //dc.SetPen(wxPen(wxColour(0, 174, 66))); + dc.SetPen(wxPen(wxColour(0x9A5F21))); + //dc.SetBrush(wxBrush(wxColour(0, 174, 66))); + dc.SetBrush(wxBrush(wxColour(0x9A5F21))); dc.DrawRoundedRectangle(left, FromDIP(30), FromDIP(TASK_LEFT_PRO_INFO) * (static_cast(obj_->subtask_->task_progress) / 100.0f), FromDIP(10), 2); } else { @@ -422,8 +427,10 @@ void MultiTaskItem::doRender(wxDC& dc) dc.SetBrush(wxBrush(wxColour(233, 233, 233))); dc.DrawRoundedRectangle(left, FromDIP(30), FromDIP(TASK_LEFT_PRO_INFO), FromDIP(10), 2); - dc.SetPen(wxPen(wxColour(0, 174, 66))); - dc.SetBrush(wxBrush(wxColour(0, 174, 66))); + //dc.SetPen(wxPen(wxColour(0, 174, 66))); + dc.SetPen(wxPen(wxColour(0x9A5F21))); + //dc.SetBrush(wxBrush(wxColour(0, 174, 66))); + dc.SetBrush(wxBrush(wxColour(0x9A5F21))); dc.DrawRoundedRectangle(left, FromDIP(30), FromDIP(TASK_LEFT_PRO_INFO) * (static_cast(m_sending_percent) / 100.0f), FromDIP(10), 2); } /*else { @@ -449,7 +456,8 @@ void MultiTaskItem::doRender(wxDC& dc) left += FromDIP(TASK_LEFT_SEND_TIME); if (m_hover) { - dc.SetPen(wxPen(wxColour(0, 174, 66))); + //dc.SetPen(wxPen(wxColour(0, 174, 66))); + dc.SetPen(wxPen(wxColour(0x9A5F21))); dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.DrawRoundedRectangle(0, 0, size.x, size.y, 3); } diff --git a/slic3r/GUI/Notebook.cpp b/slic3r/GUI/Notebook.cpp index a6bec54..a0a7a99 100644 --- a/slic3r/GUI/Notebook.cpp +++ b/slic3r/GUI/Notebook.cpp @@ -157,8 +157,10 @@ void ButtonsListCtrl::SetSelection(int sel) m_selection = sel; StateColor bg_color = StateColor( - std::pair{wxColour(0, 174, 66), (int) StateColor::Hovered}, - std::pair{wxColour(0,174, 66), (int) StateColor::Normal}); + //std::pair{wxColour(0, 174, 66), (int) StateColor::Hovered}, + std::pair{ wxColour(0x9A5F21), (int) StateColor::Hovered}, + //std::pair{wxColour(0,174, 66), (int) StateColor::Normal}); + std::pair{ wxColour(0x9A5F21), (int) StateColor::Normal}); m_pageButtons[m_selection]->SetBackgroundColor(bg_color); StateColor text_color = StateColor( diff --git a/slic3r/GUI/ObjColorDialog.cpp b/slic3r/GUI/ObjColorDialog.cpp index 6b68bea..a64027b 100644 --- a/slic3r/GUI/ObjColorDialog.cpp +++ b/slic3r/GUI/ObjColorDialog.cpp @@ -42,7 +42,8 @@ static const char g_min_cluster_color = 1; static const char g_max_color = 16; const StateColor ok_btn_bg(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); const StateColor ok_btn_disable_bg(std::pair(wxColour(205, 201, 201), StateColor::Pressed), std::pair(wxColour(205, 201, 201), StateColor::Hovered), std::pair(wxColour(205, 201, 201), StateColor::Normal)); @@ -52,7 +53,8 @@ wxBoxSizer* ObjColorDialog::create_btn_sizer(long flags) btn_sizer->AddStretchSpacer(); StateColor ok_btn_bd( - std::pair(wxColour(0, 174, 66), StateColor::Normal) + //std::pair(wxColour(0, 174, 66), StateColor::Normal) + std::pair(wxColour(0x9A5F21), StateColor::Normal) ); StateColor ok_btn_text( std::pair(wxColour(255, 255, 254), StateColor::Normal) @@ -71,10 +73,12 @@ wxBoxSizer* ObjColorDialog::create_btn_sizer(long flags) StateColor calc_btn_bg( std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal) + //std::pair(wxColour(0, 174, 66), StateColor::Normal) + std::pair(wxColour(0x9A5F21), StateColor::Normal) ); StateColor calc_btn_bd( - std::pair(wxColour(0, 174, 66), StateColor::Normal) + //std::pair(wxColour(0, 174, 66), StateColor::Normal) + std::pair(wxColour(0x9A5F21), StateColor::Normal) ); StateColor calc_btn_text( std::pair(wxColour(255, 255, 254), StateColor::Normal) @@ -396,8 +400,10 @@ wxBoxSizer *ObjColorPanel::create_approximate_match_btn_sizer(wxWindow *parent) { auto btn_sizer = new wxBoxSizer(wxHORIZONTAL); StateColor calc_btn_bg(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); - StateColor calc_btn_bd(std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); + //StateColor calc_btn_bd(std::pair(wxColour(0, 174, 66), StateColor::Normal)); + StateColor calc_btn_bd(std::pair(wxColour(0x9A5F21), StateColor::Normal)); StateColor calc_btn_text(std::pair(wxColour(255, 255, 254), StateColor::Normal)); //create btn m_quick_approximate_match_btn = new Button(parent, _L("Color match")); @@ -421,8 +427,10 @@ wxBoxSizer *ObjColorPanel::create_add_btn_sizer(wxWindow *parent) { auto btn_sizer = new wxBoxSizer(wxHORIZONTAL); StateColor calc_btn_bg(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); - StateColor calc_btn_bd(std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); + //StateColor calc_btn_bd(std::pair(wxColour(0, 174, 66), StateColor::Normal)); + StateColor calc_btn_bd(std::pair(wxColour(0x9A5F21), StateColor::Normal)); StateColor calc_btn_text(std::pair(wxColour(255, 255, 254), StateColor::Normal)); // create btn m_quick_add_btn = new Button(parent, _L("Append")); @@ -446,8 +454,10 @@ wxBoxSizer *ObjColorPanel::create_reset_btn_sizer(wxWindow *parent) { auto btn_sizer = new wxBoxSizer(wxHORIZONTAL); StateColor calc_btn_bg(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); - StateColor calc_btn_bd(std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); + //StateColor calc_btn_bd(std::pair(wxColour(0, 174, 66), StateColor::Normal)); + StateColor calc_btn_bd(std::pair(wxColour(0x9A5F21), StateColor::Normal)); StateColor calc_btn_text(std::pair(wxColour(255, 255, 254), StateColor::Normal)); // create btn m_quick_reset_btn = new Button(parent, _L("Reset")); diff --git a/slic3r/GUI/ParamsPanel.cpp b/slic3r/GUI/ParamsPanel.cpp index ac23cfa..1c25151 100644 --- a/slic3r/GUI/ParamsPanel.cpp +++ b/slic3r/GUI/ParamsPanel.cpp @@ -62,10 +62,12 @@ TipsDialog::TipsDialog(wxWindow *parent, const wxString &title, const wxString & m_confirm = new Button(this, _L("OK")); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_confirm->SetBackgroundColor(btn_bg_green); - m_confirm->SetBorderColor(wxColour(0, 174, 66)); + //m_confirm->SetBorderColor(wxColour(0, 174, 66)); + m_confirm->SetBorderColor(wxColour(0x9A5F21)); m_confirm->SetTextColor(wxColour(255, 255, 255)); m_confirm->SetSize(TIPS_DIALOG_BUTTON_SIZE); m_confirm->SetMinSize(TIPS_DIALOG_BUTTON_SIZE); diff --git a/slic3r/GUI/PlateSettingsDialog.cpp b/slic3r/GUI/PlateSettingsDialog.cpp index 40bbf27..3512689 100644 --- a/slic3r/GUI/PlateSettingsDialog.cpp +++ b/slic3r/GUI/PlateSettingsDialog.cpp @@ -451,7 +451,8 @@ PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, const wxString& title auto sizer_button = new wxBoxSizer(wxHORIZONTAL); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), std::pair(*wxWHITE, StateColor::Normal)); @@ -656,7 +657,8 @@ PlateNameEditDialog::PlateNameEditDialog(wxWindow *parent, wxWindowID id, const auto sizer_button = new wxBoxSizer(wxHORIZONTAL); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), std::pair(*wxWHITE, StateColor::Normal)); diff --git a/slic3r/GUI/Plater.cpp b/slic3r/GUI/Plater.cpp index c440520..6b24164 100644 --- a/slic3r/GUI/Plater.cpp +++ b/slic3r/GUI/Plater.cpp @@ -845,8 +845,10 @@ Sidebar::Sidebar(Plater *parent) std::pair(wxColour(107, 107, 106), StateColor::Hovered), std::pair(wxColour(107, 107, 106), StateColor::Normal)); - StateColor flush_bd_col(std::pair(wxColour(0, 174, 66), StateColor::Pressed), - std::pair(wxColour(0, 174, 66), StateColor::Hovered), + //StateColor flush_bd_col(std::pair(wxColour(0, 174, 66), StateColor::Pressed), + StateColor flush_bd_col(std::pair(wxColour(0x9A5F21), StateColor::Pressed), + //std::pair(wxColour(0, 174, 66), StateColor::Hovered), + std::pair(wxColour(0x9A5F21), StateColor::Hovered), std::pair(wxColour(172, 172, 172), StateColor::Normal)); p->m_flushing_volume_btn->SetBackgroundColor(flush_bg_col); @@ -9768,6 +9770,7 @@ void Plater::calib_max_vol_speed(const Calib_Params ¶ms) auto new_params = params; auto mm3_per_mm = Flow(line_width, layer_height, nozzle_diameter).mm3_per_mm() * filament_config->option("filament_flow_ratio")->get_at(0); + //auto mm3_per_mm = Flow(line_width, layer_height, nozzle_diameter).mm3_per_mm() * filament_config->option("fibre_feed_rate")->get_at(0); new_params.end = params.end / mm3_per_mm; new_params.start = params.start / mm3_per_mm; new_params.step = params.step / mm3_per_mm; @@ -9782,7 +9785,6 @@ void Plater::calib_retraction(const Calib_Params ¶ms) js["cali_type"] = "third_cali_retraction"; std::string filament_id = wxGetApp().preset_bundle->filaments.get_edited_preset().filament_id; js["filament_id"] = filament_id; - NetworkAgent *agent = GUI::wxGetApp().getAgent(); if (agent) agent->track_event("third_cali", js.dump()); } catch (...) {} @@ -10216,10 +10218,12 @@ ProjectDropDialog::ProjectDropDialog(const std::string &filename) m_confirm = new Button(this, _L("OK")); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_confirm->SetBackgroundColor(btn_bg_green); - m_confirm->SetBorderColor(wxColour(0, 174, 66)); + //m_confirm->SetBorderColor(wxColour(0, 174, 66)); + m_confirm->SetBorderColor(wxColour(0x9A5F21)); m_confirm->SetTextColor(wxColour("#FFFFFE")); m_confirm->SetSize(PROJECT_DROP_DIALOG_BUTTON_SIZE); m_confirm->SetMinSize(PROJECT_DROP_DIALOG_BUTTON_SIZE); diff --git a/slic3r/GUI/PrivacyUpdateDialog.cpp b/slic3r/GUI/PrivacyUpdateDialog.cpp index c048962..66eb7f6 100644 --- a/slic3r/GUI/PrivacyUpdateDialog.cpp +++ b/slic3r/GUI/PrivacyUpdateDialog.cpp @@ -67,7 +67,8 @@ PrivacyUpdateDialog::PrivacyUpdateDialog(wxWindow* parent, wxWindowID id, const auto sizer_button = new wxBoxSizer(wxHORIZONTAL); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(220, 220, 220), StateColor::Hovered), std::pair(wxColour(238, 238, 238), StateColor::Normal)); diff --git a/slic3r/GUI/Project.hpp b/slic3r/GUI/Project.hpp index ab9f96a..139ffda 100644 --- a/slic3r/GUI/Project.hpp +++ b/slic3r/GUI/Project.hpp @@ -37,7 +37,8 @@ #define AUFILE_GREY500 wxColour(158, 158, 158) #define AUFILE_GREY300 wxColour(238, 238, 238) #define AUFILE_GREY200 wxColour(248, 248, 248) -#define AUFILE_BRAND wxColour(0, 174, 66) +//#define AUFILE_BRAND wxColour(0, 174, 66) +#define AUFILE_BRAND wxColour(0x9A5F21) #define AUFILE_BRAND_TRANSPARENT wxColour(215, 232, 222) //#define AUFILE_PICTURES_SIZE wxSize(FromDIP(300), FromDIP(300)) //#define AUFILE_PICTURES_PANEL_SIZE wxSize(FromDIP(300), FromDIP(340)) diff --git a/slic3r/GUI/PublishDialog.cpp b/slic3r/GUI/PublishDialog.cpp index 7a7f6f1..e5fb792 100644 --- a/slic3r/GUI/PublishDialog.cpp +++ b/slic3r/GUI/PublishDialog.cpp @@ -95,7 +95,8 @@ PublishDialog::PublishDialog(Plater *plater) std::pair(TEXT_LIGHT_GRAY, StateColor::Normal)); m_btn_cancel->SetFont(Label::Body_12); m_btn_cancel->SetBackgroundColor(btn_bg_green); - m_btn_cancel->SetBorderColor(wxColour(0, 174, 66)); + //m_btn_cancel->SetBorderColor(wxColour(0, 174, 66)); + m_btn_cancel->SetBorderColor(wxColour(0x9A5F21)); m_btn_cancel->SetTextColor(text_color); m_btn_cancel->SetSize(wxSize(FromDIP(60), FromDIP(20))); m_btn_cancel->SetMinSize(wxSize(FromDIP(60), FromDIP(20))); diff --git a/slic3r/GUI/RecenterDialog.cpp b/slic3r/GUI/RecenterDialog.cpp index 5e7b46c..3b863d0 100644 --- a/slic3r/GUI/RecenterDialog.cpp +++ b/slic3r/GUI/RecenterDialog.cpp @@ -35,9 +35,11 @@ RecenterDialog::RecenterDialog(wxWindow* parent, wxWindowID id, const wxString& m_button_confirm->SetMinSize(wxSize(-1, FromDIP(24))); m_button_confirm->SetCornerRadius(FromDIP(12)); StateColor confirm_btn_bg(std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_button_confirm->SetBackgroundColor(confirm_btn_bg); - m_button_confirm->SetBorderColor(wxColour(0, 174, 66)); + //m_button_confirm->SetBorderColor(wxColour(0, 174, 66)); + m_button_confirm->SetBorderColor(wxColour(0x9A5F21)); m_button_confirm->SetTextColor(*wxWHITE); m_button_close = new Button(this, _L("Close")); diff --git a/slic3r/GUI/SavePresetDialog.cpp b/slic3r/GUI/SavePresetDialog.cpp index 19a4cce..ccf9232 100644 --- a/slic3r/GUI/SavePresetDialog.cpp +++ b/slic3r/GUI/SavePresetDialog.cpp @@ -352,9 +352,11 @@ void SavePresetDialog::build(std::vector types, std::string suffix StateColor btn_bg_green(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); StateColor btn_br_green(std::pair(wxColour(144, 144, 144), StateColor::Disabled), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_confirm->SetBackgroundColor(btn_bg_green); m_confirm->SetBorderColor(btn_br_green); m_confirm->SetTextColor(wxColour("#FFFFFE")); diff --git a/slic3r/GUI/SelectMachine.cpp b/slic3r/GUI/SelectMachine.cpp index fa7ab16..e668b5b 100644 --- a/slic3r/GUI/SelectMachine.cpp +++ b/slic3r/GUI/SelectMachine.cpp @@ -1138,7 +1138,8 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_sizer_backup = new wxBoxSizer(wxHORIZONTAL); m_ams_backup_tip = new Label(this, _L("Auto Refill")); m_ams_backup_tip->SetFont(::Label::Head_12); - m_ams_backup_tip->SetForegroundColour(wxColour(0x00AE42)); + //m_ams_backup_tip->SetForegroundColour(wxColour(0x00AE42)); + m_ams_backup_tip->SetForegroundColour(wxColour(0x9A5F21)); m_ams_backup_tip->SetBackgroundColour(*wxWHITE); img_ams_backup = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("automatic_material_renewal", this, 16), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0); img_ams_backup->SetBackgroundColour(*wxWHITE); @@ -1183,7 +1184,8 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_sizer_printer->Add(m_comboBox_printer, 1, wxEXPAND | wxRIGHT, FromDIP(5)); m_btn_bg_enable = StateColor(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_button_refresh = new Button(this, _L("Refresh")); m_button_refresh->SetBackgroundColor(m_btn_bg_enable); @@ -1275,7 +1277,8 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_statictext_finish = new wxStaticText(m_panel_finish, wxID_ANY, L("send completed"), wxDefaultPosition, wxDefaultSize, 0); m_statictext_finish->Wrap(-1); - m_statictext_finish->SetForegroundColour(wxColour(0, 174, 66)); + //m_statictext_finish->SetForegroundColour(wxColour(0, 174, 66)); + m_statictext_finish->SetForegroundColour(wxColour(0x9A5F21)); m_sizer_finish_h->Add(m_statictext_finish, 0, wxALIGN_CENTER | wxALL, FromDIP(5)); m_sizer_finish_v->Add(m_sizer_finish_h, 1, wxALIGN_CENTER, 0); @@ -2685,7 +2688,8 @@ wxString SelectMachineDialog::format_steel_name(std::string name) void SelectMachineDialog::Enable_Auto_Refill(bool enable) { if (enable) { - m_ams_backup_tip->SetForegroundColour(wxColour(0x00AE42)); + //m_ams_backup_tip->SetForegroundColour(wxColour(0x00AE42)); + m_ams_backup_tip->SetForegroundColour(wxColour(0x9A5F21)); } else { m_ams_backup_tip->SetForegroundColour(wxColour(0x90, 0x90, 0x90)); @@ -4720,9 +4724,11 @@ EditDevNameDialog::EditDevNameDialog(Plater *plater /*= nullptr*/) m_button_confirm = new Button(this, _L("Confirm")); - StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(0, 174, 66), StateColor::Normal)); + StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_button_confirm->SetBackgroundColor(btn_bg_green); - m_button_confirm->SetBorderColor(wxColour(0, 174, 66)); + //m_button_confirm->SetBorderColor(wxColour(0, 174, 66)); + m_button_confirm->SetBorderColor(wxColour(0x9A5F21)); m_button_confirm->SetTextColor(wxColour(255, 255, 255)); m_button_confirm->SetSize(wxSize(FromDIP(72), FromDIP(24))); m_button_confirm->SetMinSize(wxSize(FromDIP(72), FromDIP(24))); diff --git a/slic3r/GUI/SelectMachine.hpp b/slic3r/GUI/SelectMachine.hpp index 29eb042..08efa22 100644 --- a/slic3r/GUI/SelectMachine.hpp +++ b/slic3r/GUI/SelectMachine.hpp @@ -197,7 +197,8 @@ protected: #define SELECT_MACHINE_GREY900 wxColour(38, 46, 48) #define SELECT_MACHINE_GREY600 wxColour(144,144,144) #define SELECT_MACHINE_GREY400 wxColour(206, 206, 206) -#define SELECT_MACHINE_BRAND wxColour(0, 174, 66) +//#define SELECT_MACHINE_BRAND wxColour(0, 174, 66) +#define SELECT_MACHINE_BRAND wxColour(0x9A5F21) #define SELECT_MACHINE_REMIND wxColour(255,111,0) #define SELECT_MACHINE_LIGHT_GREEN wxColour(219, 253, 231) diff --git a/slic3r/GUI/SendMultiMachinePage.cpp b/slic3r/GUI/SendMultiMachinePage.cpp index a7a51a8..a4e747c 100644 --- a/slic3r/GUI/SendMultiMachinePage.cpp +++ b/slic3r/GUI/SendMultiMachinePage.cpp @@ -207,7 +207,8 @@ void SendDeviceItem::doRender(wxDC& dc) //device state if (state_printable <= 2) { - dc.SetTextForeground(wxColour(0, 174, 66)); + //dc.SetTextForeground(wxColour(0, 174, 66)); + dc.SetTextForeground(wxColour(0x9A5F21)); } else { dc.SetTextForeground(wxColour(208, 27, 27)); @@ -232,7 +233,8 @@ void SendDeviceItem::doRender(wxDC& dc) } if (m_hover) { - dc.SetPen(wxPen(wxColour(0, 174, 66))); + //dc.SetPen(wxPen(wxColour(0, 174, 66))); + dc.SetPen(wxPen(wxColour(0x9A5F21))); dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.DrawRoundedRectangle(0, 0, size.x, size.y, 3); } @@ -1265,7 +1267,8 @@ wxPanel* SendMultiMachinePage::create_page() auto m_btn_bg_enable = StateColor( std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal) + //std::pair(wxColour(0, 174, 66), StateColor::Normal) + std::pair(wxColour(0x9A5F21), StateColor::Normal) ); m_button_add = new Button(main_page, _L("Add")); @@ -1326,7 +1329,8 @@ wxPanel* SendMultiMachinePage::create_page() // add send button btn_bg_enable = StateColor(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_button_send = new Button(main_page, _L("Send")); m_button_send->SetBackgroundColor(btn_bg_enable); diff --git a/slic3r/GUI/SendToPrinter.cpp b/slic3r/GUI/SendToPrinter.cpp index 023ed1e..5e296c3 100644 --- a/slic3r/GUI/SendToPrinter.cpp +++ b/slic3r/GUI/SendToPrinter.cpp @@ -250,7 +250,8 @@ SendToPrinterDialog::SendToPrinterDialog(Plater *plater) m_sizer_printer->Add(m_comboBox_printer, 1, wxEXPAND | wxRIGHT, FromDIP(5)); btn_bg_enable = StateColor(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); m_button_refresh = new Button(this, _L("Refresh")); m_button_refresh->SetBackgroundColor(btn_bg_enable); @@ -314,7 +315,8 @@ SendToPrinterDialog::SendToPrinterDialog(Plater *plater) m_statictext_finish = new wxStaticText(m_panel_finish, wxID_ANY, L("send completed"), wxDefaultPosition, wxDefaultSize, 0); m_statictext_finish->Wrap(-1); - m_statictext_finish->SetForegroundColour(wxColour(0, 174, 66)); + //m_statictext_finish->SetForegroundColour(wxColour(0, 174, 66)); + m_statictext_finish->SetForegroundColour(wxColour(0x9A5F21)); m_sizer_finish_h->Add(m_statictext_finish, 0, wxALIGN_CENTER | wxALL, FromDIP(5)); m_sizer_finish_v->Add(m_sizer_finish_h, 1, wxALIGN_CENTER, 0); diff --git a/slic3r/GUI/SlicingProgressNotification.cpp b/slic3r/GUI/SlicingProgressNotification.cpp index 7ddd974..dcb2a31 100644 --- a/slic3r/GUI/SlicingProgressNotification.cpp +++ b/slic3r/GUI/SlicingProgressNotification.cpp @@ -366,7 +366,8 @@ void Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_bar(c ImGuiWrapper& imgui = *wxGetApp().imgui(); - ImColor progress_color = ImColor(0, 174, 66, (int)(255 * m_current_fade_opacity)); + //ImColor progress_color = ImColor(0, 174, 66, (int)(255 * m_current_fade_opacity)); + ImColor progress_color = ImColor(33, 95, 154, (int)(255 * m_current_fade_opacity)); ImColor bg_color = ImColor(217, 217, 217, (int)(255 * m_current_fade_opacity)); ImVec2 lineStart = pos; diff --git a/slic3r/GUI/StatusPanel.cpp b/slic3r/GUI/StatusPanel.cpp index 3573cfa..4415406 100644 --- a/slic3r/GUI/StatusPanel.cpp +++ b/slic3r/GUI/StatusPanel.cpp @@ -46,13 +46,15 @@ static const wxColour STATIC_BOX_LINE_COL = wxColour(238, 238, 238); static const wxColour BUTTON_NORMAL1_COL = wxColour(238, 238, 238); static const wxColour BUTTON_NORMAL2_COL = wxColour(206, 206, 206); static const wxColour BUTTON_PRESS_COL = wxColour(172, 172, 172); -static const wxColour BUTTON_HOVER_COL = wxColour(0, 174, 66); +//static const wxColour BUTTON_HOVER_COL = wxColour(0, 174, 66); +static const wxColour BUTTON_HOVER_COL = wxColour(0x9A5F21); static const wxColour DISCONNECT_TEXT_COL = wxColour(171, 172, 172); static const wxColour NORMAL_TEXT_COL = wxColour(48,58,60); static const wxColour NORMAL_FAN_TEXT_COL = wxColour(107, 107, 107); static const wxColour WARNING_INFO_BG_COL = wxColour(255, 111, 0); -static const wxColour STAGE_TEXT_COL = wxColour(0, 174, 66); +//static const wxColour STAGE_TEXT_COL = wxColour(0, 174, 66); +static const wxColour STAGE_TEXT_COL = wxColour(0x9A5F21); static const wxColour GROUP_STATIC_LINE_COL = wxColour(206, 206, 206); @@ -336,12 +338,14 @@ void PrintingTaskPanel::create_panel(wxWindow* parent) m_staticText_progress_percent = new wxStaticText(penel_text, wxID_ANY, "0", wxDefaultPosition, wxDefaultSize, 0); m_staticText_progress_percent->SetFont(::Label::Head_18); m_staticText_progress_percent->SetMaxSize(wxSize(-1, FromDIP(20))); - m_staticText_progress_percent->SetForegroundColour(wxColour(0, 174, 66)); + //m_staticText_progress_percent->SetForegroundColour(wxColour(0, 174, 66)); + m_staticText_progress_percent->SetForegroundColour(wxColour(0x9A5F21)); m_staticText_progress_percent_icon = new wxStaticText(penel_text, wxID_ANY, "%", wxDefaultPosition, wxDefaultSize, 0); m_staticText_progress_percent_icon->SetFont(::Label::Body_11); m_staticText_progress_percent_icon->SetMaxSize(wxSize(-1, FromDIP(13))); - m_staticText_progress_percent_icon->SetForegroundColour(wxColour(0, 174, 66)); + //m_staticText_progress_percent_icon->SetForegroundColour(wxColour(0, 174, 66)); + m_staticText_progress_percent_icon->SetForegroundColour(wxColour(0x9A5F21)); sizer_percent->Add(m_staticText_progress_percent, 0, 0, 0); @@ -1231,7 +1235,8 @@ wxBoxSizer *StatusBasePanel::create_misc_control(wxWindow *parent) m_switch_nozzle_fan->SetTextColor(StateColor(std::make_pair(DISCONNECT_TEXT_COL, (int) StateColor::Disabled), std::make_pair(NORMAL_FAN_TEXT_COL, (int) StateColor::Normal))); m_switch_nozzle_fan->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) { - m_fan_panel->SetBackgroundColor(wxColour(0, 174, 66)); + //m_fan_panel->SetBackgroundColor(wxColour(0, 174, 66)); + m_fan_panel->SetBackgroundColor(wxColour(0x9A5F21)); }); m_switch_nozzle_fan->Bind(wxEVT_LEAVE_WINDOW, [this, parent](auto& e) { @@ -1251,7 +1256,8 @@ wxBoxSizer *StatusBasePanel::create_misc_control(wxWindow *parent) StateColor(std::make_pair(DISCONNECT_TEXT_COL, (int) StateColor::Disabled), std::make_pair(NORMAL_FAN_TEXT_COL, (int) StateColor::Normal))); m_switch_printing_fan->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) { - m_fan_panel->SetBackgroundColor(wxColour(0, 174, 66)); + //m_fan_panel->SetBackgroundColor(wxColour(0, 174, 66)); + m_fan_panel->SetBackgroundColor(wxColour(0x9A5F21)); }); m_switch_printing_fan->Bind(wxEVT_LEAVE_WINDOW, [this, parent](auto& e) { @@ -1271,7 +1277,8 @@ wxBoxSizer *StatusBasePanel::create_misc_control(wxWindow *parent) StateColor(std::make_pair(DISCONNECT_TEXT_COL, (int)StateColor::Disabled), std::make_pair(NORMAL_FAN_TEXT_COL, (int)StateColor::Normal))); m_switch_cham_fan->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) { - m_fan_panel->SetBackgroundColor(wxColour(0, 174, 66)); + //m_fan_panel->SetBackgroundColor(wxColour(0, 174, 66)); + m_fan_panel->SetBackgroundColor(wxColour(0x9A5F21)); }); m_switch_cham_fan->Bind(wxEVT_LEAVE_WINDOW, [this, parent](auto& e) { diff --git a/slic3r/GUI/TabButton.cpp b/slic3r/GUI/TabButton.cpp index d4e22c0..a8754a0 100644 --- a/slic3r/GUI/TabButton.cpp +++ b/slic3r/GUI/TabButton.cpp @@ -14,7 +14,8 @@ EVT_PAINT(TabButton::paintEvent) END_EVENT_TABLE() -static wxColour BORDER_HOVER_COL = wxColour(0, 174, 66); +//static wxColour BORDER_HOVER_COL = wxColour(0, 174, 66); +static wxColour BORDER_HOVER_COL = wxColour(0x9A5F21); const static wxColour TAB_BUTTON_BG = wxColour("#FEFFFF"); const static wxColour TAB_BUTTON_SEL = wxColour(219, 253, 213, 255); diff --git a/slic3r/GUI/UnsavedChangesDialog.cpp b/slic3r/GUI/UnsavedChangesDialog.cpp index 427fb4c..b8b49e2 100644 --- a/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/slic3r/GUI/UnsavedChangesDialog.cpp @@ -976,7 +976,8 @@ void UnsavedChangesDialog::build(Preset::Type type, PresetCollection *dependent_ // Add Buttons wxFont btn_font = this->GetFont().Scaled(1.4f); StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); auto add_btn = [this, m_sizer_button, btn_font, dependent_presets, btn_bg_green](Button **btn, int &btn_id, const std::string &icon_name, Action close_act, const wxString &label, bool focus, bool process_enable = true) { @@ -984,7 +985,8 @@ void UnsavedChangesDialog::build(Preset::Type type, PresetCollection *dependent_ if (focus) { (*btn)->SetBackgroundColor(btn_bg_green); - (*btn)->SetBorderColor(wxColour(0, 174, 66)); + //(*btn)->SetBorderColor(wxColour(0, 174, 66)); + (*btn)->SetBorderColor(wxColour(0x9A5F21)); (*btn)->SetTextColor(wxColour("#FFFFFE")); } else { (*btn)->SetTextColor(wxColour(107, 107, 107)); diff --git a/slic3r/GUI/UpgradePanel.cpp b/slic3r/GUI/UpgradePanel.cpp index 8cb558e..650aba4 100644 --- a/slic3r/GUI/UpgradePanel.cpp +++ b/slic3r/GUI/UpgradePanel.cpp @@ -9,7 +9,8 @@ namespace Slic3r { namespace GUI { -static const wxColour TEXT_NORMAL_CLR = wxColour(0, 174, 66); +//static const wxColour TEXT_NORMAL_CLR = wxColour(0, 174, 66); +static const wxColour TEXT_NORMAL_CLR = wxColour(0x9A5F21); static const wxColour TEXT_FAILED_CLR = wxColour(255, 111, 0); enum FIRMWARE_STASUS @@ -208,9 +209,12 @@ MachineInfoPanel::MachineInfoPanel(wxWindow* parent, wxWindowID id, const wxPoin m_button_upgrade_firmware = new Button(this, _L("Update firmware")); StateColor btn_bg(std::pair(wxColour(255, 255, 255), StateColor::Disabled), std::pair(wxColour(27, 136, 68), StateColor::Pressed), - std::pair(wxColour(61, 203, 115), StateColor::Hovered), std::pair(wxColour(0, 174, 66), StateColor::Enabled), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); - StateColor btn_bd(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(0, 174, 66), StateColor::Enabled)); + //std::pair(wxColour(61, 203, 115), StateColor::Hovered), std::pair(wxColour(0, 174, 66), StateColor::Enabled), + std::pair(wxColour(61, 203, 115), StateColor::Hovered), std::pair(wxColour(0x9A5F21), StateColor::Enabled), + //std::pair(wxColour(0, 174, 66), StateColor::Normal)); + std::pair(wxColour(0x9A5F21), StateColor::Normal)); + //StateColor btn_bd(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(0, 174, 66), StateColor::Enabled)); + StateColor btn_bd(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(0x9A5F21), StateColor::Enabled)); StateColor btn_text(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(255, 255, 255), StateColor::Enabled)); m_button_upgrade_firmware->SetBackgroundColor(btn_bg); m_button_upgrade_firmware->SetBorderColor(btn_bd); diff --git a/slic3r/GUI/Widgets/AMSControl.cpp b/slic3r/GUI/Widgets/AMSControl.cpp index 58603d0..381e9dc 100644 --- a/slic3r/GUI/Widgets/AMSControl.cpp +++ b/slic3r/GUI/Widgets/AMSControl.cpp @@ -2446,7 +2446,8 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons //backup tips m_ams_backup_tip = new Label(m_amswin, _L("Auto Refill")); m_ams_backup_tip->SetFont(::Label::Head_12); - m_ams_backup_tip->SetForegroundColour(wxColour(0x00AE42)); + //m_ams_backup_tip->SetForegroundColour(wxColour(0x00AE42)); + m_ams_backup_tip->SetForegroundColour(wxColour(0x9A5F21)); m_ams_backup_tip->SetBackgroundColour(*wxWHITE); m_img_ams_backup = new wxStaticBitmap(m_amswin, wxID_ANY, create_scaled_bitmap("automatic_material_renewal", this, 16), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0); m_img_ams_backup->SetBackgroundColour(*wxWHITE); diff --git a/slic3r/GUI/Widgets/AMSControl.hpp b/slic3r/GUI/Widgets/AMSControl.hpp index 6d01805..992cfc8 100644 --- a/slic3r/GUI/Widgets/AMSControl.hpp +++ b/slic3r/GUI/Widgets/AMSControl.hpp @@ -13,7 +13,8 @@ #include #include -#define AMS_CONTROL_BRAND_COLOUR wxColour(0, 174, 66) +//#define AMS_CONTROL_BRAND_COLOUR wxColour(0, 174, 66) +#define AMS_CONTROL_BRAND_COLOUR wxColour(0x9A5F21) #define AMS_CONTROL_GRAY700 wxColour(107, 107, 107) #define AMS_CONTROL_GRAY800 wxColour(50, 58, 61) #define AMS_CONTROL_GRAY500 wxColour(172, 172, 172) diff --git a/slic3r/GUI/Widgets/AxisCtrlButton.cpp b/slic3r/GUI/Widgets/AxisCtrlButton.cpp index 737fe79..a25bcc3 100644 --- a/slic3r/GUI/Widgets/AxisCtrlButton.cpp +++ b/slic3r/GUI/Widgets/AxisCtrlButton.cpp @@ -9,7 +9,8 @@ StateColor blank_bg(StateColor(std::make_pair(wxColour("#FFFFFF"), (int)StateCol static const wxColour BUTTON_BG_COL = wxColour("#EEEEEE"); static const wxColour BUTTON_IN_BG_COL = wxColour("#CECECE"); -static const wxColour bd = wxColour(0, 174, 66); +//static const wxColour bd = wxColour(0, 174, 66); +static const wxColour bd = wxColour(0x9A5F21); static const wxColour text_num_color = wxColour(0x898989); static const wxColour BUTTON_PRESS_COL = wxColour(172, 172, 172); static const double sqrt2 = std::sqrt(2); diff --git a/slic3r/GUI/Widgets/Button.cpp b/slic3r/GUI/Widgets/Button.cpp index aa817f5..35d4903 100644 --- a/slic3r/GUI/Widgets/Button.cpp +++ b/slic3r/GUI/Widgets/Button.cpp @@ -29,8 +29,8 @@ Button::Button() background_color = StateColor( std::make_pair(0xF0F0F1, (int) StateColor::Disabled), std::make_pair(0x37EE7C, (int) StateColor::Hovered | StateColor::Checked), - std::make_pair(0x00AE42, (int) StateColor::Checked), - //std::make_pair(0x009FF3, (int) StateColor::Checked), + //std::make_pair(0x00AE42, (int) StateColor::Checked), + std::make_pair(0x215F9A, (int) StateColor::Checked), std::make_pair(*wxLIGHT_GREY, (int) StateColor::Hovered), std::make_pair(*wxWHITE, (int) StateColor::Normal)); text_color = StateColor( diff --git a/slic3r/GUI/Widgets/ComboBox.cpp b/slic3r/GUI/Widgets/ComboBox.cpp index c930b26..de6707b 100644 --- a/slic3r/GUI/Widgets/ComboBox.cpp +++ b/slic3r/GUI/Widgets/ComboBox.cpp @@ -52,7 +52,8 @@ ComboBox::ComboBox(wxWindow *parent, GetTextCtrl()->Hide(); TextInput::SetFont(Label::Body_14); TextInput::SetBorderColor(StateColor(std::make_pair(0xDBDBDB, (int) StateColor::Disabled), - std::make_pair(0x00AE42, (int) StateColor::Hovered), + //std::make_pair(0x00AE42, (int) StateColor::Hovered), + std::make_pair(0x215F9A, (int) StateColor::Hovered), std::make_pair(0xDBDBDB, (int) StateColor::Normal))); TextInput::SetBackgroundColor(StateColor(std::make_pair(0xF0F0F1, (int) StateColor::Disabled), std::make_pair(0xEDFAF2, (int) StateColor::Focused), diff --git a/slic3r/GUI/Widgets/DropDown.cpp b/slic3r/GUI/Widgets/DropDown.cpp index 1ef65e5..38a82c7 100644 --- a/slic3r/GUI/Widgets/DropDown.cpp +++ b/slic3r/GUI/Widgets/DropDown.cpp @@ -39,7 +39,8 @@ DropDown::DropDown(std::vector &texts, , state_handler(this) , border_color(0xDBDBDB) , text_color(0x363636) - , selector_border_color(std::make_pair(0x00AE42, (int) StateColor::Hovered), + //, selector_border_color(std::make_pair(0x00AE42, (int) StateColor::Hovered), + , selector_border_color(std::make_pair(0x215F9A, (int) StateColor::Hovered), std::make_pair(*wxWHITE, (int) StateColor::Normal)) , selector_background_color(std::make_pair(0xEDFAF2, (int) StateColor::Checked), std::make_pair(*wxWHITE, (int) StateColor::Normal)) diff --git a/slic3r/GUI/Widgets/ImageSwitchButton.cpp b/slic3r/GUI/Widgets/ImageSwitchButton.cpp index f4c7986..36c2ab2 100644 --- a/slic3r/GUI/Widgets/ImageSwitchButton.cpp +++ b/slic3r/GUI/Widgets/ImageSwitchButton.cpp @@ -26,7 +26,8 @@ EVT_PAINT(FanSwitchButton::paintEvent) END_EVENT_TABLE() -static const wxColour DEFAULT_HOVER_COL = wxColour(0, 174, 66); +//static const wxColour DEFAULT_HOVER_COL = wxColour(0, 174, 66); +static const wxColour DEFAULT_HOVER_COL = wxColour(0x9A5F21); static const wxColour DEFAULT_PRESS_COL = wxColour(238, 238, 238); ImageSwitchButton::ImageSwitchButton(wxWindow *parent, ScalableBitmap &img_on, ScalableBitmap &img_off, long style) diff --git a/slic3r/GUI/Widgets/ProgressBar.hpp b/slic3r/GUI/Widgets/ProgressBar.hpp index f612170..8f84ca4 100644 --- a/slic3r/GUI/Widgets/ProgressBar.hpp +++ b/slic3r/GUI/Widgets/ProgressBar.hpp @@ -30,7 +30,8 @@ public: double m_radius = {7}; double m_proportion = {0}; wxColour m_progress_background_colour = {233, 233, 233}; - wxColour m_progress_colour = {0, 174, 66}; + //wxColour m_progress_colour = {0, 174, 66}; + wxColour m_progress_colour = {33, 95, 154}; wxColour m_progress_colour_disable = {255, 111, 0}; wxString m_disable_text; diff --git a/slic3r/GUI/Widgets/SideButton.cpp b/slic3r/GUI/Widgets/SideButton.cpp index e387f33..89bb2fa 100644 --- a/slic3r/GUI/Widgets/SideButton.cpp +++ b/slic3r/GUI/Widgets/SideButton.cpp @@ -31,7 +31,8 @@ SideButton::SideButton(wxWindow* parent, wxString text, wxString icon, long stly border_color.append(0x6B6B6B, StateColor::Disabled); border_color.append(wxColour(23, 129, 63), StateColor::Pressed); border_color.append(wxColour(48,221,112), StateColor::Hovered); - border_color.append(0x00AE42, StateColor::Normal); + //border_color.append(0x00AE42, StateColor::Normal); + border_color.append(0x215F9A, StateColor::Normal); border_color.setTakeFocusedAsHovered(false); text_color.append(0xACACAC, StateColor::Disabled); @@ -41,8 +42,10 @@ SideButton::SideButton(wxWindow* parent, wxString text, wxString icon, long stly background_color.append(0x6B6B6B, StateColor::Disabled); background_color.append(wxColour(23, 129, 63), StateColor::Pressed); - background_color.append(wxColour(48, 221, 112), StateColor::Hovered); - background_color.append(0x00AE42, StateColor::Normal); + //background_color.append(wxColour(48, 221, 112), StateColor::Hovered); + background_color.append(0x0073BC, StateColor::Hovered); + //background_color.append(0x00AE42, StateColor::Normal); + background_color.append(0x215F9A, StateColor::Normal); background_color.setTakeFocusedAsHovered(false); SetBottomColour(wxColour("#3B4446")); diff --git a/slic3r/GUI/Widgets/SideTools.cpp b/slic3r/GUI/Widgets/SideTools.cpp index 1dea73f..0c33856 100644 --- a/slic3r/GUI/Widgets/SideTools.cpp +++ b/slic3r/GUI/Widgets/SideTools.cpp @@ -523,8 +523,10 @@ void SideTools::show_status(int status) else if ((status & (int)MonitorStatus::MONITOR_CONNECTING) != 0) { m_hyperlink->Hide(); m_connection_info->SetLabel(_L("Connecting...")); - m_connection_info->SetBackgroundColor(0x00AE42); - m_connection_info->SetBorderColor(0x00AE42); + //m_connection_info->SetBackgroundColor(0x00AE42); + m_connection_info->SetBackgroundColor(0x9A5F21); + //m_connection_info->SetBorderColor(0x00AE42); + m_connection_info->SetBorderColor(0x9A5F21); m_connection_info->Show(); m_more_button->Hide(); m_side_error_panel->Hide(); diff --git a/slic3r/GUI/Widgets/SideTools.hpp b/slic3r/GUI/Widgets/SideTools.hpp index 433bdc2..3bfc0c5 100644 --- a/slic3r/GUI/Widgets/SideTools.hpp +++ b/slic3r/GUI/Widgets/SideTools.hpp @@ -14,7 +14,8 @@ #define SIDE_TOOLS_GREY900 wxColour(38, 46, 48) #define SIDE_TOOLS_GREY600 wxColour(144, 144, 144) #define SIDE_TOOLS_GREY400 wxColour(206, 206, 206) -#define SIDE_TOOLS_BRAND wxColour(0, 174, 66) +//#define SIDE_TOOLS_BRAND wxColour(0, 174, 66) +#define SIDE_TOOLS_BRAND wxColour(0x9A5F21) #define SIDE_TOOLS_LIGHT_GREEN wxColour(219, 253, 231) enum WifiSignal { diff --git a/slic3r/GUI/Widgets/SpinInput.cpp b/slic3r/GUI/Widgets/SpinInput.cpp index 3f08995..7921984 100644 --- a/slic3r/GUI/Widgets/SpinInput.cpp +++ b/slic3r/GUI/Widgets/SpinInput.cpp @@ -26,7 +26,8 @@ SpinInput::SpinInput() { radius = 0; border_width = 1; - border_color = StateColor(std::make_pair(0xDBDBDB, (int) StateColor::Disabled), std::make_pair(0x00AE42, (int) StateColor::Hovered), + //border_color = StateColor(std::make_pair(0xDBDBDB, (int) StateColor::Disabled), std::make_pair(0x00AE42, (int) StateColor::Hovered), + border_color = StateColor(std::make_pair(0xDBDBDB, (int) StateColor::Disabled), std::make_pair(0x0073BC, (int) StateColor::Hovered), std::make_pair(0xDBDBDB, (int) StateColor::Normal)); background_color = StateColor(std::make_pair(0xF0F0F1, (int) StateColor::Disabled), std::make_pair(*wxWHITE, (int) StateColor::Normal)); } diff --git a/slic3r/GUI/Widgets/StepCtrl.cpp b/slic3r/GUI/Widgets/StepCtrl.cpp index 04488c1..614ebe7 100644 --- a/slic3r/GUI/Widgets/StepCtrl.cpp +++ b/slic3r/GUI/Widgets/StepCtrl.cpp @@ -23,7 +23,8 @@ StepCtrlBase::StepCtrlBase(wxWindow * parent, , font_tip(Label::Body_14) , clr_bar(0xACACAC) , clr_step(0xACACAC) - , clr_text(std::make_pair(0x00AE42, (int) StateColor::Checked), + //, clr_text(std::make_pair(0x00AE42, (int) StateColor::Checked), + , clr_text(std::make_pair(0x215F9A, (int) StateColor::Checked), std::make_pair(0x6B6B6B, (int) StateColor::Normal)) , clr_tip(0x828280) { @@ -256,7 +257,8 @@ StepIndicator::StepIndicator(wxWindow *parent, wxWindowID id, const wxPoint &pos clr_bar = 0xE1E1E1; clr_step = StateColor( std::make_pair(0xACACAC, (int) StateColor::Disabled), - std::make_pair(0x00AE42, 0)); + //std::make_pair(0x00AE42, 0)); + std::make_pair(0x215F9A, 0)); clr_text = StateColor( std::make_pair(0xACACAC, (int) StateColor::Disabled), std::make_pair(0x323A3D, (int) StateColor::Checked), diff --git a/slic3r/GUI/Widgets/TabCtrl.cpp b/slic3r/GUI/Widgets/TabCtrl.cpp index 2792457..ae535f4 100644 --- a/slic3r/GUI/Widgets/TabCtrl.cpp +++ b/slic3r/GUI/Widgets/TabCtrl.cpp @@ -303,7 +303,8 @@ void TabCtrl::doRender(wxDC& dc) #else dc.SetPen(wxPen(border_color.colorForStates(states), border_width)); dc.DrawLine(0, size.y - BS2, size.x, size.y - BS2); - wxColor c(0x42AE00); + //wxColor c(0x42AE00); + wxColor c(0x9A5F21); dc.SetPen(wxPen(c, 1)); dc.SetBrush(c); dc.DrawRoundedRectangle(x1 - radius, size.y - BS2 - border_width * 3, x2 + radius * 2 - x1, border_width * 3, radius); diff --git a/slic3r/GUI/Widgets/TempInput.cpp b/slic3r/GUI/Widgets/TempInput.cpp index 1b1d615..fa45b2b 100644 --- a/slic3r/GUI/Widgets/TempInput.cpp +++ b/slic3r/GUI/Widgets/TempInput.cpp @@ -25,7 +25,8 @@ TempInput::TempInput() { hover = false; radius = 0; - border_color = StateColor(std::make_pair(*wxWHITE, (int) StateColor::Disabled), std::make_pair(0x00AE42, (int) StateColor::Focused), std::make_pair(0x00AE42, (int) StateColor::Hovered), + //border_color = StateColor(std::make_pair(*wxWHITE, (int) StateColor::Disabled), std::make_pair(0x00AE42, (int) StateColor::Focused), std::make_pair(0x00AE42, (int) StateColor::Hovered), + border_color = StateColor(std::make_pair(*wxWHITE, (int) StateColor::Disabled), std::make_pair(0x215F9A, (int) StateColor::Focused), std::make_pair(0x215F9A, (int) StateColor::Hovered), std::make_pair(*wxWHITE, (int) StateColor::Normal)); background_color = StateColor(std::make_pair(*wxWHITE, (int) StateColor::Disabled), std::make_pair(*wxWHITE, (int) StateColor::Normal)); SetFont(Label::Body_12); @@ -371,8 +372,10 @@ void TempInput::render(wxDC &dc) if (warning_mode) { border_color = wxColour(255, 111, 0); } else { - border_color = StateColor(std::make_pair(*wxWHITE, (int) StateColor::Disabled), std::make_pair(0x00AE42, (int) StateColor::Focused), - std::make_pair(0x00AE42, (int) StateColor::Hovered), std::make_pair(*wxWHITE, (int) StateColor::Normal)); + //border_color = StateColor(std::make_pair(*wxWHITE, (int) StateColor::Disabled), std::make_pair(0x00AE42, (int) StateColor::Focused), + border_color = StateColor(std::make_pair(*wxWHITE, (int) StateColor::Disabled), std::make_pair(0x215F9A, (int) StateColor::Focused), + //std::make_pair(0x00AE42, (int) StateColor::Hovered), std::make_pair(*wxWHITE, (int) StateColor::Normal)); + std::make_pair(0x215F9A, (int) StateColor::Hovered), std::make_pair(*wxWHITE, (int) StateColor::Normal)); } dc.SetBrush(*wxTRANSPARENT_BRUSH); diff --git a/slic3r/GUI/Widgets/TextInput.cpp b/slic3r/GUI/Widgets/TextInput.cpp index e853673..7211509 100644 --- a/slic3r/GUI/Widgets/TextInput.cpp +++ b/slic3r/GUI/Widgets/TextInput.cpp @@ -25,7 +25,8 @@ TextInput::TextInput() { radius = 0; border_width = 1; - border_color = StateColor(std::make_pair(0xDBDBDB, (int) StateColor::Disabled), std::make_pair(0x00AE42, (int) StateColor::Hovered), + //border_color = StateColor(std::make_pair(0xDBDBDB, (int) StateColor::Disabled), std::make_pair(0x00AE42, (int) StateColor::Hovered), + border_color = StateColor(std::make_pair(0xDBDBDB, (int) StateColor::Disabled), std::make_pair(0x215F9A, (int) StateColor::Hovered), std::make_pair(0xDBDBDB, (int) StateColor::Normal)); background_color = StateColor(std::make_pair(0xF0F0F1, (int) StateColor::Disabled), std::make_pair(*wxWHITE, (int) StateColor::Normal)); SetFont(Label::Body_12); diff --git a/slic3r/GUI/WipeTowerDialog.cpp b/slic3r/GUI/WipeTowerDialog.cpp index eb2c6be..1dec5d3 100644 --- a/slic3r/GUI/WipeTowerDialog.cpp +++ b/slic3r/GUI/WipeTowerDialog.cpp @@ -61,11 +61,13 @@ wxBoxSizer* WipingDialog::create_btn_sizer(long flags) StateColor ok_btn_bg( std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal) + //std::pair(wxColour(0, 174, 66), StateColor::Normal) + std::pair(wxColour(0x9A5F21), StateColor::Normal) ); StateColor ok_btn_bd( - std::pair(wxColour(0, 174, 66), StateColor::Normal) + //std::pair(wxColour(0, 174, 66), StateColor::Normal) + std::pair(wxColour(0x9A5F21), StateColor::Normal) ); StateColor ok_btn_text( @@ -90,11 +92,13 @@ wxBoxSizer* WipingDialog::create_btn_sizer(long flags) StateColor calc_btn_bg( std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal) + //std::pair(wxColour(0, 174, 66), StateColor::Normal) + std::pair(wxColour(0x9A5F21), StateColor::Normal) ); StateColor calc_btn_bd( - std::pair(wxColour(0, 174, 66), StateColor::Normal) + //std::pair(wxColour(0, 174, 66), StateColor::Normal) + std::pair(wxColour(0x9A5F21), StateColor::Normal) ); StateColor calc_btn_text( @@ -146,11 +150,13 @@ wxBoxSizer* WipingPanel::create_calc_btn_sizer(wxWindow* parent) { StateColor calc_btn_bg( std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal) + //std::pair(wxColour(0, 174, 66), StateColor::Normal) + std::pair(wxColour(0x9A5F21), StateColor::Normal) ); StateColor calc_btn_bd( - std::pair(wxColour(0, 174, 66), StateColor::Normal) + //std::pair(wxColour(0, 174, 66), StateColor::Normal) + std::pair(wxColour(0x9A5F21), StateColor::Normal) ); StateColor calc_btn_text( diff --git a/slic3r/GUI/calib_dlg.cpp b/slic3r/GUI/calib_dlg.cpp index 48e7667..30af318 100644 --- a/slic3r/GUI/calib_dlg.cpp +++ b/slic3r/GUI/calib_dlg.cpp @@ -108,8 +108,10 @@ PA_Calibration_Dlg::PA_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater* m_btnStart = new Button(this, _L("OK")); StateColor btn_bg_green(std::pair(wxColour(23, 129, 63), StateColor::Pressed), - std::pair(wxColour(48, 221, 112), StateColor::Hovered), - std::pair(0x00AE42, StateColor::Normal)); + //std::pair(wxColour(48, 221, 112), StateColor::Hovered), + std::pair(0x0073BC, StateColor::Hovered), + //std::pair(0x00AE42, StateColor::Normal)); + std::pair(0x215F9A, StateColor::Normal)); m_btnStart->SetBackgroundColor(btn_bg_green); m_btnStart->SetBorderColor(wxColour(0, 150, 136)); @@ -317,8 +319,10 @@ Temp_Calibration_Dlg::Temp_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plat v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5); m_btnStart = new Button(this, _L("OK")); StateColor btn_bg_green(std::pair(wxColour(23, 129, 63), StateColor::Pressed), - std::pair(wxColour(48, 221, 112), StateColor::Hovered), - std::pair(0x00AE42, StateColor::Normal)); + //std::pair(wxColour(48, 221, 112), StateColor::Hovered), + std::pair(0x0073BC, StateColor::Hovered), + //std::pair(0x00AE42, StateColor::Normal)); + std::pair(0x215F9A, StateColor::Normal)); m_btnStart->SetBackgroundColor(btn_bg_green); m_btnStart->SetBorderColor(wxColour(0, 150, 136)); @@ -489,8 +493,10 @@ MaxVolumetricSpeed_Test_Dlg::MaxVolumetricSpeed_Test_Dlg(wxWindow* parent, wxWin v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5); m_btnStart = new Button(this, _L("OK")); StateColor btn_bg_green(std::pair(wxColour(23, 129, 63), StateColor::Pressed), - std::pair(wxColour(48, 221, 112), StateColor::Hovered), - std::pair(0x00AE42, StateColor::Normal)); + //std::pair(wxColour(48, 221, 112), StateColor::Hovered), + std::pair(0x0073BC, StateColor::Hovered), + //std::pair(0x00AE42, StateColor::Normal)); + std::pair(0x215F9A, StateColor::Normal)); m_btnStart->SetBackgroundColor(btn_bg_green); m_btnStart->SetBorderColor(wxColour(0, 150, 136)); @@ -594,8 +600,10 @@ VFA_Test_Dlg::VFA_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater) v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5); m_btnStart = new Button(this, _L("OK")); StateColor btn_bg_green(std::pair(wxColour(23, 129, 63), StateColor::Pressed), - std::pair(wxColour(48, 221, 112), StateColor::Hovered), - std::pair(0x00AE42, StateColor::Normal)); + //std::pair(wxColour(48, 221, 112), StateColor::Hovered), + std::pair(0x0073BC, StateColor::Hovered), + //std::pair(0x00AE42, StateColor::Normal)); + std::pair(0x215F9A, StateColor::Normal)); m_btnStart->SetBackgroundColor(btn_bg_green); m_btnStart->SetBorderColor(wxColour(0, 150, 136)); @@ -700,8 +708,10 @@ Retraction_Test_Dlg::Retraction_Test_Dlg(wxWindow* parent, wxWindowID id, Plater v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5); m_btnStart = new Button(this, _L("OK")); StateColor btn_bg_green(std::pair(wxColour(23, 129, 63), StateColor::Pressed), - std::pair(wxColour(48, 221, 112), StateColor::Hovered), - std::pair(0x00AE42, StateColor::Normal)); + //std::pair(wxColour(48, 221, 112), StateColor::Hovered), + std::pair(0x0073BC, StateColor::Hovered), + //std::pair(0x00AE42, StateColor::Normal)); + std::pair(0x215F9A, StateColor::Normal)); m_btnStart->SetBackgroundColor(btn_bg_green); m_btnStart->SetBorderColor(wxColour(0, 150, 136)); diff --git a/slic3r/Utils/CalibUtils.cpp b/slic3r/Utils/CalibUtils.cpp index fc98536..05cced0 100644 --- a/slic3r/Utils/CalibUtils.cpp +++ b/slic3r/Utils/CalibUtils.cpp @@ -867,6 +867,7 @@ void CalibUtils::calib_max_vol_speed(const CalibInfo &calib_info, wxString &erro auto new_params = params; auto mm3_per_mm = Flow(line_width, layer_height, nozzle_diameter).mm3_per_mm() * filament_config.option("filament_flow_ratio")->get_at(0); + //auto mm3_per_mm = Flow(line_width, layer_height, nozzle_diameter).mm3_per_mm() * filament_config.option("fibre_feed_rate")->get_at(0); new_params.end = params.end / mm3_per_mm; new_params.start = params.start / mm3_per_mm; new_params.step = params.step / mm3_per_mm;