algorithmic modeling for Rhino
Hi,
When creating custom component in Visual Studio, I would like to add a Guid list as input parameter, but I cannot find in pManager.AddGuidParameter function.
How can I add Guid as input parameter?
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
There is no AddGuidParameter function:
pManager.AddGuidParameter("GUIDs", "GUIDs", "Referenced geometry as guid", GH_ParamAccess.list);
}
Thanks,
Petras
Tags:
You'll have to use the more generic AddParameter method and construct a new Param_Guid ahead of time.
Why not to use text use parameter and convert it to guid internally?
It's always better to use the most specific type.
Hi,
I do not get error when referencing guids and planes to custom component. But when I passed guids to input list the returned Guids to output, it was empty.
How can I properly pass guids and planes lists to main function and return the same list of guids?
C#:
//INPUT
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
IGH_Param GUIDs = new Grasshopper.Kernel.Parameters.Param_Guid();
pManager.AddParameter(GUIDs, "0GUIDs", "GUIDs", "Referenced geometry as guid (can be mesh, brep, curves in one list)", GH_ParamAccess.list);
pManager.AddPlaneParameter("PLANEs", "PLANEs", "Target planes", GH_ParamAccess.list);
}
//Output
protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
IGH_Param GUIDout = new Grasshopper.Kernel.Parameters.Param_Guid();
pManager.AddParameter(GUIDout, "GUIDout", "GUIDout", "Referenced geometry as guid ", GH_ParamAccess.list);
}
protected override void SolveInstance(IGH_DataAccess DA)
{
// Input
List<Guid> GUIDs = new List<Guid>();
//DA.SetDataList(0, GUIDs);
List<Plane> PLANEs = new List<Plane>();
// DA.SetDataList(0, PLANEs);
List<Guid> pr = Proxies(GUIDs, PLANEs);
// Finally the output parameter.
DA.SetDataList(0, pr);
}
//MAIN FUNCTION
private List<Guid> Proxies(List<Guid> GUIDs, List<Plane> PLANEs)
{
int x = PLANEs.Count;
int y = GUIDs.Count;
int a = Convert.ToInt32(x / y); // floor intergers
int b = Convert.ToInt32(x % y); // remainders
// in grasshopper I get error that it was an attempt to divide by zero, meaning lists are empty.
return GUIDs;
}
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