当前位置: 首页>>代码示例>>C++>>正文


C++ CComObject::CreateToolATC方法代码示例

本文整理汇总了C++中CComObject::CreateToolATC方法的典型用法代码示例。如果您正苦于以下问题:C++ CComObject::CreateToolATC方法的具体用法?C++ CComObject::CreateToolATC怎么用?C++ CComObject::CreateToolATC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CComObject的用法示例。


在下文中一共展示了CComObject::CreateToolATC方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: asdkCreateTools

void asdkCreateTools()
{
		CComObject<CBoltTool> tool;
		// Create the stock tool (definition)
		AcTcCatalog *pCatalog=tool.CreateStockToolATC(_T("BoltCatalog"));
		if(!pCatalog)
		{
			acutPrintf("\nFailed to create the Stock Tool\n");
			return;
		}
		// Create the 'BoltPalette'
		AcTcPalette *pPalette=tool.CreatePaletteATC(pCatalog,_T("BoltPalette"));
		if(!pPalette)
		{
			acutPrintf("\nFailed to create the Palette\n");
			return;
		}
		
		// Create the shape package to hold the flyout tool definitions
		AcTcPackage* pShapePackage=tool.CreateShapeCatalogATC(_T("Bolt Flyout Catalog"));
		if(!pShapePackage)
		{
			acutPrintf("\nFailed to create the Shape Catalog\n");
			return;
		}

		if(pShapePackage->GetChildCount()==0)
		{
			// Add two tools to this package
			tool.New();//Set Default Values specified in the New override for this tool.
			if(!tool.CreateToolATC(pShapePackage,_T("Stainless Bolt"),_T("IDB_BOLTIMAGE")))
				acutPrintf("\nFailed to create a Tool instance\n");
			
			// Now, create additional tools with different parameters:
			tool.m_HeadSides=6;
			tool.m_HeadHeight=2.5f;
			tool.m_ShaftLength=12.0f;
			tool.m_ShaftDiameter=3.0f;
			tool.m_ThreadLength=3.5f;
			tool.m_ThreadWidth=0.1f;
			tool.m_HeadDiameter=7.0f;
			tool.m_Color.setColorIndex(2);
			_tcscpy(tool.m_MaterialName,_T("Aluminum"));
			_tcscpy(tool.m_PartNumber,_T("Unassigned"));			
			if(!tool.CreateToolATC(pShapePackage,_T("Aluminum Bolt"),_T("IDB_BOLTALUMINUM")))
				acutPrintf("\nFailed to create a Tool instance\n");

			// A separate galvanized tool.
			tool.m_HeadSides=6;
			tool.m_HeadHeight=3.5f;
			tool.m_ShaftLength=15.0f;
			tool.m_ShaftDiameter=5.0f;
			tool.m_ThreadLength=5.5f;
			tool.m_ThreadWidth=0.3f;
			tool.m_HeadDiameter=9.0f;
			tool.m_Color.setColorIndex(4);
			_tcscpy(tool.m_MaterialName,_T("Galvanized"));
			_tcscpy(tool.m_PartNumber,_T("Unassigned"));			
			if(!tool.CreateToolATC(pShapePackage,_T("Galvanized"),_T("IDB_BOLTGALVANIZED")))
				acutPrintf("\nFailed to create a Tool instance\n");
						
			if(!tool.CreateCommandToolATC(pShapePackage,_T("BoltJig"),_T("IDB_BOLTJIG"),_T("^C^CBOLTJIG")))
				acutPrintf("\nFailed to create the Command Tool instance\n");
		}
		
		// Now create a flyout tool, a regular tool, and a command tool on the palette.
		
		tool.New();//reset the properties...
		if(!tool.CreateFlyoutToolATC(pPalette,pShapePackage,"Bolt Flyout"))
			acutPrintf("\nFailed to create a Flyout Tool instance\n");
		if(!tool.CreateToolATC(pPalette,_T("Stainless Tool"),_T("IDB_BOLTIMAGE")))
			acutPrintf("\nFailed to create a Shape Tool instance\n");
		if(!tool.CreateCommandToolATC(pPalette,_T("BoltJig"),_T("IDB_BOLTJIG"),_T("^C^CBOLTJIG")))
			acutPrintf("\nFailed to create a Shape Command Tool instance\n");

		// Refresh the Tool Palette with the above changes.
		AcTcGetManager()->LoadCatalogs(); // Refresh the Palette in the AutoCAD UI.
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:78,代码来源:boltJig.cpp


注:本文中的CComObject::CreateToolATC方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。