Skip to main content
10-Marble
Dec 2, 2024 11:31 AM UTC
Solved

How to export a part or assembly to 3d pdf using vb API in creo 10

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?

sahmedsAnswer
10-Marble
Dec 3, 2024 6:53 AM UTC

 

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

 

 

 

1 reply

sahmeds10-MarbleAuthorAnswer
10-Marble
Dec 3, 2024 6:53 AM UTC

 

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

 

 

 

Translate