Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export image with macro without opening UG session

Status
Not open for further replies.

claforet

Mechanical
Apr 8, 2010
54
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
 
Replies continue below

Recommended for you

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
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
 
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.
 
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
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
 
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)

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

sorry, didn't post the entire thing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor