#coding=utf-8
import Rhino
import scriptcontext
import System.Guid
import rhinoscriptsyntax as rs
def DetermineObjectLayer():
rc, obref = Rhino.Input.RhinoGet.GetOneObject("请选择", True, Rhino.DocObjects.ObjectType.AnyObject)
if rc!=Rhino.Commands.Result.Success: return rc
rhobj = obref.Object()
if rhobj is None: return Rhino.Commands.Result.Failure
index = rhobj.Attributes.LayerIndex
name = scriptcontext.doc.Layers[index].Name
print "选中物件的图层名称是'", name, "'"
rs.Command ( "-_SelNone" )
rs.Command ( '-_SelLayer "' + name + '" _Enter' )
return Rhino.Commands.Result.Success
if __name__ == "__main__":
DetermineObjectLayer()
bxc3594883 发表于 2015-10-16 11:04
怎么用啊 代码看不懂啊!发个教程啊
Snipaste_2018-07-12_20-39-53.jpg (17.47 KB, 下载次数: 74)
欢迎光临 摩登犀牛 (http://rhino3d.us/) | Powered by Discuz! X3.2 |