algorithmic modeling for Rhino
I've created a plugin for GH in C# (C# 2.0, .Net 2.0) based on the steps in the Building a Grasshopper component video tutorial.
Unfortunately, when starting Grasshopper from Rhino it throws the following error:
Has anyone encountered this error before or know what I might have done incorrectly?
The error is thrown 6 times (once for every input and output param registered?), and then Grasshopper works normally. The plugin is shown as available in the toolbox, but can't be used without throwing the above error.
Any ideas on how to fix it?
At the moment my code is the following:
using System;
using System.Drawing;
using Grasshopper.Kernel;
using Rhino.Geometry;
namespace GridShellGrasshopperPlugin
{
public class GridShellComponent : GH_Component
{
public GridShellComponent() : base("Grid Shell", "gridShell", "Applies a grid shell to a surface", "Surface", "Util"){}
protected override void SolveInstance(IGH_DataAccess DA)
{
Surface refSurf = default(Surface);
if(!DA.GetData(0, ref refSurf))
return;
Point3d start = default(Point3d);
if(!DA.GetData(1, ref start))
return;
Point3d end = default(Point3d);
if(!DA.GetData(2, ref end))
return;
DA.SetData(0, null);
DA.SetData(1, 33.0);
DA.SetData(2, null);
}
protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.Register_LineParam("Curve On Surface", "GeoCurve", "Curve on surface between two points");
pManager.Register_DoubleParam("Line length", "length", "Length of line on surface");
pManager.Register_GenericParam("Intersection points", "points", "Points of intersection");
}
protected override void RegisterInputParams(GH_InputParamManager pManager)
{
pManager.Register_SurfaceParam("Reference Surface", "refSurf", "Reference surface on which to form the grid shell", GH_ParamAccess.item);
pManager.Register_PointParam("Start point", "startPoint", "Start point of the first line");
pManager.Register_PointParam("End point", "endPoint", "End point of the line");
}
public override void CreateAttributes()
{
}
public override Guid ComponentGuid {
get {
return new Guid("11111111-1111-1111-1111-111111111111");
}
}
protected override Bitmap Icon {
get { return base.Icon; }
}
}
}
I'm using Rhino 4.0 SR9, dated 9th March 2011, and Grasshopper 0.8.0013, dated 5th July 2011.
Tags:
hi, you should try
public override void CreateAttributes(){ base.CreateAttributes();}
Or better yet, don't override CreateAttributes() at all.
and I sincerely hope that you masked your actual Guid for the purposes of this post and are not using "11111111-1111-1111-1111-111111111111" in your compiled project :)
--
David Rutten
david@mcneel.com
Poprad, Slovakia
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
© 2024 Created by Scott Davidson. Powered by