Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5745

Use layer name when exporting

$
0
0

@wiivanil wrote:

I'm new to scripting.
I wrote a script that export a jpg of objects on every single layer.
Now, when I launch the script I write the file name every time the window come up.

I'd like to automate this action so the exported jpg has the name of the layer.

Thanks
Ivan

# -*- coding: utf-8 -*-
import rhinoscriptsyntax as rs

#export a jpg of objects on every single layer
def ExportLayerObject():
    layers = rs.LayerNames()
    for layer in layers:
        if not rs.IsLayerEmpty(layer):
            rs.ObjectsByLayer(layer, True)
            rs.ZoomSelected()
            rs.Command(" _Invert _Hide")
            rs.Command(" _ViewCaptureToFile")
            rs.Command(" _Show")

ExportLayerObject()

ExportLayerObjects.py (435 Bytes)

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5745

Trending Articles