请教大神:我想通过直接修改直线起点和终点坐标的方式修改直线,可是想象中的代码无法工作,请问是什么原因造成的?
另外我不希望修改前后的GUID发生变化。
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
Rhino.Input.Custom.GetObject get_a = new Rhino.Input.Custom.GetObject();
get_a.SetCommandPrompt(“选择直线”);
get_a.GeometryFilter = Rhino.DocObjects.ObjectType.Curve;
get_a.DeselectAllBeforePostSelect = false;
Rhino.Input.GetResult result_a;
result_a = get_a.Get();
if (get_a.CommandResult() != Rhino.Commands.Result.Success)
return get_a.CommandResult();
Rhino.DocObjects.ObjRef objref_a = get_a.Object(0);
Rhino.DocObjects.RhinoObject obj_a = objref_a.Object();
if (obj_a == null)
return Rhino.Commands.Result.Failure;
Rhino.Geometry.Curve a = objref_a.Curve();
if (a == null)
return Rhino.Commands.Result.Failure;
obj_a.Select(false);
Rhino.Geometry.Point3d Pa_s = a.PointAtStart;
Rhino.Geometry.Point3d Pa_e = a.PointAtEnd;
//将z坐标设置成0,不希望修改前后的GUID发生变化
a.SetStartPoint(new Rhino.Geometry.Point3d(Pa_s.X, Pa_s.Y, 0));//不起作用
a.SetEndPoint(new Rhino.Geometry.Point3d(Pa_e.X, Pa_e.Y, 0));//不起作用
// TODO: complete command.
return Result.Success;
}