admin 发表于 2017-4-19 21:39:20

Catia二次开发源码分享: 关于创建命令和菜单方法



Catia二次开发源码分享: 关于创建命令和菜单方法



//Methods implementation

void myAddin::CreateCommands()
{
        new PartCmdHeader("CreatePoint","CmdModule","PointCmd",(void *)NULL);
        new PartCmdHeader("CreateLine","CmdModule","LineCmd",(void *)NULL);
        new PartCmdHeader("CreateDialogTest","CmdModule","DialogTestCmd",(void *)NULL);
}
CATCmdContainer * myAddin::CreateToolbars()
{
       
        //设置工具条
        NewAccess(CATCmdContainer,pPartBenchTlb,PartBenchTlb);
   AddToolbarView(pPartBenchTlb,1,Right);

        NewAccess(CATCmdStarter,pPointCmd,PointCmd);
        SetAccessCommand(pPointCmd,"CreatePoint");
        SetAccessChild(pPartBenchTlb,pPointCmd);

        NewAccess(CATCmdStarter,pLineCmd,LineCmd);
        SetAccessCommand(pLineCmd,"CreateLine");
        SetAccessNext(pPointCmd,pLineCmd);

        NewAccess(CATCmdStarter,pDialogTestCmd,DialogTestCmd);
        SetAccessCommand(pDialogTestCmd,"CreateDialogTest");
        SetAccessNext(pLineCmd,pDialogTestCmd);

       
        //设置菜单

        NewAccess(CATCmdContainer,pPartBenchMun,PartBenchMun);
        NewAccess(CATCmdContainer,pPartBenchSmu,PartBenchSmu);
        NewAccess(CATCmdStarter,pPointCmdm,PointCmdm);
        SetAccessCommand(pPointCmdm,"CreatePoint");
    NewAccess(CATCmdStarter,pLineCmdm,LineCmdm);
    SetAccessCommand(pLineCmdm,"CreateLine");
        NewAccess(CATCmdStarter,pDialogTestCmdm,DialogTestCmdm);
        SetAccessCommand(pDialogTestCmdm,"CreateDialogTest");
       
        SetAccessChild(pPartBenchMun,pPartBenchSmu);
    SetAccessChild(pPartBenchSmu,pPointCmdm);
        SetAccessNext(pPointCmdm,pLineCmdm);
    SetAccessNext(pLineCmdm,pDialogTestCmdm);

    SetAddinMenu(pPartBenchTlb,pPartBenchMun);



        return pPartBenchTlb;

}


admin 发表于 2017-4-19 21:41:17

在 header文件CATRsc里面设置 图标
PartCmdHeader.CreatePoint.Icon.Normal    = "I_Point";
PartCmdHeader.CreateLine.Icon.Normal    = "I_Line";
在PartCmdHeader.CATNls设置命令名称
PartCmdHeader.CreatePoint.Title    = "创建点";
PartCmdHeader.CreatePoint.Mnemonic   = "P";
PartCmdHeader.CreatePoint.ShortHelp = "快速创建点";
PartCmdHeader.CreatePoint.Help      = "创建点";
PartCmdHeader.CreateLine.Title    = "创建线";
PartCmdHeader.CreateLine.Mnemonic   = "L";
PartCmdHeader.CreateLine.ShortHelp = "快速创建线";
PartCmdHeader.CreateLine.Help      = "创建线";
PartCmdHeader.CreateDialogTest.Title    = "对话框测试";
PartCmdHeader.CreateDialogTest.Mnemonic   = "C";
PartCmdHeader.CreateDialogTest.ShortHelp = "快速对话框测试";
PartCmdHeader.CreateDialogTest.Help      = "对话框测试";

admin 发表于 2017-4-19 21:41:31

在 header文件CATRsc里面设置 图标
PartCmdHeader.CreatePoint.Icon.Normal    = "I_Point";
PartCmdHeader.CreateLine.Icon.Normal    = "I_Line";


在PartCmdHeader.CATNls设置命令名称
PartCmdHeader.CreatePoint.Title    = "创建点";
PartCmdHeader.CreatePoint.Mnemonic   = "P";
PartCmdHeader.CreatePoint.ShortHelp = "快速创建点";
PartCmdHeader.CreatePoint.Help      = "创建点";
PartCmdHeader.CreateLine.Title    = "创建线";
PartCmdHeader.CreateLine.Mnemonic   = "L";
PartCmdHeader.CreateLine.ShortHelp = "快速创建线";
PartCmdHeader.CreateLine.Help      = "创建线";
PartCmdHeader.CreateDialogTest.Title    = "对话框测试";
PartCmdHeader.CreateDialogTest.Mnemonic   = "C";
PartCmdHeader.CreateDialogTest.ShortHelp = "快速对话框测试";
PartCmdHeader.CreateDialogTest.Help      = "对话框测试";

大飞行家 发表于 2017-12-12 17:16:22

你好,在吗

大飞行家 发表于 2017-12-12 17:18:06

刚做CATIA开发,不知道从哪下手。。。现在只会简单的创建2D图,还有简单的实体操作,怎么提高?
页: [1]
查看完整版本: Catia二次开发源码分享: 关于创建命令和菜单方法