There is a question about RhinoApp.RunScript ()


(NARUTO) #1

I used RhinoApp.RunScript () to call the T-splines of the tsConvert command that has been unsuccessful
my code:

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
        ObjRef rhinoMesh_objRef;
        using (GetObject getObjects = new GetObject())
        {

            getObjects.SetCommandPrompt("选择要转化成TS的网格");
            getObjects.SubObjectSelect = true;
            getObjects.GroupSelect = false;
            getObjects.GeometryFilter = ObjectType.Mesh;
            getObjects.AcceptNothing(true);
            if (getObjects.GetMultiple(1, 0) != GetResult.Object)
            {
                RhinoApp.WriteLine("选择不成功");
                return getObjects.CommandResult();
            }
            rhinoMesh_objRef = getObjects.Object(0);
            getObjects.Dispose();
        }


        bool bo = RhinoApp.RunScript("_tsConvert " + "_SelID " + rhinoMesh_objRef.ObjectId.ToString() + " _Enter", true);
        RhinoApp.WriteLine(bo.ToString());
        doc.Views.Redraw();
        return Result.Success;
    }

I can use Grasshopper to call the T-Splines tsConvert command

I do not know why VS has been calling unsuccessful,Anyone have any better suggestions?
Thanks
——NARUTO


(Dale Fugier) #2

Hi @603419608,

Please review the following and let me know if you have any questions.

http://developer.rhino3d.com/guides/rhinocommon/run-rhino-command-from-plugin/

– Dale


(NARUTO) #3

Thanks,This link is very helpful