Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

VB API Import STEP, Export PDF U3D

braynpower

New member
G'day all,

So I was thinking that as I have a spare PC, and a mail-in account, I could let my colleagues send it STEP files or IGES files, and get a 3D PDF back. Granted there are programs that exist that can do this, and they are probably less heavy than using CREO and the VB API, but then this would require my colleagues to use software other than outlook and to perhaps think before sending me a request like "can you take me a picture of this file" or whatnot... ;0)

So, does anyone have some insight into the Import command...? I have tried some basic approaches, and they all fail mainly due to some kind of INVALID VARIABLE TYPE or the cack-handedness of my coding skills... (I can get the API to do some cool stuff, but 'googramming' style...).

I can't work out why I can't just call the .ImportNewModel command like so (granted the connection is working, test.stp exists etc...if only vbug.pdf was easy to understand for people who have had no formal training of any kind of programming...):

Dim ImpMod as IpfcModel

Set ImpMod = session.ImportNewModel("d:\temp\test.stp", EpfcNewModelImportType.EpfcIMPORT_NEW_STEP, EpfcModelType.EpfcMDL_PART, "diditwork.prt", "")

but something tells me I'm taking a shortcut somewhere. I have used the export command before, setting up modeldescriptors and so on, but I thought that only pertained to .prt files, and there is no mention of needing to do so with the import command.

If anyone has something to share, would be cool... but as with so many posts here about programming, I wont get my hopes up... :'0( hehe.

Cheers!
 
So, ladies and gentlemen. with regards to my unanswered request for help, The good news is that I have managed to ferret around long enough to find the following document on support.ptc.com knowledge base <Document - CS141963>... It only deals with the excel tocreo to pdf bit. but hey its a start.

https://tinyurl.com/pnnshy9 (hopefully the redirect will work, but i think you need to be logged in to ptc.com)

have a looksee if you're interested.

Whilst this document doesn't do everything I need it to, it is a good template to hack at my plan.

Basically this script will fail if you try for a 3D pdf, but it is easily modified to do so....

I get rid of the stroke all whatever it was and replace with this:

' Set 3D PDF Option
Dim PDFOptionCreate_SAF As New CCpfcPDFOption
Dim PDFOption_SAF As IpfcPDFOption
Set PDFOption_SAF = PDFOptionCreate_SAF.Create
PDFOption_SAF.OptionType = EpfcPDFOptionType.EpfcPDFOPT_EXPORT_MODE
Dim newArg_SAF As New CMpfcArgument
PDFOption_SAF.OptionValue = newArg_SAF.CreateIntArgValue(EpfcPDFExportMode.EpfcPDF_3D_AS_U3D_PDF)
Call PDF_Options.Append(PDFOption_SAF)


And then boom! combined with all the crazy scripts i have running on my two machines, at least now i can make a 3d pdf automatically, and send it back to whoever sent the file in the first place (but so far it has to be a native creo file).

Now I just need to attack the import STEP and import IGES bit...
 

Sponsor

Articles From 3DCAD World

Back
Top