Using RPscript to select a newly created TRIM object at a known location

“”"
20140905_5_18:30-18:55 Object: Testing ‘ClosestPt’. Want to have the procedure
fully automatic ; ie. WITHOUT USER INPUT

20140906_6_21:40 23:20 Attempted to use “Trim” and ClosestPt to
cut off the top of the box. No link
between “Box” and “Point_Top”. “Point_Top” was
added as the final parameter for the trim operation.
"""

import rhinoscriptsyntax as rs
import math
import Rhino

Line =rs.AddLine((-5,2,0),(5,2,0))
Box =rs.AddBox( ((-3,0,0),(3,0,0),(3,3,0),(-3,3,0),
(-3,0,3),(3,0,3),(3,3,3),(-3,3,3)) )
Point_Top =rs.AddPoint(0,5,0)

print " "
print " "
print " "
print "CuttingLine ", Line
print "Box ", Box
print “Point_Top”, Point_Top
print " "

rs.Command("_ClosestPt"+" selid “+str(Box)+” Enter selid “+str(Point_Top)+” Enter ")
print “Point closest to Box is :”, rs.PointClosestObject(Point_Top,Box)

print " “
print " “
print " “
LeftOver = rs.Command(”_Trim” +” selid “+str(Line)+” selid “+str(Box)+” Enter “+” selid “+str(Point_Top)+” Enter ")
print " "
print " "
print " "

print "NumberOfObjects ", len(rs.AllObjects())
print " "
print "CuttingLine ", Line
print "Box ", Box
print "Point_Top ", Point_Top
print " "