I have found a couple other threads noting a similar issue, but they aren’t using clipping planes and do not appear to have a resolution. I have a python script that uses ViewCaptureToFile for multiple Named Views. The script works just fine when the named views are just different camera locations, but if the views are clipped, they don’t update correctly before the output.
I tried adding rs.Redraw() and rs.Sleep() to increase my chances of making it work, but still does not update the clipping planes before exporting the view.
import rhinoscriptsyntax as rs
import os
all_views = rs.NamedViews() # a list of names (strings)
selected_views= rs.MultiListBox(all_views, message = "select views to save", defaults = all_views)
rs.EnableRedraw(True)
filename_base = rs.GetString("base file name","View_")
#savepath = r"/Users/User_Name/Desktop"
savepath = rs.BrowseForFolder(rs.DocumentPath(), "destination directory")
filepath = os.path.join(savepath, filename_base)
for view_name in selected_views:
rs.RestoreNamedView(view_name)
rs.Redraw()
rs.Sleep(2000)
rs.Command('-_ViewCaptureToFile '+chr(34)+filepath+view_name+'.png'+chr(34)+' _EnterEnd')
Similar topics:
ViewCaptureToFile saves the wrong mode - Scripting - McNeel Forum
Cycle through layers and namedviews using python rhinoscriptsyntax - Scripting - McNeel Forum
1 post - 1 participant