Hi,
I am trying to export different view of the part into JPG using this piece of code
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module NXJournal
Dim theSession As Session = Session.GetSession()
' ----------------------------------------------
' Menu: File->Open...
' ----------------------------------------------
Dim basePart1 As BasePart
Dim partLoadStatus1 As PartLoadStatus
basePart1 = theSession.Parts.OpenBaseDisplay("D:\personal\hoangd\Desktop\SDCTWQ0173_C38080808080808034A7\TankOnlyForNXtest.prt", partLoadStatus1)
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
partLoadStatus1.Dispose()
UFSession.GetUFSession()
Dim background_color As UFDisp.BackgroundColor = UFDisp.BackgroundColor.white
displayPart.WCS.Visibility = True
ufs.Disp.CreateImage("D:\personal\hoangd\Desktop\SDCTWQ0173_C38080808080808034A7\isometric.jpg", UFDisp.ImageFormat.Jpeg, background_color)
End Sub
End Module
I were sucessful running this code in NX - Playing journal. However, using the command line with run_journal.exe give me an error "Unhandle exception" when NX tries to create an image. It would be nice to hear your opinions on this issues and whether it is possible to resolve it.
Many thanks,
Duong
Sorry for the bad text, here
Sorry for the bad text, here is the good one
Hi, I am trying to export different view of the part into JPG using this piece of code
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module NXJournal
Sub Main (ByVal args() As String)
Dim theSession As Session = Session.GetSession()
theSession.ListingWindow.Open
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
partLoadStatus1.Dispose()
' ----------------------------------------------
' Export images...
' ----------------------------------------------
Dim currentView As ViewCollection = basePart1.View()
Dim view1() As View = currentView.ToArray()
currentView.CreateImage(view1(0))
'Dim ufs As UFSession = UFSession.GetUFSession()
'Dim background_color As UFDisp.BackgroundColor = UFDisp.BackgroundColor.white
'displayPart.WCS.Visibility = True
'ufs.Disp.CreateImage("D:\personal\hoangd\Desktop\SDCTWQ0173_C38080808080808034A7\isometric.jpg", UFDisp.ImageFormat.Jpeg, background_color)
workPart = Nothing
displayPart = Nothing
End Sub
End Module
I were sucessful running this code in NX - Playing journal. However, using the command line with run_journal.exe give me an error "Unhandle exception" when NX tries to create an image. It would be nice to hear your opinions on this issues and whether it is possible to resolve it.
Many thanks, Duong
re: export jpg
I don't think it is possible to export a 'screenshot' graphic file from NX if there is no visible display. Perhaps it would be possible to export a rendering from NX when it is running in batch mode, but I have not tried it yet.