Hi guys i found the next code on the platform,
unfurtunatly i could not get it to work well, i dont know why and i also do not know what i can do to make it work.
any help would be perfect 🙂
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)