Export with Layouts

Hi all,

I’d like to export a few objects along with all layouts.

Currently no layouts accompany the objects during export. What’s the best way?



I’ve tried to highlight all the Layout-level stuff, then highlight the objects to export, but that didn’t work. I even went back & forth to confirm layout and model objects stayed highlighted (and they do).

Hi Declan - I guess you cannot, as things are now… I do not see a good way. A bad way might be to Save, then select the objects, Invert Delete SaveAs Undo … then re-open the original file.


Hm, that only deletes objects that are not locked/hidden, though. They’d be re-saved in the new file… I’ll have to keep thinking on it.


This is true… it’s no doubt possible to script that churns through everything and shows and unlocks and then resets everything back to how it was… I’ll take a look.
@declan, see how this python works…

ExportWithLayouts.py (1.3 KB)

Kinda hacky as usual but it seems to sort of do the right things.
Use RunPythonScript
! _-RunPythonScript "Full path to py file inside double quotes"


Thanks Pascal!! It seems to be running a “SaveAs”, though, so all locked objects are being saved.

Here’s what it should be doing…

Unlock&show everything and delete all but the selected objects
Save as
Reopen originally saved file…

It was doing that here last night… I’ll poke some more.


Hey @Pascal,

Just following up on this. It’s exactly what I’m looking for except it exports everything (including unused layers, locked objects) not just the “Selected” objects.


Is there any reason this had to be done in .py? Can I mimic the functionality with .rs?

Hi Declan - sorry, I forgot about this one - I’ll take another look. It looks like RhinoScript could do what I’m hacking in here, yes.

@declan, OK, I finished the job, I think, I was only looking at layer locking and not objects. It’s still a hack. Let me know if I left anything out.
use ! _-RunPythonScript "Full path to py file inside double quotes"

ExportWithLayouts.py (1.4 KB)

to run this off of a button or alias.


That is excellent! THANK YOU! And just out of curiosity - did you do this in .py for efficiency? Personal preference?

I am still trying to learn scripting, so I can slowly stop being such a mooch. But in the meantime, thanks for your generosity!


Hi Declan - python just has way more possibilities than RhinoScript, on the whole, as it can access the RhinoCommon stuff, which rs cannot. So I mostly type py, these days, but this one probably would have been just as easy in Rhinoscript


1 Like