在NX10中西门子官方开放了导航器的接口,利用二次开发可以将第三方UI嵌入到导航器中,如果要实现和BlockUI一样的风格,需采用第三方UI自绘。如果可以实现将BLOCKUI嵌入到导航器中,不仅风格和NX一致,也不用再额外的花费时间去自绘。经过研究目前已经适配NX7.5到最新版本同一套代码都可以。
1.封装的类如下,只需继承下做下处理,完全使用BlockUI那一套逻辑,代码风格一样
2.BlockUI框架继承导航器类
class NXTEST :public NXNavigatorDialog
{
// class members
public:
static Session *theSession;
static UI *theUI;
NXTEST();
~NXTEST();
int Show();
//----------------------- BlockStyler Callback Prototypes ---------------------
// The following member function prototypes define the callbacks
// specified in your BlockStyler dialog. The empty implementaiton
// of these prototypes is provided in the NXTEST.cpp file.
// You are REQUIRED to write the implementation for these funtions.
//------------------------------------------------------------------------------
void initialize_cb();
void dialogShown_cb();
int apply_cb();
int ok_cb();
int update_cb(NXOpen::BlockStyler::UIBlock* block);
void focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus);
void keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus);
bool ShowNavigator();
void ActivationNavigator();
private:
std::string theDialogName;
NXOpen::BlockStyler::BlockDialog* theDialog;
NXOpen::BlockStyler::UIBlock* group0;// Block type: Group
NXOpen::BlockStyler::UIBlock* enum0;// Block type: Enumeration
NXOpen::BlockStyler::UIBlock* selection0;// Block type: Selection
NXOpen::BlockStyler::UIBlock* button0;// Block type: Button
NXOpen::BlockStyler::Tree* tree_control0;// Block type: Tree Control
};
3.在NX8.5中的实现
4.在NX2306中的实现
5.以下视频是在NX8.5的操作演示
导航器