Need Auto UpdateClippingDrawings in Rhino common API

need auto UpdateClippingDrawings in Rhino common API(C#)(and clipping drawing Api for grasshopper)
now i run this command from grasshopper to Rhino
but not auto update
i think need it when change clipping position Auto
update clipping Drawing in Rhino

note when this command run from grasshopper to rhino

***grasshopper canvas components hanging and freeze ***
is this bug?

  private void ExecuteRhinoCommand()
  {
    RhinoApp.RunScript("_-UpdateClippingDrawings _All _Enter", false);
  }
}


@rajaa

@rajaa - is this for you?

@dale UpdateClippingDrawings is a command inside SectionTools plugin, so it cannot be exposed in RhinoCommon, or is there a way to do that?

Can you please share an example that freezes Rhino when run the script?


Hi @rajaa, this example causes Grasshopper and Rhino to freeze when updating from the bottom(:white_square_button:)
Cliiping plan-in Rhino-Autoupt.gh (87.1 KB)

cliiping plan.3dm (561.8 KB)

#region Usings
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;

using Rhino;
using Rhino.Geometry;
using System.Threading;
using Grasshopper;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;
using Grasshopper.Kernel.Types;
#endregion
public class Script_Instance : GH_ScriptInstance
{
   
    private void RunScript(
	Guid id,
	Plane pl,
	bool flip,
	bool update,
	ref object a,
	ref object b)
    {
           var cp = new Rhino.DocObjects.ObjRef(id);
		   var dup= new Rhino.DocObjects.ObjRef(id);
		  var  org=new Plane(dup.ClippingPlaneSurface().Plane);
    var source = cp.ClippingPlaneSurface().Plane;
    if (update)
    {
      string command = "_UpdateClippingDrawings _All _Enter";
      RhinoApp.InvokeOnUiThread((Action)(() => RhinoApp.RunScript(command, false)));
      
      // Set the timer to execute the command again after 2 seconds
     // timer = new Timer(ExecuteCommand, command, 1000, Timeout.Infinite);
    }
       
	if(flip)
	source. Flip();
    RhinoDoc.ActiveDoc.Objects.Transform(id, Transform.PlaneToPlane(source, pl), true);
 a=org ;
    }
  private Timer timer;
	 private void ExecuteCommand(object command)
  {
    if(command is string cmd)
    {
      RhinoApp.InvokeOnUiThread((Action)(() => RhinoApp.RunScript(cmd, false)));
    }
}}

If I put a debug point inside your script, and click the button, the script keep running as though in a loop, and perhaps this is why GH seems to be frozen. @eirannejad any thoughts if it is a code editor issue?