Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
As per this thread, similar issue:
Hi,
Have somebody an example how to export drawing to DXF? Trying to adapt first example (ExportDXF3D) but have issues with RetriveModelWithOpts method . Is there some ideas how to export drawing to dxf ?
Hello again,
I have following method to export drawing to dxf but I have an exception pfcExceptions::XToolkitGeneralError on RetrieveModelWithOpts.
The export of part to 3dDXF from this thread working fine. Can somebody help to assist what exact cause of an error. What I'm doing wrong?
static internal bool ExportToDXF(string strFile, string strDXF, IpfcAsyncConnection conn)
{
if (string.IsNullOrEmpty(CreoPath))
return false;
IpfcModel model = null;
try
{
var dxf2d = (new CCpfcExport2DOption().Create()) as IpfcExport2DOption;
int drwtype = (int)EpfcModelType.EpfcMDL_DRAWING;
var session = conn.Session as IpfcBaseSession;
var drwmodelDesc = new CCpfcModelDescriptor().Create(drwtype, strFile, null);
model = session.RetrieveModelWithOpts(drwmodelDesc, new CCpfcRetrieveModelOptions().Create());
try
{
dxf2d.ExportSheetOption = (int)EpfcExport2DSheetOption.EpfcEXPORT_ALL;
var exi = dxf2d as IpfcExportInstructions;
model.Export(strDXF, exi);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
return false;
}
return true;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
return false;
}
}
Have you tried to open drawing using RetireveModel() (not with RetrieveModelWithOpts) ?
I got GenedelError when drawing was unable to retireved. Eg. if drawing is corrupted and cannot open it either manually using gui.