I move the points in C# code and redraw views, but nothing changes

Hi,
@DavidRutten, @dale

I have created a grasshopper plug-in that takes in a point, which is selected by the user from Rhino view. I then translate this point and redraw the views in the active doc. Nothing changes in Rhino view. Please help me fix this. Thanks.

Here is my code:

        public Point3d Point { get; set; }
        public double Move_x { get; set; }        

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            if (CollectInputData_point(DA) == false) { return; }

            CollectInputData_move_x(DA);

            var xform1 = Transform.Translation(this.Point.X - this.Move_x, this.Point.Y, this.Point.Z);
            this.Point.Transform(xform1);

            Rhino.RhinoDoc.ActiveDoc.Views.Redraw();
        }

        private void CollectInputData_move_x(IGH_DataAccess DA)
        {
            double tempDouble = 0;

            if (!DA.GetData(1, ref tempDouble ))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Failed to receive input for move x");
                return;
            }

            this.Move_x = tempDouble;
        }
        private bool CollectInputData_point(IGH_DataAccess DA)
        {
            Point3d temp_point = new Point3d();

            if (!DA.GetData(0, ref temp_point))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Failed to receive input for point");
                return false;
            }

            this.Point = temp_point;

            return true;
        }

I think what you re after is to override / implement
DrawViewportMeshes
?

Point3d is just a simple structure that holds x y z.
It is not interacting with the Rhinodoc, Display, or Viewports.

I had a similar problem with a non-GH RhinoCommon script when trying to edit an xform. It just wouldn’t take the changes. I figured out I could get all the data from the original object, create a new object (applying the transform and copying any additional required data from the original, then deleting the original.
I got the code to work but thereafter while working on other code I realized that the CommitChanges method needed to be ran on the object for the changes to take hold. That might be the case here and would be a better solution to what I described in the first paragraph.

Note that I’m not quite sure of the differences/similarities between a Grasshopper plugin and one’s independent of GH.