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! :-)
Tags:
Are you using VS2010?
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
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by