×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

NX Journal for importing CGMS and exporting pdfs.

NX Journal for importing CGMS and exporting pdfs.

NX Journal for importing CGMS and exporting pdfs.

(OP)
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.

RE: NX Journal for importing CGMS and exporting pdfs.

NX includes a utility just for converting cgm files to pdf files. You can skip the whole import/export process and just script this utility.

Search for cgm2pdf in the help files for more information.

www.nxjournaling.com

RE: NX Journal for importing CGMS and exporting pdfs.

(OP)
/facepalm

This will eliminate miles of code.

Thanks!! By the way, I saw that website when searching for an answer. I wondered if it was brand new. It looks great.

RE: NX Journal for importing CGMS and exporting pdfs.

(OP)
Actually, with this there's no need for a journal at all, it can totally be done without running NX. Awesome.

RE: NX Journal for importing CGMS and exporting pdfs.

(OP)
I got it working, but it seems that I can't pass it a file on a network drive for some reason. I even tried using the cgm2pdf manually through a command prompt. Local folders work fine, local folders with spaces in the names works fine as well. It's odd.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources