- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
We will create a DXF file from a flat pattern using the DataIO class. Then we need to open the DXF file and possible reorient it, scale it, or remove unneeded edges. we do this using the TranslatorAddIn with the following code.
CComPtr<ApplicationAddIns> addins;
Result = m_pApplication->get_ApplicationAddIns(&addins);
CComBSTR appid = /*NOXLATE*/_T("{C24E3AC4-122E-11D5-8E91-0010B541CD80}");
CComPtr<ApplicationAddIn> addin;
Result = addins->get_ItemById(appid, &addin);
CComQIPtr<TranslatorAddIn> transaddin(addin);
CComPtr<DataMedium> datamed;
transobj->CreateDataMedium(&datamed);
datamed->put_FileName(dxffilename);
CComPtr<TranslationContext> context;
transobj->CreateTranslationContext(&context);
context->PutType(kFileBrowseIOMechanism);
CComPtr<IDispatch> newdocdisp;
transaddin->Open(datamed, context, namemap, &newdocdisp);
CComQIPtr<Document> newdoc(newdocdisp);
if(!newdoc)
return false;
The problem is that when it opens the DXF file it uses the default drawing template, that may contain borders, title blocks, etc. Is there any way to specify the template to be used so we can use an empty one? Barring that, is there any way to see if it is empty, and if not empty it?
Solved! Go to Solution.