How Python scripts can be added to historical constructs

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:
    redraw = rs.EnableRedraw(False)
    if curve and len(curve)==1:
        if rs.IsCurveInPlane(curve)and rs.IsCurveClosed( curve):
        surfers=rs.ExtrudeCurvePoint( curve, mt )

Hi @cainiaocaib,

Rhino’s History history is command-based. That is, History-enabled commands store the connection between a command’s input geometry and the result so that when the input geometry changes, the result updates accordingly.

Being that History is command-based, it is not possible for a script to participate in History (other than to enable or disable its recording). You’ll need to write a Rhino command in a plug-in, in either C++ or C#.

Hope this helps.

– Dale

1 Like