Grasshopper

algorithmic modeling for Rhino

Hello everybody,

 

I am trying to debug a Visual Studio 2010 project to Rhino 5 just to give it a try but nothing happens and I do not find the answer.

 

I have made a class in Visual Studio 2010, referrenced RhinoCommon.dll (with copy local False :-)) and then set in the debug options, Start Action, Start external program and referenced the Rhino.exe file in Rhinoceros 5.0 WIP (64-bit) folder.

 

I tried the following code from McNeel´s developers wiki (add a cylinder) and I get no errors neither building the solution nor debugging in VS2010 but, after Rhino starts, nothing happens in Rhino and there is no geometry:


using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rhino;
using Rhino.Geometry;

namespace MyFirstRhinoDrawing
{
    class Class1
    {
        Rhino.Commands.Result cil = AddCylinder(RhinoDoc.ActiveDoc);

    public static Rhino.Commands.Result AddCylinder(Rhino.RhinoDoc doc)
    {
      Rhino.Geometry.Point3d center_point = new Rhino.Geometry.Point3d(0, 0, 0);
      Rhino.Geometry.Point3d height_point = new Rhino.Geometry.Point3d(0, 0, 10);
      Rhino.Geometry.Vector3d zaxis = height_point - center_point;
      Rhino.Geometry.Plane plane = new Rhino.Geometry.Plane(center_point, zaxis);
      double radius = 5;
      Rhino.Geometry.Circle circle = new Rhino.Geometry.Circle(plane, radius);
      Rhino.Geometry.Cylinder cylinder = new Rhino.Geometry.Cylinder(circle, zaxis.Length);
      Rhino.Geometry.Brep brep = cylinder.ToBrep(true, true);
      if (brep != null)
      {
        doc.Objects.AddBrep(brep);
        doc.Views.Redraw();
      }
      return Rhino.Commands.Result.Success;
    }


}
}

 




 

Any help would be much appreciated. Thanks in advance.

 

Cheers!

 

 

P.S. May not be a question for the GH forum but I did not know where to post it! :-)

Views: 3036

Replies to This Discussion

Well I don't think I've ever been able to hit breakpoints on GHAs when in Rhino 5.  Everything works as expected in Rhino 4. All I do is change the paths to Rhino 5 in the csproj.user file and I get nothing.  My only guess to why this would be an issue is that the GHA targets 3.5 instead of 4, but shouldn't VS still be able to debug 3.5 assemblies.  Is there something else I'm missing here?

Are you using VS2010?

yep...

Hmm... that is exactly opposite of what I would expect.  When debugging a plug-in (or gh component) from Visual Studio, you always have to set rhino.exe as the start-up application.  The main Rhino executable is not a .NET assembly which means Visual Studio has no idea of which runtime debugger to attach (.NET 2 or 4) and this has nothing to do with what runtime you are compiling your code against.

 

In Visual Studio 2010, the default debugger is .NET 4 which means you won't be hitting breakpoints in Rhino 4 (which uses .NET 2 version of mscorlib.)

 

There is a way to structure a config file so Visual Studio 2010 loads the .NET 2 runtime in the debugger. Did you happen to ever create a file named something like rhino4.exe.config and place it in the same directory as the rhino executable?

 

I'm really interested in figuring out why your system works the way it is working.

Thanks,

-Steve

Well, there is no rhino4.exe.config file in the folder with the Rhino executable, nor within any folder for the project.  There was an app.config file in the project that looked like it had some syntax that you were referencing.  All it had was a startup/supportedRuntime=2.0.50727.  I went through and changed the csproj.user file to use Rhino 5 and excluded that app.config file from the project.  Unfortunately it still didn't debug in Rhino 5.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service