Catia的二次开发Word文档格式.docx

上传人:b****6 文档编号:8326778 上传时间:2023-05-11 格式:DOCX 页数:12 大小:21.58KB
下载 相关 举报
Catia的二次开发Word文档格式.docx_第1页
第1页 / 共12页
Catia的二次开发Word文档格式.docx_第2页
第2页 / 共12页
Catia的二次开发Word文档格式.docx_第3页
第3页 / 共12页
Catia的二次开发Word文档格式.docx_第4页
第4页 / 共12页
Catia的二次开发Word文档格式.docx_第5页
第5页 / 共12页
Catia的二次开发Word文档格式.docx_第6页
第6页 / 共12页
Catia的二次开发Word文档格式.docx_第7页
第7页 / 共12页
Catia的二次开发Word文档格式.docx_第8页
第8页 / 共12页
Catia的二次开发Word文档格式.docx_第9页
第9页 / 共12页
Catia的二次开发Word文档格式.docx_第10页
第10页 / 共12页
Catia的二次开发Word文档格式.docx_第11页
第11页 / 共12页
Catia的二次开发Word文档格式.docx_第12页
第12页 / 共12页
亲,该文档总共12页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

Catia的二次开发Word文档格式.docx

《Catia的二次开发Word文档格式.docx》由会员分享,可在线阅读,更多相关《Catia的二次开发Word文档格式.docx(12页珍藏版)》请在冰点文库上搜索。

Catia的二次开发Word文档格式.docx

externIIDIID_CAAIAfrGeoCreationWkbFactory;

classCAAIAfrGeoCreationWkbFactory:

publicCATIGenericFactory{CATDeclareInterface;

public:

};

AfactoryinterfaceisaCAAinterface,thatis,anabstractclassthatderivesfromCATIGenericFactory.Asanyinterface,ithasanIIDdeclaredasIID_followedbytheinterfacename,andincludesthe

CATDeclareInterfacemacrothatdeclaresthatthisabstractclassisaninterface.Noadditional3

methodthanthoseofCATIGenericFactoryisnecessary.Don'

tforgetthepublickeywordrequiredbytheTIEcompiler.(?

3.2.3源文件(Thesourcefile)

CAAIAfrGeoCreationWkbFactory.cpp

CAAIAfrGeoCreationWkbFactory.h>

IIDIID_CAAIAfrGeoCreationWkbFactory={0xb32eed10,0xd4c1,0x11d3,{0xb7,0xf5,0x00,0x08,0xc7,0x4f,0xe8,0xdd}};

CATImplementInterface(CAAIAfrGeoCreationWkbFactory,CATIGenericFactory);

TheCATImplementInterfacemacroisusedinconjunctionwithCATDeclareInterfaceintheheaderfiletomakeaninterfacefromthisabstractclassandtodeclarethatitOM-derivesfromCATIGenericfactory.

3.2.4TIE文件(TheTIEtsrcfile)

TIE_CAAIAfrGeoCreationWkbFactory.tsrc

#include"

CAAIAfrGeoCreationWkbFactory.h"

TheMulti-WorkspaceApplicationBuilder(mkmk)willgeneratetheTIEforthisinterfaceforyou,thatis,theTIE_CAAIAfrGeoCreationWkbFactory.hfileintheProtectedGenerateddirectory.

3.3建立Workbench的Factory

(CreatingtheWorkbenchFactory)

3.3.1注意事项

Thefactoryclassthatcreatesworkbenchinstancesmustconcatenatethenameoftheclasstoinstantiate,thatis,theworkbenchdescriptionclassCAAAfrGeoCreationWkb,withthestringFactory.ThisgivesCAAAfrGeoCreationWkbFactory.

3.3.2头文件

CAAAfrGeoCreationWkbFactory.h

CATWorkshopConfigurationFactory.h"

CATDeclareConfigurationFactory(CAAAfrGeoCreationWkb);

TheCATDeclareConfigurationFactorymacroargumentisthenameoftheworkbenchdescriptionclass.

4

3.3.3源文件

CAAAfrGeoCreationWkbFactory.cpp

CAAAfrGeoCreationWkb.h>

#include<

CAAAfrGeoCreationWkbFactory.h>

TIE_CAAIAfrGeoCreationWkbFactory.h>

CATImplementConfigurationFactory(CAAAfrGeoCreationWkb,CAAIAfrGeoCreationWkbFactory);

TheCATImplementConfigurationFactoryargumentsarethenameoftheworkbenchdescriptionclassandthenameoftheworkbenchfactoryinterfacerespectively.The

CATDeclareConfigurationFactoryandCATImplementConfigurationFactorymacroscreatethe

workbenchfactoryimplementationclassasadataextensionoftheCATApplicationFramecomponent

3.3.4更新字典

3.3.4.1Theinterfacedictionarythatisafilewhosenameistheframeworknamesuffixedbydico,suchasCAAApplicationFrame.dico,andthatyoushouldcreateorupdateintheframeworkCNext/code/dictionarydirectory.TheinterfacedictionarycontainsthefollowingdeclarationtostatethattheCATApplicationFramecomponentimplementstheCAAIAfrGeoCreationWkbFactoryinterface,bymeansoftheextensionclasscreatedbythemacros,whosecodeislocatedinthelibCAAAfrGeoCreationWbenchsharedlibraryorDLL:

(不太明白)

CATApplicationFrameCAAIAfrGeoCreationWkbFactorylibCAAAfrGeoCreationWbench

3.3.4.2Thefactorydictionarythatisafilewhosenameistheframeworknamesuffixedbyfact,suchasCAAApplicationFrame.fact,andthatyoushouldcreateorupdateintheframeworkCNext/code/dictionarydirectory.ThefactorydictionarycontainsthefollowingdeclarationtostatethattheCAAIAfrGeoCreationWkbFactoryinterfaceisaninterfacetoafactorywhoseimplementationcreatesaCAAAfrGeoCreationWkbclassinstance:

CAAAfrGeoCreationWkbCAAIAfrGeoCreationWkbFactory

3.4定义与实现Workbench类

(CreatingtheWorkbenchDescriptionClass)

3.4.1说明

TheCAAAfrGeoCreationWkbclassimplementstheCATICAAAfrGeometryWksConfigurationinterfaceexposedbytheCAAGeometryworkshop.Itincludesthefollowingmethods:

?

CreateCommandstoinstantiatethecommandheadersforthecommandsoftheworkbenchCreateWorkbenchtocreatethecontainersfortheworkbench,themenus,andthetoolbars,and

arrangethecommandsinthemenusandtoolbars

GetCustomInterfaceswhichreturnsthenamesoftheinterfacesexposedbytheworkbenchto

enableitscustomization

5

?

GetAddinInterfacewhichreturnsthenameoftheinterfaceexposedbytheworkbenchtocreate

add-ins.

3.4.2头文件

CAAAfrGeoCreationWkb.h

CATBaseUnknown.h"

#include"

CATListPV.h"

classCATCmdWorkbench;

classCAAAfrGeoCreationWkb:

publicCATBaseUnknown{CATDeclareClass;

public:

CAAAfrGeoCreationWkb();

virtual~CAAAfrGeoCreationWkb();

voidCATClassIdvoidprivate:

CAAAfrGeoCreationWkb(constCAAAfrGeoCreationWkb&

iObjectToCopy);

CreateCommands();

GetAddinInterface();

GetCustomInterfaces(CATListPV*oDefaultIIDList,CATListPV*oCustomIIDList);

CATCmdWorkbench*CreateWorkbench();

TheCAAAfrGeoCreationWkbclassC++-derivesfromCATBaseUnknown.TheCATDeclareClassmacrodeclaresthattheclassCAAAfrGeoCreationWkbbelongstoacomponent.Theclasshasaconstructor,adestructor,thefourmethodsoftheCATIWorkbenchinterface,andacopyconstructor.Notethatthecopyconstructorissetasprivate.Thispreventsthecompilerfromcreatingthecopyconstructoraspublicwithoutyouknow.Thiscopyconstructorisnotimplementedinthesourcefile.

3.4.3源文件

CAAAfrGeoCreationWkb.cpp

CATCommandHeader.h>

//SeeCreatingtheCommandHeadersMacDeclareHeader(CAAAfrGeoCreationWkbHeader);

CATCreateWorkshop.h>

CATImplementClass(CAAAfrGeoCreationWkb,Implementation,CATBaseUnknown,CATNull);

TIE_CATICAAAfrGeometryWksConfiguration.h>

6

TIE_CATICAAAfrGeometryWksConfiguration(CAAAfrGeoCreationWkb);

CAAAfrGeoCreationWkb:

:

CAAAfrGeoCreationWkb(){}CAAAfrGeoCreationWkb:

~CAAAfrGeoCreationWkb(){}voidCAAAfrGeoCreationWkb:

CreateCommands(){...//SeeCreatingtheCommandHeaders}CATCmdWorkbench*CAAAfrGeoCreationWkb:

CreateWorkbench(){...//SeeCreatingtheWorkbenchandArrangingtheCommands}CATClassIdCAAAfrGeoCreationWkb:

GetAddinInterface(){return"

CAAIAfrGeoCreationWkbAddin"

;

}voidCAAAfrGeoCreationWkb:

GetCustomInterfaces(CATListPV*oDefaultIIDList,CATListPV*oCustomIIDList){}

3.4.3.1TIE_CATICAAAfrGeometryWksConfiguration宏TheCAAAfrGeoCreationWkbclassstatesthatitimplementstheCATICAAAfrGeometryWksConfigurationinterface3.4.3.2TIE_CATImplementClass宏declaringthattheCAAAfrGeoCreationWkbclassisacomponentmainclass[2],thankstothe

Implementationkeyword,andthatitOM-derivesfromCATBaseUnknown[2].Thefourthparametermust

alwaysbesettoCATNullforcomponentmainclasses.3.4.3.3创建命令标签(CreatingtheCommandHeaders)(见《命令标签》)3.4.3.3.1命令标签Eachcommandavailableinyourworkbenchmusthaveacommandheader.Acommandheaderisaninstanceofacommandheaderclass,anddifferentcommandscansharethesamecommandheaderclasstocreatetheircommandheader.3.4.3.3.2创建命令标签类CAAAfrGeoCreationWkbHeadercommandheaderclassiscareatedinCAAAfrGeoCreationWkb.cpp:

MacDeclareHeader(CAAAfrGeoCreationWkbHeader);

7

TheMacDeclareHeadermacrocreatestheheaderfileandthesourcefilefortheCAAAfrGeoCreationWkbHeaderclass,andassociateswiththisclasstheresourcefilesCAAAfrGeoCreationWkbHeader.CATNlsandCAAAfrGeoCreationWkbHeader.CATRsc.3.4.3.3.3定义命令标签CreatethecodetoinstantiateyourcommandheadersintheemptyCreateCommandsmethod.Thismethodshouldcontainoneinstantiationstatementofthecommandheaderclasspercommand.Eachstatementhasthefollowingform,forexamplefortheCuboidcommand.

voidCAAAfrGeoCreationWkb:

CreateCommands(){...newCAAAfrGeoCreationWkbHeader("

CAAAfrCuboidHdr"

"

CAADegGeoCommands"

CAADegCreateCuboidCmd"

(void*)NULL);

...}

其中:

1)CAAAfruboidHdristheidentifieryouneedtoassigntothecommandheader.Itwillbeused

afterwards:

(1)Toassociatethecommandstartersyouwilldefinetoputthecommandinamenuandintoolbarswiththecommandheader.

(2)Tobuildthevariablesthatdefinethecommandheaderresources,suchasthenameseenbytheenduserinhis/herownlanguageinthemenu,ortheicontodisplayinatoolbar.

2)CAADegGeoCommandsisthenameofthesharedlibraryorDLLcontainingtheCuboidcommand'

s

code,withouttheprefixlib,andwithoutthesuffixdependingontheoperatingsystem.

3)CAADegCreateCuboidCmdisthenameoftheCuboidcommandclass

4)thelastargumentisthepossiblepointertotheobjecttopasstothecommandwhenexecutingit.Itisoftenacharacterstringthatindicatestheactiontocarryoutwhenthesamecommandcanperformseveralactionsdependingontheactivedocumentanddata,suchas"

update"

or"

updateall"

or"

cut"

copy"

.3.4.3.4CreatingtheWorkbenchandArrangingtheCommands3.4.3.4.1创建workbenchusingtheNewAccessmacro:

CATCmdWorkbench*CAAAfrGeoCreationWkb:

CreateWorkbench(){NewAccess(CATCmdWorkbench,pCAAAfrGeoCreationWkb,CAAAfrGeoCreationWkb);

...//SeeCreatingtheContainersfortheToolbarsandtheMenuBarreturnpCAAAfrGeoCreationWkb;

}pCAAAfrGeoCreationWkbisthevariableusedtohandlethewo

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > IT计算机 > 电脑基础知识

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2