Export acis (.sat) only on layers


I have a script for exporting to acis files. Only wish is if this script only exporting the layers that are on. I have also layers off with contains cad lines, or differents options of objects. This should not be exported.
Now I do it manuelly because of this. But it takes more time and I have to do this over and over again…
Does anyone knows how to do this?

Thanks in advance.

Don’t know how your script is written, but normally _Export can only export selectable objects, which can only be on layers that are visible. So your script should be written with _Export and not with _SaveAs (which will save the whole file). You will need to select all visible/selectable objects before running the export, this can be accomplished in various ways in the script.

HTH, --Mitch

Thanks, I’m not very familiar with scripting, I didn’t writen this script. But I can check if this is the case.

The script I was talking about was the one on the Mcneel site https://wiki.mcneel.com/developer/scriptsamples/exportlayerobjects

I used this script in the past, but then it turned all the layers on and export also the hiden layers. For some reason I get an error now.

What I like to have is a script so I can easily export all the selected objects in layers (each layer a sat file). It would be even more beautiful if I can give the location.

Thank you.

Old python script i used for this problem.

#Export multiple sat for every layer (It works only with surfaces)

import rhinoscriptsyntax as rs

if __name__ == "__main__":
    # collect all object
    objs = rs.GetObjects()
    # export folder
    folder_path = rs.BrowseForFolder(message = "Select folder for the export:", title = "Multiple SAT exporting")
    # collect all the layer id
    lay_ids = rs.LayerIds()
    for i, lay_id in enumerate(lay_ids):
        # extract layer name
        lay_name = rs.LayerName(lay_id)
        # print( rs.LayerName(lay_id) )
        for obj in objs:
            if(rs.ObjectLayer(obj) == lay_name):
        # export
        file_name = "NAME_{}".format(i + 1)
        exp = "-_Export {}\{}.sat ACIS Export Type Default _Enter".format(folder_path, file_name)