Human RenderToScreen Components Causing Rhino Crash

(Su Lwpac) #1

Hi All,
I am working on displaying Data on Rhino Screen while working on Specific script and the RenderToScreen Components to Preview information. But It is Causing Rhino to Crash frequently.

(Andrew Heumann) #2

I haven’t come across any crashing behavior previously with these components… can you share a definition where this behavior is happening? which version of Rhino are you using?

(Su Lwpac) #3

Hi andrew,
Please find the Script here.Check (149.5 KB)
I am using Rhino6 SR7

(Su Lwpac) #4

As the Script is running and you rotate the View in viewport, it Will crash while refreshing the Preview.

(Su Lwpac) #5

Hi Andrew, Any update?

(Andrew Heumann) #6

this looks like a rhino bug. Internally, the crash occurs when I’m creating a TextEntity object with these lines:

 TextEntity entity = new TextEntity
                      PlainText = text,
                      Plane = plane,
                      TextHeight = size

The internal error is this: + $exception {"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."} System.AccessViolationException StackTrace " at UnsafeNativeMethods.ON_V6_Annotation_SetTextString(IntPtr annotation, String str, IntPtr constDimstyle) at Rhino.Geometry.AnnotationBase.set_PlainText(String value) at Human.TextToScreen.DrawViewportWires(IGH_PreviewArgs args) at Grasshopper.Kernel.GH_Document.PreviewPostDrawObjects(Object sender, DrawEventArgs e) at System.EventHandler1.Invoke(Object sender, TEventArgs e) at Rhino.Display.DisplayPipeline.OnPostDrawObjects(IntPtr pPipeline, IntPtr pConduit)" string

(Dale Fugier) #8

Hi @andheum,

This seems to work from a test command:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
  var text = "Andrew Heumann";
  var plane = Plane.WorldXY;
  var size = 10;

  TextEntity entity = new TextEntity
    PlainText = text,
    Plane = plane,
    TextHeight = size

  // TODO...

Is there a way I can repeat what you are seeing?

– Dale

(Andrew Heumann) #10

@dale - I can reproduce it consistently from within grasshopper by calling this code repeatedly in quick succession - see the attached grasshopper definition above - just orbit the viewport back and forth and you should see a crash. I also reported this here: New TextEntity crash

(Andrew Heumann) #11

Lemme see if I can code up a minimal c# script in GH that reproduces the problem.

(Andrew Heumann) #12

well, wouldn’t you know it… the problem seems to have gone away as of Version 6 SR11 - even with the .gh file above I can’t get the crash to occur.

(Steve Baer) #13

This does sound related to something I fixed in recent months.