Grasshopper

algorithmic modeling for Rhino

Hello David, Giulio and all the rest.


This is a follow_up of Issue

http://www.grasshopper3d.com/forum/topics/grasshopper-misbehaves-wh...

It seems that when Rhino and GH are automated by using them as an ActiveX, the C# script object fails on the simplest tasks. That is, when initiating Rhino and GH externally (as by the following C# code):

Rhino5Application rhino_app = new Rhino5Application();

dynamic grasshopper = newRhino.rhino_app.GetPlugInObject("b45a29b1-4343-4035-989e-044e8580d9cf", "00000000-0000-0000-0000-000000000000") as dynamic;

The following very simple C# script component fails because it cant cast its input:

The c# code at the component is only:

Line 89 is simply casting of the input. Clearly, this makes the usage of C# component, under automation, impossible which is a major loss.

As said, when initiating Rhino and GH manually , all works well as in the following:

Any ideas why it misbehaves under automation (as an Active X ) ?

I added the gh file of this example.

Views: 690

Attachments:

Replies to This Discussion

Weird. I have no idea what could be causing this or whether the error is really what it appears to be. Does it work when you set the typehint for x to Point3d?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

It still fails but on a different line number.

At first, I was surprised by the new line number of the error - but after looking at the overrides preview - it is caused by the overridden function "DrawViewportWires" - maybe the casting to "IGH_PreviewArgs" ?

Or this error is not what it claims it is. I can already see this is going to be hell to debug. One last quick test, can you translate the small script with the casting error to VB.NET and see if you get the same error?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hello David, thanx for your help and sorry for the "hell to debug" issue :)

The same error occurs in VB.Net component.


Under Automation I get:

This time it reports on the line number at the end of the "DrawViewportWires" function.

and when ran "manually", all works well:

As before, the gh file is attached.

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service