cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

how to export drawing to DXF

VH_10228089
4-Participant

how to export drawing to DXF

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 ?

2 REPLIES 2

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;
}
}

 

sjuraj
13-Aquamarine
(To:VH_10228089)

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.

Top Tags