This toolbar contains four commands: Cuboid, Sphere, Torus, and Cylinder. You should, for each command: (1)Create a command starter using the NewAccess macro (2)Associate the command starter, using the SetAccessCommand macro, with the appropriate command header identifier defined in the CreateCommands method (3)Arrange the command starters in the toolbar using the SetAccessChild and SetAccessNext macros
... NewAccess(CATCmdStarter,pCAAAfrTSolidEltCuboidStr,CAAAfrTSolidEltCuboidStr); SetAccessCommand(pCAAAfrTSolidEltCuboidStr,\SetAccessChild(pCAAAfrSolidEltTlb,pCAAAfrTSolidEltCuboidStr);
NewAccess(CATCmdStarter,pCAAAfrTSolidEltSphereStr,CAAAfrTSolidEltSphereStr); SetAccessCommand(pCAAAfrTSolidEltSphereStr,\SetAccessNext(pCAAAfrTSolidEltCuboidStr,pCAAAfrTSolidEltSphereStr); NewAccess(CATCmdStarter,pCAAAfrTSolidEltTorusStr,CAAAfrTSolidEltTorusStr); SetAccessCommand(pCAAAfrTSolidEltTorusStr,\SetAccessNext(pCAAAfrTSolidEltSphereStr,pCAAAfrTSolidEltTorusStr);
NewAccess(CATCmdStarter,pCAAAfrTSolidEltCylinder1Str,CAAAfrTSolidEltCylinder1Str); SetAccessCommand(pCAAAfrTSolidEltCylinder1Str,\SetAccessNext(pCAAAfrTSolidEltTorusStr,pCAAAfrTSolidEltCylinder1Str);
NewAccess(CATCmdStarter,pCAAAfrTSolidEltCylinder2Str,CAAAfrTSolidEltCylinder2Str); SetAccessCommand(pCAAAfrTSolidEltCylinder2Str,\SetAccessNext(pCAAAfrTSolidEltCylinder1Str,pCAAAfrTSolidEltCylinder2Str); ...
Three macros are required for each command. For example, the Cuboid command is processed as follows:
10
1) First create the command starter as a CATCmdStarter instance using the NewAccess macro. pCAAAfrTSolidEltCuboidStr is the variable used to handle a pointer to that instance, and CAAAfrTSolidEltCuboidStr is its identifier. 2) Then associate the Cuboid command header with this command starter using the
SetAccessCommand macro. The second parameter is the Cuboid command header
identifier defined as the first parameter of the command header consrtuctor. Refer to Creating the Command Headers 3) Finally set the Cuboid command starter as the child of the Solids toolbar. Proceed in the same way for the other commands, except that they are set as next of one another using the SetAccessNext macro. 2)添加 Surfaces 工具条按钮(Creating the Surfaces Toolbar Content)
This toolbar contains three commands: Revolution Surface, Nurbs Surface, and Offset Surface. You should, for each command: (1)Create a command starter using the NewAccess macro (2)Associate the command starter, using the SetAccessCommand macro, with the appropriate command header identifier defined in the CreateCommands method (3)Arrange the command starters in the toolbar using the SetAccessChild and SetAccessNext macros ... NewAccess(CATCmdStarter,pCAAAfrTSurfRevolStr,CAAAfrTSurfRevolStr); SetAccessCommand(pCAAAfrTSurfRevolStr,\SetAccessChild(pCAAAfrSurfacicEltTlb,pCAAAfrTSurfRevolStr);
NewAccess(CATCmdStarter,pCAAAfrTSurfNurbsStr,CAAAfrTSurfNurbsStr); SetAccessCommand(pCAAAfrTSurfNurbsStr,\SetAccessNext(pCAAAfrTSurfRevolStr,pCAAAfrTSurfNurbsStr);
NewAccess(CATCmdStarter,pCAAAfrTSurfOffsetStr,CAAAfrTSurfOffsetStr);
SetAccessCommand(pCAAAfrTSurfOffsetStr,\SetAccessNext(pCAAAfrTSurfNurbsStr,pCAAAfrTSurfOffsetStr); ...
Three macros are required for each command. For example, the Revolution Surface command is processed as follows: (1)First create the command starter as a CATCmdStarter instance using the NewAccess macro.
pCAAAfrTSurfRevolStr is the variable used to handle a pointer to that instance, and CAAAfrTSurfRevolStr is its identifier. 11
(2)Then associate the Revolution Surface command header with this command starter using the
SetAccessCommand macro. The second parameter is the Revolution Surface command header identifier
defined as the first parameter of the command header consrtuctor. Refer to Creating the Command Headers (3)Finally set the Revolution Surface command starter as the child of the Surfaces toolbar. Proceed in the same way for the other commands, except that they are set as next of one another using the SetAccessNext macro. 3)添加菜单项(Creating the Menu Bar Content) Menus and submenus are created as CATCmdContainer instances, and menu items as CATCmdStarter instances. The menu bar you create will be merged when the workbench is loaded or activated at run time with the workshop menu bar, itself resulting in the merge of the default menu bar, that is, the one that exists when no document is active, with the one defined for the workshop. You can neither remove a menu from the default menu bar or from the menu bar defined for the workshop, nor change the menu order. You can add submenus to menus. You can also add submenus to your own submenus, but not to existing submenus.
You should: (1)Create a command container for each menu and submenu using the NewAccess macro (2)Create a command starter for each command using the NewAccess macro (3) Associate each command starter, using the SetAccessCommand macro, with the appropriate command header identifier defined in the CreateCommands method (4)Arrange the command starters in the menu using the SetAccessChild, and SetAccessNext macros ——Insert Menu - Solids Submenu
... NewAccess(CATCmdContainer,pCATAfrInsertMnu,CATAfrInsertMnu); SetAccessChild(pCAAAfrGeoCreationMbr,pCATAfrInsertMnu);
NewAccess(CATCmdSeparator,pCAAAfrGeoCreationInsertSep,CAAAfrGeoCreationInsertSep); SetAccessChild(pCATAfrInsertMnu,pCAAAfrGeoCreationInsertSep); NewAccess(CATCmdContainer,pCAAAfrSolidEltSnu,CAAAfrSolidEltSnu); 12
SetAccessNext(pCAAAfrGeoCreationInsertSep,pCAAAfrSolidEltSnu);
NewAccess(CATCmdStarter,pCAAAfrMSolidCuboidStr,CAAAfrMSolidCuboidStr); SetAccessChild(pCAAAfrSolidEltSnu,pCAAAfrMSolidCuboidStr); SetAccessCommand(pCAAAfrMSolidCuboidStr,\
NewAccess(CATCmdStarter,pCAAAfrMSolidSphereStr,CAAAfrMSolidSphereStr); SetAccessNext(pCAAAfrMSolidCuboidStr,pCAAAfrMSolidSphereStr); SetAccessCommand(pCAAAfrMSolidSphereStr,\
NewAccess(CATCmdStarter,pCAAAfrMSolidTorusStr,CAAAfrMSolidTorusStr); SetAccessNext(pCAAAfrMSolidSphereStr,pCAAAfrMSolidTorusStr); SetAccessCommand(pCAAAfrMSolidTorusStr,\
NewAccess(CATCmdStarter,pCAAAfrMSolidCylinder1Str,CAAAfrMSolidCylinder1Str); SetAccessNext(pCAAAfrMSolidTorusStr,pCAAAfrMSolidCylinder1Str); SetAccessCommand(pCAAAfrMSolidCylinder1Str,\
NewAccess(CATCmdStarter,pCAAAfrMSolidCylinder2Str,CAAAfrMSolidCylinder2Str); SetAccessNext(pCAAAfrMSolidCylinder1Str,pCAAAfrMSolidCylinder2Str); SetAccessCommand(pCAAAfrMSolidCylinder2Str,\
The Insert menu command container is created, even if it already exists. Then the Solids submenu command container is created and set as the child of the Insert menu command container. Since no other positioning information is given, it should lay below the last submenu or command of the workshop menu bar, that is the Plane command. Then the Cuboid command starter is created and set as the child of the Solids submenu command container, and the others are cretaed and set next of one another. ——Insert Menu - Surfaces Submenu ... NewAccess(CATCmdContainer,pCAAAfrSurfacicEltSnu,CAAAfrSurfacicEltSnu) ; SetAccessNext(pCAAAfrSolidEltSnu,pCAAAfrSurfacicEltSnu);
NewAccess(CATCmdStarter,pCAAAfrMSurfRevolStr,CAAAfrMSurfRevolStr); SetAccessChild(pCAAAfrSurfacicEltSnu,pCAAAfrMSurfRevolStr); SetAccessCommand(pCAAAfrMSurfRevolStr,\NewAccess(CATCmdStarter,pCAAAfrMSurfNurbsStr,CAAAfrMSurfNurbsStr); SetAccessNext(pCAAAfrMSurfRevolStr,pCAAAfrMSurfNurbsStr); SetAccessCommand(pCAAAfrMSurfNurbsStr,\ 13
NewAccess(CATCmdStarter,pCAAAfrMSurfOffsetStr,CAAAfrMSurfOffsetStr);
搜索“diyifanwen.net”或“第一范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,第一范文网,提供最新经管营销CATIA二次开发 (4)全文阅读和word下载服务。
相关推荐: