beng021228
Mechanical
- Apr 10, 2012
- 17
I'm writing a Journal that will import cgm files and export a pdf of the cgm. I'm using NX6 with the vb language for journals. I say nx6, but I run into the same problem in nx8. First I recorded a journal where I create a new model file, go into drafting (thus creating a dummy blank sheet that doesn't get used) import the cgm file, and export the new sheet created by the import as a pdf. Doing this manually creates a correctly sized drawing sheet containing the cgm data. When I replay this journal it imports the cgm into the dummy sheet, the size is incorrect, unless it so happens that the cgm is the same size as my dummy sheet. I'm trying to figure out how to get the journal to import the cgm file in the same way that manually importing does. My goal is to end up with a form type journal where I select a folder containing cgm files, hit exexute and it converts the cgm files to pdfs. Currently it works thusly, however all the pdfs are chopping bits of the cgm off because of the incorrect sheet size. I thought maybe I could preread the cgm file and determine the size I should make my dummy sheet, but I think cgm files are in hex and I don't know how to deal with that. Any help would be greatly appreciated.
Here's my bit of code where the importing happens:
Dim importer1 As Importer
importer1 = workPart.ImportManager.CreateCgmImporter()
importer1.FileName = fullfilepath & "cgm"
Dim markId9 As Session.UndoMarkId
markId9 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Import CGM Commit")
Dim nXObject3 As NXObject
nXObject3 = importer1.Commit()
theSession.DeleteUndoMark(markId9, Nothing)
importer1.Destroy()
Thanks again.
Here's my bit of code where the importing happens:
Dim importer1 As Importer
importer1 = workPart.ImportManager.CreateCgmImporter()
importer1.FileName = fullfilepath & "cgm"
Dim markId9 As Session.UndoMarkId
markId9 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Import CGM Commit")
Dim nXObject3 As NXObject
nXObject3 = importer1.Commit()
theSession.DeleteUndoMark(markId9, Nothing)
importer1.Destroy()
Thanks again.