I’ve written a lot of small scripts in my work with py, but I don’t add history to them. There’s a simple example of adding history to a script plugin in c # on the website, but I don’t understand c # , can you give me a simple example of python, not one where Command calls the Rhino’s own Command, like how to add history to this little script
import rhinoscriptsyntax as rs
def jichuxian():
curve= rs.GetObjects("Select curve", rs.filter.curve,True,True)
if curve is None:
return
redraw = rs.EnableRedraw(False)
if curve and len(curve)==1:
if rs.IsCurveInPlane(curve)and rs.IsCurveClosed( curve):
mt1=rs.CurveAreaCentroid(curve)
mt=mt1[0]
else:
box=rs.BoundingBox(curve)
line1=rs.AddLine(box[0],box[6])
mt=rs.CurveMidPoint(line1)
rs.DeleteObject(line1)
surfers=rs.ExtrudeCurvePoint( curve, mt )
jichuxian()