Coding On the Way

本文分享了作者对编程的兴趣与热爱,重点介绍了C++与Python语言、数据结构与算法等核心编程技能,以及计算机组成原理、编译原理等计算机基础知识,并探讨了Linux系统及版本控制工具Git的重要性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Coding On the Way

C++/Python
数据结构与算法
计算机组成原理
编译原理
操作系统
计算机网络
数据库系统原理
Linux
Git/Github/Gitbook
说明:
  • C++/Python是我所感兴趣的两种语言;
  • 数据结构与算法是编程的核心;
  • 计算机组成原理、编译原理、操作系统、计算机网络、数据库系统原理是计算机的核心基础知识;
  • Linux的命令行是我喜欢上这个系统的原因;
  • Github作为一个大型的代码托管平台,必须熟悉,包括该“系列”的Git与Github,尤其是作为版本控制的Git,更应该熟悉。

The way to Program may not plain sailin, but my heart will go on!

//============================================================================== // WARNING!! This file is overwritten by the Block UI Styler while generating // the automation code. Any modifications to this file will be lost after // generating the code again. // // Filename: D:\NXopen\BaiduSyncdisk\studio\bianjieshunmian\bianjieshunmian.cpp // // This file was generated by the NX Block UI Styler // Created by: MICH-ROG // Version: NX 12 // Date: 08-15-2025 (Format: mm-dd-yyyy) // Time: 10:14 (Format: hh-mm) // //============================================================================== //============================================================================== // Purpose: This TEMPLATE file contains C++ source to guide you in the // construction of your Block application dialog. The generation of your // dialog file (.dlx extension) is the first step towards dialog construction // within NX. You must now create a NX Open application that // utilizes this file (.dlx). // // The information in this file provides you with the following: // // 1. Help on how to load and display your Block UI Styler dialog in NX // using APIs provided in NXOpen.BlockStyler namespace // 2. The empty callback methods (stubs) associated with your dialog items // have also been placed in this file. These empty methods have been // created simply to start you along with your coding requirements. // The method name, argument list and possible return values have already // been provided for you. //============================================================================== //------------------------------------------------------------------------------ //These includes are needed for the following template code //------------------------------------------------------------------------------ #include "bianjieshunmian.hpp" using namespace NXOpen; using namespace NXOpen::BlockStyler; //------------------------------------------------------------------------------ // Initialize static variables //------------------------------------------------------------------------------ Session *(bianjieshunmian::theSession) = NULL; UI *(bianjieshunmian::theUI) = NULL; //------------------------------------------------------------------------------ // Constructor for NX Styler class //------------------------------------------------------------------------------ bianjieshunmian::bianjieshunmian() { try { // Initialize the NX Open C++ API environment bianjieshunmian::theSession = NXOpen::Session::GetSession(); bianjieshunmian::theUI = UI::GetUI(); theDlxFileName = "bianjieshunmian.dlx"; theDialog = bianjieshunmian::theUI->CreateDialog(theDlxFileName); // Registration of callback functions theDialog->AddApplyHandler(make_callback(this, &bianjieshunmian::apply_cb)); theDialog->AddOkHandler(make_callback(this, &bianjieshunmian::ok_cb)); theDialog->AddUpdateHandler(make_callback(this, &bianjieshunmian::update_cb)); theDialog->AddInitializeHandler(make_callback(this, &bianjieshunmian::initialize_cb)); theDialog->AddDialogShownHandler(make_callback(this, &bianjieshunmian::dialogShown_cb)); } catch(exception& ex) { //---- Enter your exception handling code here ----- throw; } } //------------------------------------------------------------------------------ // Destructor for NX Styler class //------------------------------------------------------------------------------ bianjieshunmian::~bianjieshunmian() { if (theDialog != NULL) { delete theDialog; theDialog = NULL; } } //------------------------------- DIALOG LAUNCHING --------------------------------- // // Before invoking this application one needs to open any part/empty part in NX // because of the behavior of the blocks. // // Make sure the dlx file is in one of the following locations: // 1.) From where NX session is launched // 2.) $UGII_USER_DIR/application // 3.) For released applications, using UGII_CUSTOM_DIRECTORY_FILE is highly // recommended. This variable is set to a full directory path to a file // containing a list of root directories for all custom applications. // e.g., UGII_CUSTOM_DIRECTORY_FILE=$UGII_BASE_DIR\ugii\menus\custom_dirs.dat // // You can create the dialog using one of the following way: // // 1. USER EXIT // // 1) Create the Shared Library -- Refer "Block UI Styler programmer's guide" // 2) Invoke the Shared Library through File->Execute->NX Open menu. // //------------------------------------------------------------------------------ extern "C" DllExport void ufusr(char *param, int *retcod, int param_len) { bianjieshunmian *thebianjieshunmian = NULL; try { UF_initialize(); //开发的许可函数,初始化 thebianjieshunmian = new bianjieshunmian(); // The following method shows the dialog immediately thebianjieshunmian->Show(); } catch(exception& ex) { //---- Enter your exception handling code here ----- bianjieshunmian::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); } if(thebianjieshunmian != NULL) { delete thebianjieshunmian; thebianjieshunmian = NULL; }UF_terminate(); //释放许可函数,结束化 } //------------------------------------------------------------------------------ // This method specifies how a shared image is unloaded from memory // within NX. This method gives you the capability to unload an // internal NX Open application or user exit from NX. Specify any // one of the three constants as a return value to determine the type // of unload to perform: // // // Immediately : unload the library as soon as the automation program has completed // Explicitly : unload the library from the "Unload Shared Image" dialog // AtTermination : unload the library when the NX session terminates // // // NOTE: A program which associates NX Open applications with the menubar // MUST NOT use this option since it will UNLOAD your NX Open application image // from the menubar. //------------------------------------------------------------------------------ extern "C" DllExport int ufusr_ask_unload() { //return (int)Session::LibraryUnloadOptionExplicitly; return (int)Session::LibraryUnloadOptionImmediately; //return (int)Session::LibraryUnloadOptionAtTermination; } //------------------------------------------------------------------------------ // Following method cleanup any housekeeping chores that may be needed. // This method is automatically called by NX. //------------------------------------------------------------------------------ extern "C" DllExport void ufusr_cleanup(void) { try { //---- Enter your callback code here ----- } catch(exception& ex) { //---- Enter your exception handling code here ----- bianjieshunmian::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); } } int bianjieshunmian::Show() { try { theDialog->Show(); } catch(exception& ex) { //---- Enter your exception handling code here ----- bianjieshunmian::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); } return 0; } //------------------------------------------------------------------------------ //---------------------Block UI Styler Callback Functions-------------------------- //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ //Callback Name: initialize_cb //------------------------------------------------------------------------------ void bianjieshunmian::initialize_cb() { try { group0 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group0")); edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()->FindBlock("edge_select0")); face_select0 = dynamic_cast<NXOpen::BlockStyler::FaceCollector*>(theDialog->TopBlock()->FindBlock("face_select0")); } catch(exception& ex) { //---- Enter your exception handling code here ----- bianjieshunmian::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); } } //------------------------------------------------------------------------------ //Callback Name: dialogShown_cb //This callback is executed just before the dialog launch. Thus any value set //here will take precedence and dialog will be launched showing that value. //------------------------------------------------------------------------------ void bianjieshunmian::dialogShown_cb() { try { //---- Enter your callback code here ----- } catch(exception& ex) { //---- Enter your exception handling code here ----- bianjieshunmian::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); } } //------------------------------------------------------------------------------ //Callback Name: apply_cb //------------------------------------------------------------------------------ int bianjieshunmian::apply_cb() { int errorCode = 0; try {// 获取NX会话和工作部件 NXOpen::Session* theSession = NXOpen::Session::GetSession(); NXOpen::Part* workPart = theSession->Parts()->Work(); NXOpen::UI* theUI = NXOpen::UI::GetUI(); std::vector<NXOpen::Curve*> sectionCurves1; if (edge_select0) { // 使用智能指针管理属性列表内存 std::unique_ptr<NXOpen::BlockStyler::PropertyList> props(edge_select0->GetProperties()); std::vector<NXOpen::TaggedObject*> selObjs = props->GetTaggedObjectVector("SelectedObjects"); for (NXOpen::TaggedObject* obj : selObjs) { if (NXOpen::Curve* curve = dynamic_cast<NXOpen::Curve*>(obj)) { sectionCurves1.push_back(curve); } } } //选择控件 vector<NXOpen::TaggedObject*> vFaces = face_select0->GetSelectedObjects();//获取选择的面 for (int i = 0; i < vFaces.size(); i++)//循环得到所有面 { tag_t faceTag = vFaces[i]->Tag(); //得到面的tag } //---- Enter your callback code here ----- } catch(exception& ex) { //---- Enter your exception handling code here ----- errorCode = 1; bianjieshunmian::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); } return errorCode; } //------------------------------------------------------------------------------ //Callback Name: update_cb //------------------------------------------------------------------------------ int bianjieshunmian::update_cb(NXOpen::BlockStyler::UIBlock* block) { try { if(block == edge_select0) { //---------Enter your code here----------- } else if(block == face_select0) { //---------Enter your code here----------- } } catch(exception& ex) { //---- Enter your exception handling code here ----- bianjieshunmian::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); } return 0; } //------------------------------------------------------------------------------ //Callback Name: ok_cb //------------------------------------------------------------------------------ int bianjieshunmian::ok_cb() { int errorCode = 0; try { errorCode = apply_cb(); } catch(exception& ex) { //---- Enter your exception handling code here ----- errorCode = 1; bianjieshunmian::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); } return errorCode; } //------------------------------------------------------------------------------ //Function Name: GetBlockProperties //Description: Returns the propertylist of the specified BlockID //------------------------------------------------------------------------------ PropertyList* bianjieshunmian::GetBlockProperties(const char *blockID) { return theDialog->GetBlockProperties(blockID); } 帮我把到斜角部分加到“//选择控件 vector<NXOpen::TaggedObject*> vFaces = face_select0->GetSelectedObjects();//获取选择的面 for (int i = 0; i < vFaces.size(); i++)//循环得到所有面 { tag_t faceTag = vFaces[i]->Tag(); //得到面的tag }”后面,边用“edge_select0”的边,倒角参数“chamferBuilder1->SetOption(NXOpen::Features::ChamferBuilder::ChamferOptionTwoOffsets); // 使用双偏置方式”偏置一“1mm”偏置二“1mm”其他不需要
08-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值