×
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

Export image with macro without opening UG session

Export image with macro without opening UG session

Export image with macro without opening UG session

(OP)
I'm trying to write a journal that I can run from the command line which will open a part and export an image of the part as a jpg.  But I want it to run without having to open a UG window (i.e. run in the background, I don't want to see the parts being processed).  I can do this with a journal which I run on an open part in UG using this code:


s.parts.work.ModelingViews.WorkView.RenderingStyle = NXOpen.View.RenderingStyleType.ShadedWithEdges
        s.parts.work.ModelingViews.WorkView.orient(nxopen.view.canned.isometric,0)
        s.parts.work.ModelingViews.WorkView.HiqhQualityImage.method=1
        s.parts.work.ModelingViews.WorkView.HiqhQualityImage.format=0
            s.parts.work.ModelingViews.WorkView.HiqhQualityImage.useibl=false
        s.parts.work.ModelingViews.WorkView.HiqhQualityImage.generate
        s.parts.work.ModelingViews.WorkView.HiqhQualityImage.save("c:\pic.jpg", true)


But if I make a journal which runs this in the background, it doesn't save any images.  Is there a way to do what I'm looking for?  I'm in NX7.5.

Thanks

RE: Export image with macro without opening UG session

Unless an NX session is actually running, there are NO images to capture.

Images can only be captured while they are being displayed since the Export Image function is simply grabbing that portion of the graphic card's frame buffer which represents the so-called NX 'graphics' window.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
http://www.siemens.com/plm
UG/NX Museum:   http://www.plmworld.org/p/cm/ld/fid=209

To an Engineer, the glass is twice as big as it needs to be.
 

RE: Export image with macro without opening UG session

(OP)
Thanks John, that makes sense.  Do you know if there's a way with the 'High Quality Image' function to get a white background for the image?

Thanks.

RE: Export image with macro without opening UG session

If you set your normal modeling background to white and not use any of the 'scene' options, it should come out as white when you render the image.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
http://www.siemens.com/plm
UG/NX Museum:   http://www.plmworld.org/p/cm/ld/fid=209

To an Engineer, the glass is twice as big as it needs to be.
 

RE: Export image with macro without opening UG session

not sure if this is possible with the HQ capture, but this will forces a white background when taking regular captures.

OpenSession.Disp.CreateImage(FileTop, UFDisp.ImageFormat.Jpeg, UFDisp.BackgroundColor.White)

 

RE: Export image with macro without opening UG session

Dim OpenSession = UFSession.GetUFSession()
OpenSession.Disp.CreateImage(FileTop, UFDisp.ImageFormat.Jpeg, UFDisp.BackgroundColor.White)

sorry, didn't post the entire thing

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