Import only selected named views please

Ideally when importing the named views we would get a dialog with a list of named views to pick from - in most cases, at least here - I need only one/some of them, especially that the same named views get replaced. So we still need to open the file to import from, delete the views we are not interested in, and, for speed, pick one object and ‘export selected’ as 3dm to a temp file just to import the needed views. Pretty tedious.

thanks-

–jarek

2 Likes

100% agreed if this could be implemented using _ReadViewportsFromFile command. Below is a python script which allows to do that and offers to skip a named view if it will replace an existing view with the same name.

ImportNamedViewsFromFile.py (1.4 KB)

c.

2 Likes

Great, works perfect! Thanks for sharing Clement.

I agree with Jarek. When importing named views from a file, we should get a dialog box with two columns : names views from the external file and existing names views to be able to select the named views to import or update.

This looks like just what I need however, 2 issues exist for me. I can’t seem to get it to run from a button sitting between ->
! _-RunPythonScript (

)
It runs fine from the script editor. I have other scripts on buttons and they work fine with this. What am i missing here?

Second issue is, I would like to give it an existing file name and skip the browse for file step. Ideally that file would be on a network server for consistent application by the team.

Many thanks for your input.
Robb

I got the button running. It required that I remove the line -> if name == “main”:
It has been a while since I needed to create a button and I forgot that issue.

I would still like some help with the second issue.

tia,
Robb

Hi @rcmcdougle, just replace the below prompt:

filename = rs.OpenFileName("Open", "Rhino 3D Models (*.3dm)|*.3dm||")
if not filename: return

with this using a valid path between the quotes eg:

filename = r"C:\FolderName\FileName.3dm"

_
c.

Thanks Clement, that works a charm.