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?
#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?