algorithmic modeling for Rhino
private void RunScript(DataTree<Polyline> c, DataTree<int> storey, DataTree<Point3d> vpt, int high, ref object A)
{
DataTree<Polyline> temp = new DataTree<Polyline>();
GH_Path pth = new GH_Path(0, 0);
temp.Branch(pth)[0] = c.Branch(0)[0];
A = temp;
}
why the output is:error:object reference not set to an instance of an object(of the red line)?
Thank you very much!!!
Tags:
"Object reference not set to an instance of an object" is the most common exception in .NET as far as I know. It means you're trying to call a method on a class which doesn't exist. Or rather, a class which hasn't been instantiated.
In this case your temp DataTree has been constructed but it is empty. I.e. it has no paths and no branches. So when you ask for the branch at pth, you'll get a null reference in return. Then you try and call [0] on that null reference, which is what throws the exception.
I cannot tell you how to fix it until you tell me what it is you're trying to do.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thank you David for reply,I have understood your explaination.
than,later i try this,and works:
private void RunScript(DataTree<Polyline> c, DataTree<int> storey, DataTree<Point3d> vpt, int high, ref object A)
{
DataTree<Polyline> temp = new DataTree<Polyline>(c);
GH_Path pth = new GH_Path(0, 0);
temp.Add(c.Branch(0)[0], pth);
A = temp;
}
Hi im trying to understand this definition of galapagos and geco... but it gives me this error...
can you please help me?
tnx
Aleks
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