Hi! I'm by no means an expert, but I've cobbled together a rendering macro. When run, it exports .bmps of all configurations and named views of a part or assembly to a chosen folder.
The issue is, when I have a decently complex part or assembly, it sometimes just renders empty screens. You'll see that it has a pause in it to give everything a chance to build, but even when I extend that pause to a very long time, it will still occasionally give me an empty screen. It seems to be a little random which configurations fail to export.
Here's the relevant section of code, and the macro in its entirety is attached:
'Goes through all named views and configurations and renders them to .BMP<br> For u = 10 To UBound(vNamedViewArr)<br><br><br> sViewName = vNamedViewArr(u)<br><br> rebuild = swModel.ForceRebuild3(True)<br> swModel.GraphicsRedraw2<br> swModel.ViewZoomtofit2<br> bShowView = swModel.ShowNamedView2(sViewName, -1)<br><br> For i = 0 To UBound(vConfNameArr)<br><br> sConfigName = vConfNameArr(i)<br><br> bShowConfig = swModel.ShowConfiguration2(sConfigName)<br> rebuild = swModel.ForceRebuild3(True)<br> swModel.GraphicsRedraw2<br> swModel.ViewZoomtofit2<br><br> Sleep 3000<br><br> 'Access PhotoView 360<br> Set swRayTraceRenderer = swApp.GetRayTraceRenderer(swPhotoView)<br> Set swRayTraceRenderOptions = swRayTraceRenderer.RayTraceRendererOptions<br><br> 'Display render window (not necessary for the macro to work but it takes so long that you'll think your computer is frozen otherwise)<br> rendering = swRayTraceRenderer.DisplayPreviewWindow<br><br> 'sets location and title to the chosen location and configuration name<br> fileLocName = fileLoc & sConfigName & " " & sViewName<br><br> 'exports in BMP format<br> swRayTraceRenderOptions.ImageFormat = swImageFormat_WindowsBmp<br> status = swRayTraceRenderer.RenderToFile(fileLocName, 0, 0)<br><br> 'Close Photoview 360<br> rendering = swRayTraceRenderer.CloseRayTraceRender<br><br><br> Next i<br><br> Next u<span class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span>SolidworksApi/macros