• 如何将CAD的内置对话框作为当前对话框的子对话框调出


    本文参考以下博文并完善了代码实现:https://www.cnblogs.com/shankun/p/To_use_AutoCAD_internal_Dialog.html

    常用的几个对话框对应的函数为:
    1、尺寸标注样式编辑对话框:
    int acedEditDimstyleInteractie(AcDbDatabase *,AcDbDimStyleTableRecord *,int);
    2、多行文字编辑对话框:
    int acedEditMTextInteractie(AcDbMText *);
    3、公差编辑对话框:
    void acedEditToleranceInteractie(AcDbFcf *);
    4、CAD自己的文件对话框:
    int acedGetFileD(const char *,const char *,const char *,int,struct resbuf *);
    int acedGetFileNavDialog(const char ,const char ,const char ,const char ,int,struct resbuf);
    5、填充面板对话框:
    extern bool acedHatchPalletteDialog(const char
    Pattern, bool bAllowCustom, char
    & result);
    6、线形对话框:
    bool acedLinetypeDialog(AcDbObjectId,bool,char * &,AcDbObjectId &);
    7、线宽对话框:
    bool acedLineWeightDialog(AcDb::LineWeight,bool,AcDb::LineWeight &);
    8、打印样式对话框:
    bool acedPlotstyleDialog(const char *,bool,char * &);
    9、填充编辑对话框:
    void hatchedit(long,int,bool,const AcDbObject *);
    10、文字样式对话框:
    void inokeTextStyleDialog(AcDbDatabase *,CString *);

    这些函数大多不在文档中,可按两种方式使用:
    1、使用前声明函数原型,直接调用即可,注意使用前需要切换资源模块。

    void ShowLineWeightDlg()
    {
    	//声明原型
    	bool acedLineWeightDialog(AcDb::LineWeight, bool, AcDb::LineWeight &);
    	HMODULE hModule = GetModuleHandle(_T("acad.exe"));
    	CAcModuleResourceOverride cadResource(hModule);
    	AcDb::LineWeight nLWeight;
    	if (acedLineWeightDialog(AcDb::LineWeight::kLnWt020, true, nLWeight))
    	{
    		//... do something
    		acutPrintf(_T("hello"));
    	}
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    2、先用GetModuleHandle获取acad.exe的句柄,然后用GetProcAddress动态获取指定函数的入口地址,之后就可以直接调用了。

    void ShowLineWeightDlg()
    {
    	//声明原型
    	typedef bool(*DlgLineWeight)(AcDb::LineWeight, bool, AcDb::LineWeight &);
    	HMODULE hModule = GetModuleHandle(_T("acad.exe"));
    	if (hModule)
    	{
    		AcDb::LineWeight nLWeight;
    		CAcModuleResourceOverride cadResource(hModule);
    		//在C++中,会发生名称改编,
    		// acedLineWeightDialog名称改编为:?acedLineWeightDialog@@YA_NW4LineWeight@AcDb@@_NAEAW412@@Z
    		FARPROC pFunc = GetProcAddress(hModule, "?acedLineWeightDialog@@YA_NW4LineWeight@AcDb@@_NAEAW412@@Z");
    		DlgLineWeight pFunLWeight = (DlgLineWeight)pFunc;
    		if (pFunLWeight)
    		{
    			if (pFunLWeight(AcDb::LineWeight::kLnWt025, true, nLWeight))
    			{
    				//... do something
    				acutPrintf(_T("hello"));
    			}
    		}
    	}
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23

    公用库报表控件类:
    CReportRecordItemAcCmColor
    CReportRecordItemAssocVariable
    CReportRecordItemBlock
    CReportRecordItemBool
    CReportRecordItemCellAlignment
    CReportRecordItemLinetype
    CReportRecordItemLineWeight
    CReportRecordItemNumber
    CReportRecordItemPropertyString
    CReportRecordItemSymbol

  • 相关阅读:
    基于SSM 实现增删查改
    67-94-hive-函数-开窗函数-常用函数-udf自定义函数
    vue3 + vite中按需使用ace-builds实现编辑器
    智能小车之测速小车原理和开发
    Goldengate
    Online JSON formatter for developers
    SimpleUI修改icon,icon挑选地址
    【毕业设计】基于stm32的车牌识别系统 - 物联网 单片机
    华为云发布三大生态举措,携手伙伴及开发者共创新价值
    【CSH 入门基础 9 -- 输出 csh 脚本中每一句命令】
  • 原文地址:https://blog.csdn.net/mary288267/article/details/126388785