| |
 | Gut zu wissen: Hilfreiche Tipps und Tricks aus der Praxis prägnant, und auf den Punkt gebracht für PTC CREO |
| |
 | Online-Kurs: Grundlagen des 3D-Druck-Designs für Industrieingenieure , ein Kurs
|
Autor
|
Thema: ProE WF5 Visual Basic PDF Export (3289 mal gelesen)
|
steinchen01 Mitglied

 Beiträge: 11 Registriert: 16.11.2010 Wildfire 5 mit Windows 7 Visual Basic Express 2010
|
erstellt am: 16. Nov. 2010 15:30 <-- editieren / zitieren --> Unities abgeben:         
Hallo Forum, ich glaub ich benötige mal eure Hilfe. Ich bin dabei ein Programm zu schreiben mit dessen Hilfe ich automatisch PDF Dateien aus Proe Dokumenten erzeugen kann. Doch leider hänge ich im Moment an den export optionen. Die Variable pdfopt ist das Problem. Hier mal Auszugweise meine Datei. Imports pfcls Module Module1 Sub Main() Dim exePath = "C:\ptc\proeWildfire50\bin\proe1.bat" Dim WorkDir = "C:\work" Dim asyncConnection As IpfcAsyncConnection = Nothing Dim cAC As CCpfcAsyncConnection Dim session As IpfcBaseSession Dim test As IpfcModel Try cAC = New CCpfcAsyncConnection asyncConnection = cAC.Start(exePath + " -g:graphics -i:", ".") session = asyncConnection.Session Dim descModel As IpfcModelDescriptor Dim expdf As IpfcPDFExportInstructions Dim pdfopt As IpfcPDFOption Dim EpfcPDFOPT_LAUNCH_VIEWER As Boolean EpfcPDFOPT_LAUNCH_VIEWER = False descModel = (New CCpfcModelDescriptor).Create(EpfcModelType.EpfcMDL_DRAWING, "test.drw", Nothing) expdf = (New CCpfcPDFExportInstructions).Create() pdfopt = (New CCpfcPDFOption).Create() pdfopt.OptionValue.BoolValue = EpfcPDFOPT_LAUNCH_VIEWER expdf.FilePath = "c:\work\test.pdf" expdf.Options = pdfopt test = session.RetrieveModel(descModel) test.Display() test.Export("c:\work\test.pdf", expdf) Catch ex As Exception MsgBox(ex.Message.ToString + Chr(13) + ex.StackTrace.ToString) Finally '====================================================================== 'End the Pro/ENGINEER session when done '====================================================================== 'If Not asyncConnection Is Nothing AndAlso ' asyncConnection.IsRunning Then 'asyncConnection.End() 'End If End Try End Sub End Module MFG Steinchen Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |
DonChunior Mitglied CAD-Systemadministrator
   
 Beiträge: 1157 Registriert: 09.09.2004 Creo Parametric 10.0.5.0 Windchill 12.1.2.9 Windows 10 Enterprise x64
|
erstellt am: 16. Nov. 2010 15:57 <-- editieren / zitieren --> Unities abgeben:          Nur für steinchen01
|
steinchen01 Mitglied

 Beiträge: 11 Registriert: 16.11.2010 Wildfire 5 mit Windows 7 Visual Basic Express 2010
|
erstellt am: 16. Nov. 2010 16:07 <-- editieren / zitieren --> Unities abgeben:         
|
AVozelj09 Mitglied
 Beiträge: 1 Registriert: 17.11.2010
|
erstellt am: 17. Nov. 2010 22:04 <-- editieren / zitieren --> Unities abgeben:          Nur für steinchen01
Hi, This is how I set pdf option not to open pdf reader for ProE vbapi: (at this time I am developing something with pdfs for proe and google your forum question). Hope it helps. Best regards, Ales Sub Print_To_PDF(ByVal oModel As pfcls.IpfcModel, ByVal sFile As String) Dim instructions As IpfcPDFExportInstructions instructions = getPDFInstructions(sFile) oModel.Export(sFile, instructions) End Sub Private Function getPDFInstructions(ByVal sFile As String) As IpfcPDFExportInstructions Dim instructions As IpfcPDFExportInstructions instructions = (New CCpfcPDFExportInstructions).Create Dim opts As IpfcPDFOptions opts = New CpfcPDFOptions opts.Insert(0, Viewer) instructions.FilePath = sFile instructions.Options = opts Return (instructions) End Function Public Function Viewer() As IpfcPDFOption Dim opt As IpfcPDFOption opt = (New CCpfcPDFOption).Create Try opt.OptionType = EpfcPDFOptionType.EpfcPDFOPT_LAUNCH_VIEWER opt.OptionValue = (New CMpfcArgument).CreateBoolArgValue(False) Catch ex As Exception LogWindow.rtbLog.Text &= ex.Message Finally End Try Return opt End Function Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |
buwsoft Mitglied software developer

 Beiträge: 62 Registriert: 04.06.2009 Intel Core 2 Duo 2.1GHz, 2 GB RAM Diverse Pro/E-Versionen
|
erstellt am: 18. Nov. 2010 09:38 <-- editieren / zitieren --> Unities abgeben:          Nur für steinchen01
|
steinchen01 Mitglied

 Beiträge: 11 Registriert: 16.11.2010 Wildfire 5 mit Windows 7 Visual Basic Express 2010
|
erstellt am: 18. Nov. 2010 11:23 <-- editieren / zitieren --> Unities abgeben:         
|
steinchen01 Mitglied

 Beiträge: 11 Registriert: 16.11.2010 Wildfire 5 mit Windows 7 Visual Basic Express 2010
|
erstellt am: 18. Nov. 2010 16:37 <-- editieren / zitieren --> Unities abgeben:         
Hallo Forum, um mal bei der AVozelj09 Funktion zu bleiben, sie funzt gut auch mit titel und autor übergabe. was aber muss ich tun um die PDF monochrome zu bekommen. Egal was für ein pfcargument ich nehme mir fliegt jedesmal die Funktion um die Ohren. Public Function monochrome() As IpfcPDFOption Dim opt As IpfcPDFOption opt = (New CCpfcPDFOption).Create Try opt.OptionType = EpfcPDFOptionType.EpfcPDFOPT_COLOR_DEPTH ????? opt.OptionValue = (New CMpfcArgument).CreateSelectionArgValue(EpfcPDFColorDepth.EpfcPDF_CD_MONO) ???????? Catch ex As Exception
Finally End Try Return opt End Function mfg steinchen Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |