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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Creo VB API PDF Export Code does not work after Upgrade from 3.0 to 7.0

spfeifenberger
7-Bedrock

Creo VB API PDF Export Code does not work after Upgrade from 3.0 to 7.0

Hello,

i have a Programm for exporting drawings to different formats (DWG, DXF and PDF). After Updating to Version 7.0 my code doesnt work anymore, although it works in Creo 3.0?

 

i get the ExportInstructions :

 

Dim exportPDFInstructions As IpfcPDFExportInstructions = getPDFInstructions3D(EpfcPDFExportMode.EpfcPDF_3D_AS_NAMED_VIEWS)
oExportInstructions = exportPDFInstructions

model.Export(exportSetting.sPath + "\" + sFilename + oFormat.Extension, oFormat.oExportInstructions)

 

Unfortunately in Creo 7 i get the following error:

"pfcExceptions::XToolkitInvalidType"

In Creo 3 it works without Problems, the Object Type is the same

 

Has anybody the same Problem and maybe a Solution?

 

 

 

Private Function getPDFInstructions3D(ByVal expMode As EpfcPDFExportMode) As IpfcPDFExportInstructions
Dim instructions As IpfcPDFExportInstructions

Dim opts As IpfcPDFOptions
Dim opt1 As IpfcPDFOption
Dim opt2 As IpfcPDFOption
Dim opt3 As IpfcPDFOption
Dim opt4 As IpfcPDFOption
Dim opt5 As IpfcPDFOption

opts = New CpfcPDFOptions

opt1 = (New CCpfcPDFOption).Create
opt1.OptionType = EpfcPDFOptionType.EpfcPDFOPT_LAUNCH_VIEWER
opt1.OptionValue = (New CMpfcArgument).CreateBoolArgValue(False)
opts.Append(opt1)

opt2 = (New CCpfcPDFOption).Create
opt2.OptionType = EpfcPDFOptionType.EpfcPDFOPT_EXPORT_MODE
opt2.OptionValue = (New CMpfcArgument).CreateIntArgValue(expMode)
opts.Append(opt2)

opt3 = (New CCpfcPDFOption).Create
opt3.OptionType = EpfcPDFOptionType.EpfcPDFOPT_ORIENTATION
opt3.OptionValue = (New CMpfcArgument).CreateIntArgValue(EpfcSheetOrientation.EpfcORIENT_LANDSCAPE)
opts.Append(opt3)

opt4 = (New CCpfcPDFOption).Create
opt4.OptionType = EpfcPDFOptionType.EpfcPDFOPT_EXPORT_MODE
opt4.OptionValue = (New CMpfcArgument).CreateIntArgValue(EpfcPDFExportMode.EpfcPDF_3D_AS_NAMED_VIEWS)
opts.Append(opt4)

opt5 = (New CCpfcPDFOption).Create
opt5.OptionType = EpfcPDFOptionType.EpfcPDFOPT_VIEW_TO_EXPORT
opt5.OptionValue = (New CMpfcArgument).CreateIntArgValue(EpfcPDFSelectedViewMode.EpfcPDF_VIEW_SELECT_CURRENT)
opts.Append(opt5)

instructions = (New CCpfcPDFExportInstructions).Create
'instructions.FilePath = sFile
instructions.Options = opts

Return (instructions)
End Function

 

Thank You!

Sebastian

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

 

thank you for your response, unfortunately i postet the wrong function, have one for 2D and one for 3D.

But beside that i found the solution, i think it was a not correct registeres VB API from the Creo 7. I tried to unregister and register again, and it seems to solve the problem. I did this before, but now it worked.

I did not mention it before because the other functions work except the export function.

View solution in original post

3 REPLIES 3

My suggestion ... ask PTC Support.


Martin Hanák

I'm confused here, you mention you use it to export drawing, yet you use EpfcPDF_3D_AS_NAMED_VIEWS. The documentation says: "3D models are exported as 2D raster images embedded in PDF files."

Hi,

 

thank you for your response, unfortunately i postet the wrong function, have one for 2D and one for 3D.

But beside that i found the solution, i think it was a not correct registeres VB API from the Creo 7. I tried to unregister and register again, and it seems to solve the problem. I did this before, but now it worked.

I did not mention it before because the other functions work except the export function.

Top Tags