Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi,
I'm using Creo 10 and i'm trying to export the model to 3d PDF using VB COM API in C#.
i tried below 2 options and getting exceptions.
var instructions = new CCpfcPDFExportInstructions().Create();
model.Export(pdfFilePath,(IpfcExportInstructions) instructions);
model.ExportIntf3D(pdfFilePath, (int)EpfcExportType.EpfcEXPORT_PDF,null);
can you please provide some code sample to guide me through?
Solved! Go to Solution.
Solved it!.
private IpfcPDFExportInstructions GetPDFInstructions3D(EpfcPDFExportMode expMode)
{
var opts = new CpfcPDFOptions();
var opt1 = new CCpfcPDFOption().Create();
opt1.OptionType = EpfcPDFOptionType.EpfcPDFOPT_LAUNCH_VIEWER;
opt1.set_OptionValue(new CMpfcArgument().CreateBoolArgValue(false));
opts.Append(opt1);
var opt2 = new CCpfcPDFOption().Create();
opt2.OptionType = EpfcPDFOptionType.EpfcPDFOPT_EXPORT_MODE;
opt2.set_OptionValue(new CMpfcArgument().CreateIntArgValue((int)expMode));
opts.Append(opt2);
var opt3 = new CCpfcPDFOption().Create();
opt3.OptionType = EpfcPDFOptionType.EpfcPDFOPT_ORIENTATION;
opt3.set_OptionValue(new CMpfcArgument().CreateIntArgValue((int)EpfcSheetOrientation.EpfcORIENT_LANDSCAPE));
opts.Append(opt3);
var opt5 = new CCpfcPDFOption().Create();
opt5.OptionType = EpfcPDFOptionType.EpfcPDFOPT_VIEW_TO_EXPORT;
opt5.set_OptionValue(new CMpfcArgument().CreateIntArgValue((int)EpfcPDFSelectedViewMode.EpfcPDF_VIEW_SELECT_CURRENT));
opts.Append(opt5);
var instructions = new CCpfcPDFExportInstructions().Create();
instructions.set_Options(opts);
return instructions;
}
Solved it!.
private IpfcPDFExportInstructions GetPDFInstructions3D(EpfcPDFExportMode expMode)
{
var opts = new CpfcPDFOptions();
var opt1 = new CCpfcPDFOption().Create();
opt1.OptionType = EpfcPDFOptionType.EpfcPDFOPT_LAUNCH_VIEWER;
opt1.set_OptionValue(new CMpfcArgument().CreateBoolArgValue(false));
opts.Append(opt1);
var opt2 = new CCpfcPDFOption().Create();
opt2.OptionType = EpfcPDFOptionType.EpfcPDFOPT_EXPORT_MODE;
opt2.set_OptionValue(new CMpfcArgument().CreateIntArgValue((int)expMode));
opts.Append(opt2);
var opt3 = new CCpfcPDFOption().Create();
opt3.OptionType = EpfcPDFOptionType.EpfcPDFOPT_ORIENTATION;
opt3.set_OptionValue(new CMpfcArgument().CreateIntArgValue((int)EpfcSheetOrientation.EpfcORIENT_LANDSCAPE));
opts.Append(opt3);
var opt5 = new CCpfcPDFOption().Create();
opt5.OptionType = EpfcPDFOptionType.EpfcPDFOPT_VIEW_TO_EXPORT;
opt5.set_OptionValue(new CMpfcArgument().CreateIntArgValue((int)EpfcPDFSelectedViewMode.EpfcPDF_VIEW_SELECT_CURRENT));
opts.Append(opt5);
var instructions = new CCpfcPDFExportInstructions().Create();
instructions.set_Options(opts);
return instructions;
}