Skip to content

Instantly share code, notes, and snippets.

@yasushisakai
Last active December 17, 2015 13:29
Show Gist options
  • Save yasushisakai/5617974 to your computer and use it in GitHub Desktop.
Save yasushisakai/5617974 to your computer and use it in GitHub Desktop.
This script exports the current rhino file to 3ds format, separating it by layer. It was intended for exporting it to ArchiCAD which can be inserted as GDL
# -*- coding: utf-8 -*-
import rhinoscriptsyntax as rs
documentName = '.'.join(rs.DocumentName().split('.')[:-1])
path = '\\'.join(rs.DocumentPath().split('\\')[:-1])
print rs.LayerNames()
for layerName in rs.LayerNames():
rs.UnselectAllObjects()
obj = rs.ObjectsByLayer(layerName)
if len(obj)==0:continue
rs.SelectObjects(obj)
#exportFilePath = '"'+path+'\\'+documentName+'_'+layerName+'.gsm'+'"'
exportFilePath = '"'+path+'\\'+documentName+'_'+layerName+'.3ds'+'"'
rs.Command('!_-Export '+exportFilePath+' _Enter')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment