例1:将控制点以txt格式输出
title: Export Control Points
description: Demonstrates how to export control points with Python.
import rhinoscriptsyntax as rs
def ExportControlPoints():
"Export curve's control points to a text file"
#pick a curve object
object_id = rs.GetObject("Select curve", rs.filter.curve)
#get the curve's control points
points = rs.CurvePoints(object_id)
if not points: return
#prompt the user to specify a file name
filter = "Text File (*.txt)|*.txt|All files (*.*)|*.*||"
filename = rs.SaveFileName("Save Control Points As", filter)
if not filename: return
file = open( filename, "w" )
for pt in points:
file.write( str(pt.X) )
file.write( "