algorithmic modeling for Rhino
I have a little problem with this code :
Private Sub RunScript(ByVal y As Surface, ByRef A As Object)
Dim los As Random
Dim nPt As Point3d = y.PointAt(los.NextDouble, los.NextDouble)
A = nPt
End Sub
prints out : Object reference not set to an instance of an object. (line: 87)
Line 87 is Dim nPt As Point3d = y.PointAt(los.NextDouble, los.NextDouble)
What is going on here ? I suppose than problem is in surface y, but how to get it work ?
Tags:
Dim los As New Random()
los was not initialized and thus you could not call los.NextDouble().
You should also check y for null, just to be sure:
If (y Is Nothing) Then Return
Lastly, I highly recommend you construct your Random instance with a constant seed, so that you get the same random values all the time.
--
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
© 2024 Created by Scott Davidson. Powered by