Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
davis.j
in reply to: Anonymous

I wonder if anyone is still interested in this. I think it would be possible to setup a batch script utilizing the ray tracing render method. I'm just not sure how you would select the documents to render. Maybe you could place all of the documents in a folder and let the script iterate through all of them.... I ain't not wiz though.

 

Credit where it is due for the author of this code but this could be a start:

Dim VaultAddin As ApplicationAddIn = ThisApplication.ApplicationAddIns.ItemById("{48B682BC-42E6-4953-84C5-3D253B52E77B}")
	VaultAddin.Deactivate()

oDoc = ThisApplication.ActiveDocument
Dim oView As Inventor.View = ThisApplication.ActiveView

Dim oColorScheme As String
oColorScheme = ThisApplication.ActiveColorScheme.Name
Dim oBackGroundType As BackgroundTypeEnum
oBackGroundType = ThisApplication.ColorSchemes.BackgroundType
ThisApplication.ColorSchemes.Item("Presentation").Activate
ThisApplication.ColorSchemes.BackgroundType = 52737 'kOneColorBackgroundType


Dim oOriginSetOff As Boolean
oOriginSetOff = False
If ThisApplication.DisplayOptions.Show3DIndicator Then
	ThisApplication.DisplayOptions.Show3DIndicator = False
	oOriginSetOff = True
End If

On Error Resume Next
With oDoc.ObjectVisibility
	.AllWorkFeatures = False
	.Sketches = False
	.Sketches3D = False
End With

oView.DisplayMode = DisplayModeEnum.kRealisticRendering

oView.RayTracing=  True 
oView.RayTracingQuality = RayTracingQualityEnum.kDraftRayTracingQuality

Dim bStop As Boolean 

Do 
	ThisApplication.UserInterfaceManager.DoEvents
	
	If (oView.RayTracingProgress = 1) Then
		bStop = True
		Dim picName As String = ThisDoc.PathAndFileName(False) + Now.toString(" yyMMddHHmmss") 'timestamp
		Call oView.SaveAsBitmap(picName & ".png", oView.Width, oView.Height)
	End If
	
	If (oView.RayTracing = False) Then
			bStop = True 
	End If
Loop Until (bStop)

oView.RayTracing = False

If oOriginSetOff Then
	ThisApplication.DisplayOptions.Show3DIndicator = True
End If
ThisApplication.ColorSchemes.Item(oColorScheme).Activate
ThisApplication.ColorSchemes.BackgroundType = oBackGroundType

oView.DisplayMode = DisplayModeEnum.kShadedWithEdgesRendering
VaultAddin.Activate()

MessageBox.Show("Exported image to " & ThisDoc.PathAndFileName(False) & ".png", "Export Complete", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)

  

Try it out.