Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hi,
I'm trying to export creo drawing to dxf with WebLink application, but I don't know how to use pfcExport2DOption. For PDF there's a documented way how to use options:
var expInstructions = pfcCreate("pfcDXFExportInstructions").Create();
var expInstructions = pfcCreate("pfcPDFExportInstructions").Create();
var pdfOptions = pfcCreate("pfcPDFOptions");
...
expInstructions.Options = pdfOptions;
But for DXF (pfcExport2DOption) can't find a way to pass options to export instructions.
A mapkey may be an option to set your options - assuming they are available via the UI.
dave
Thanks, but I'd expect some programmable solution, like for PDF export. I see there's an CS19626 article about this but unfortunately I don't have subscription.
Technically... Mapkeys are a programmable solution... you can parameterize and execute them in your code - they are just not a "native call" to the kernel via a focused API. Mapkeys, while not elegant - can often fill the gaps in the API that the UI seems to present options for - hence the recommendation.
The article you mention says that the function will be implemented in future release.In VB.API, the method to export dxf is to use IpfcModel.Export(). From the documentation it seems there is similar command in weblink (pfcModel.Export()).
Example of the code in vb.net:
Dim iModel as IpfcModel = session.CurrentModel
Dim myDXFInstr = (New CCpfcDXFExportInstructions).Create
iModel.Export("Filename comes here", myDXFInstr)
Thank you for your reply. As you said from the article the functionality is not yest implemented (at least not for my creo 2.0) the mapkey is probably the only solution. And yes, there's weblink equivalent for vb.net Export() function, but the problem is how to assign dxf export options for, in your case, myDXFInstr object.
The artical says its not implemented because pfcExport2DOption is a totaly different from pfcModel.Export(). It says its not implemented in either API , yet I can export dxf in vb.net. pfcModel.Export() should use pfcDXFExportInstructions, as it is mentioned in the documentation.
but will you be able to export all sheets? Because that's what I'm looking for. Currently I can only export active sheet even though I switched sheets with assigning numbers to drawing.CurrentSheetNumber property.
If you are referring to drawing.currentsheetnumber as pfcDrawing.CurrentSheetNumber than it should work as you intent it to work, because I used it that way. What you can try is pfcSheetOwner.CurrentSheetNumber. Both works for me, and they only mention the later in the official documentation.
To answer you question, yes you should be able to export all sheets this way, obviously all the dxf will be a separate file.
Thanks for suggestion that it's possible to export all sheets to dxf. I looked through my code and realized that there was a bug: I didn't erased the drawing (drawing.Erase()) from session before converting next drw. I tried with two drawing (single sheet and three sheets) and when the first was converted the second generates all the same dxf's. In reverse order the conversion was correct. This led me to the solution. Problem solved. Thanks again.
It's odd, there not a single earse line in my code. Glad you figured it out!