Fusion 360 API : 调用MFC对话框
来源:互联网 发布:巨人网络收购投哪网 编辑:程序博客网 时间:2024/04/30 09:58
原文地址: http://modthemachine.typepad.com/my_weblog/2016/02/fusion-add-in-with-mfc.html
我的同事Adam研究了一个有趣的内容,即如何在Fusion 360调用传统的MFC对话框。显然需要用到C++ API . 开始Adam琢磨基于Fusion 产生的C++插件工程,添加MFC支持,最后发现这个太挫折感,最后他想到一个聪明的办法,先创建一个MFC 的DLL,然后在Fusion C++工程中调用之。搞定!
源码在此:https://github.com/AutodeskFusion360/NativeUI
1) 创建一个MFC DLL
2) 添加对话框资源
3)添加对话框类,并根据需要调整合适的名字。
4) 在对话框.cpp中增加方法显示对话框
void showDialog(){ // Always call this macro first thing in any function that // will use MFC functionality AFX_MANAGE_STATE(AfxGetStaticModuleState()); CMyDialog myDialog; myDialog.DoModal();};
在对话框.h文件中增加:
#include "MyDialog.h"void showDialog();
#include "stdafx.h"#include <Core/CoreAll.h>#include <Fusion/FusionAll.h>// XI_WIN is a macro added by Fusion headers// to show if the project is a Windows project#ifdef XI_WIN #include "CustomMfcUi.h"#endifusing namespace adsk::core;using namespace adsk::fusion;Ptr<Application> app;Ptr<UserInterface> ui;extern "C" XI_EXPORT bool run(const char* context){ app = Application::get(); if (!app) return false; ui = app->userInterface(); if (!ui) return false; showDialog(); return true;}extern "C" XI_EXPORT bool stop(const char* context){ if (ui) { ui->messageBox("in stop"); ui = nullptr; } return true;}
6) 修改工程配置为X64,因为Fusion 360只有64位的。
7) 给工程配置好Fusion 360 C++头文件与库文件所在路径。
8) 编译,生成dll,例如CustomMfcUi.dll
9) 在 "$(APPDATA)\Autodesk\Autodesk Fusion 360\API\AddIns" 创建一个名为CustomMfcUi的文件夹。并添加一个“CustomMfcUi.manifest"。 其内容为:
{"autodeskProduct":"Fusion360","type":"addin","author":"","description":{"":""},"supportedOS":"windows","editEnabled":false,"id":"38EE9339-591A-4F72-AFFF-7B20111CC10C","version":"1.0.0","runOnStartup":false}
id是个guid
10) 将前面编译好的dll也放到这个文件夹。
11) 启动Fusion后,在插件管理器能看到此插件。
点击它,对话框出现:
0 0
- Fusion 360 API : 调用MFC对话框
- API和MFC创建对话框
- Fusion 360 以及 API 快速了解
- Fusion 360 API 入门在线课程
- Fusion 360 API:近期重要更新
- MFC调用对话框dll弹出非模态对话框
- MFC 调用颜色选择对话框
- cef1 mfc 对话框简单调用
- Windows API调用对话框资源
- Fusion 360 API: JavaScript API进入维护模式
- MFC调用打开文件、文件夹对话框
- MFC中模态对话框的调用流程小解
- 在mfc中调用选取路径对话框
- 调用mfc扩展型dll使用对话框
- mfc非模态子对话框调用内存泄露问题
- MFC对话框及窗口函数调用顺序
- mfc对话框之间的相互调用
- MFC中通过按钮调用其他对话框
- 双击鼠标HOOK学习
- 破解版 Sublime text3破解版下载以及安装emmet插件,前端开发神器
- 高等数学:第一章 函数与极限(3)无穷小 连续性 间断点 连续函数
- JVM > 运行时数据区域
- 给一个类增加xib文件
- Fusion 360 API : 调用MFC对话框
- Activity开发之Activity的启动模式(二)
- javaweb使用POI导出导出excel表格
- 使用bindview自动安装passthru驱动的调试笔记
- ssh: connect to host master port 22: Connection refused lost connection
- Android中的系统广播集合
- 客戶教我的事:真正的「好服務」不能只靠專業,還要做到這個關鍵
- new Date()和System.currentTimeMillis()获取当前时间戳
- ZOJ 2781-Rounders