algorithmic modeling for Rhino
Hello
I am attempting to integrate some of the OpenStudio libraries into a workflow in Grasshopper to access analysis interoperability with Radiance and Energyplus. It turns out some of the class names are identical to those in Grasshopper so I am getting an ambiguous reference error when loading the OpenStudio.dll into my component and using the Point type hint.
private void RunScript(Point3d pt, ref object os3DVector)
{
OpenStudio.Point3dVector points = new OpenStudio.Point3dVector();
points.Add(pt);
}
Error: 'Point3d' is an ambiguous reference between 'Rhino.Geometry.Point3d' and 'OpenStudio.Point3d' (line 88)
Is there any particular reason the Grasshopper reference to Point3D is implicit rather than explicit Is this something that can be changed on my end as it appears to be locked down.
Would like it to read as follows:
private void RunScript(Rhino.Geometry.Point3d pt, ref object os3DVector)
{
OpenStudio.Point3dVector points = new OpenStudio.Point3dVector();
points.Add(pt);
}
Awesome, thanks!
Tags:
Point3D is a RhinoCommon type, not a Grasshopper type. Unfortunately I do not see a solution as you cannot change the method signature. I'm afraid you're out of luck.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Well, not entirely out of luck, there are two ways forward:
--
David Rutten
david@mcneel.com
Poprad, Slovakia
I will give #1 a try. Hopefully this is the solution I am looking for as not being able to reference OpenStudio libraries would be very disappointing.
Thanks for the prompt response!
What is preventing the non-editable boiler plate code from referencing Rhino.Geometry.Point3d instead of Point3D?
The reason I ask is that this is essential a syntax issue, not a technical one, unless I am not understanding.
Thanks again.
It is indeed a syntax issue, the algorithm which creates the non-editable part of the source simply uses "Point3d" as a string instead of "Rhino.Geometry.Point3d". It knows that Rhino.Geometry is an imported namespace and it didn't occur to me that there could be naming conflicts for the types in the RunScript signature.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Why don't just simply input the point as object, or GeometryBase and then Cast it to Rhino.Geometry.Point3d:
private void RunScript(object pt, ref object os3DVector)
{
if(pt.GetType().Name != "Point3d"){
owner.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "The input pt has to be of type Point3d");
return;
}
Rhino.Geometry.Point3d pnt = (Rhino.Geometry.Point3d) pnt;
OpenStudio.Point3dVector points = new OpenStudio.Point3dVector();
points.Add(pnt);
}
Hope this works.
Cheers FF
aww...you can't do point.Add(pnt)....
you might do:
point.Add(new OpenStudio.Point3d(who knows?));
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