×

工业设计互动平台

手机短信,快捷登录

微信登录,快人一步

QQ登录

只需一步,快速开始

AddOption 的englishName参数不能含空格

发布于 2021-3-12 1 点赞 0 评论 756 浏览

Rhino.Input.Custom.GetBaseClass.AddOption 的englishName参数不能含空格,必须是连续的字符串,因为这个错误检查了好久才发现
englishName:
        //     Must only consist of letters and numbers (no characters list periods, spaces,
        //     or dashes)


附案例说明AddOption方法的使用
public static  Rhino.Commands.Result OptinOperstion(Rhino.RhinoDoc doc)
        {
            //按照设置的距离向上或向下移动选择的曲线
            bool direction = true;//方向 true 为上 false 为下
            int distance = 10;//距离
            Rhino.Input.Custom.GetObject go = new Rhino.Input.Custom.GetObject();
            go.SetCommandPrompt("Get with option");
            go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve;
            Rhino.Input.Custom.OptionToggle toggleOption = new Rhino.Input.Custom.OptionToggle(direction, "Up", "Down");
            Rhino.Input.Custom.OptionInteger integeroption = new Rhino.Input.Custom.OptionInteger(distance, 0, 20);
            go.AddOptionToggle("DirectionToMove", ref toggleOption);//就这里出错的,把“DirectionToMove”分开写成“Direction To Move”了
            go.AddOptionInteger("DistanceToMove", ref integeroption);

            while (true)
            {
                Rhino.Input.GetResult getResult = go.Get();
                if (go.CommandResult() != Rhino.Commands.Result.Success)
                {
                    return go.CommandResult();
                }
                if(getResult == Rhino.Input.GetResult.Object)
                {
                    direction = toggleOption.CurrentValue;
                    distance = integeroption.CurrentValue;
                    //处理的内容略
                    doc.Views.Redraw();
                }else if(getResult == Rhino.Input.GetResult.Option)
                {
                    continue;
                }
                break;
            }
            return Rhino.Commands.Result.Success;
        }


AddOption的EnglishName不能含空格.jpg
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

精彩回复

文明上网理性发言、请文明用语

成为第一个回答人