首页 SW二次开发-导出到dxf和pdf

SW二次开发-导出到dxf和pdf

小白鼠 2019-07-11 09:13:19 0 2263

sw的导出任何一种格式使用的都是 SaveAs4 方法,具体的代码如下:

void  SaveDrawingFile()
{
	CComPtr<IModelDoc2> pModel;
	CComPtr<IDrawingDoc> pDrawing;
	m_iSldWorks->get_IActiveDoc2(&pModel);
	ASSERT(pModel);
	pModel->QueryInterface(IID_IDrawingDoc,(LPVOID*)&pDrawing);
	if(pDrawing == NULL)
		return;
	long error1,error2;
	long waring1,waring2;
	VARIANT_BOOL retval1;
	VARIANT_BOOL retval2;
	CComBSTR name1(_T("D:\\myDrawing.dxf"));
	CComBSTR name2(_T("D:\\myDrawing.pdf"));
	//save as .dxf 
	pModel->SaveAs4(name1,swSaveAsCurrentVersion,swSaveAsOptions_Silent,
		&error1,&waring1,&retval1);
	//save as .pdf
	pModel->SaveAs4(name2,swSaveAsCurrentVersion,swSaveAsOptions_Silent,
		&error2,&waring2,&retval2);
}

导出 · pdf · dxf ·

发表评论