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')
@jcparks I created a file with a sphere and a few named views and exported them using your scripts. What am I missing? Would you mind listing the steps to replicate the issue? and example Rhino file would also be very helpful.
This is the export I get from a named view that has a clipping plane
For addition context, our working files were originally created in Rhino 7 and are still using those clipping planes not the new ones created for Rhino 8. The issue is that the view doesn’t reset for the views that follow the first. As Jake said, it doesn’t update so it seems to stay stuck on the first set of clipping planes (2 that face each other per view). Current workflow is double clicking each view, we then use a screen capture app to save to jpg. We have several files with up to 30 views in each so any help automating this would be very helpful.
Thank you!
NameView ClippingPlane.3dm (197.3 KB)
I attached a simple file to illustrate the issue. There are three Named Views, each view is associated with two clipping planes facing each other so as to only show a controlled amount of information. When I run the script, it will not update the clipping planes for each Named View. However, if I double click on each Named View then manually ViewCaptureToFile, it works. I want that capability scripted, but rs.Redraw() does not seem to update the clipping planes after rs.RestoreNamedView().
Would like to add a feature request related to this subject.
Named views panel thumbnails do not show an accurate preview of the view as saved with the clipping plane.