Grasshopper

algorithmic modeling for Rhino

Hey everyone,

I have a Vb component with a mesh input. sometimes the input is empty/null. I just want to test for this. I thought it was, for example:

if inputMesh.isValid then

do stuff

endIf

but I get:

1. Object reference not set to an instance of an object. (line: 120)

What's the way to test for a null input (of mesh type)?

Thanks,

Brian

Views: 467

Replies to This Discussion

Try:

If inputMesh Is Nothing Then

do stuff

End If

Actually in this case it would be if inputMesh is Not Nothing, but even then I get:

1. Error (BC30020): 'Is' operator does not accept operands of type 'Integer'. Operands must be reference or nullable types. (line 120)

Try IsNot all one word...

*smacks forehead*

Thanks David.

-Brian

My forehead has permanent palm prints in it.  Might as well be a tattoo :)

I was explicitly trying to look for Null items a long ago by using the IsDBNull(item) Boolean, but with no luck. Again in this case it doesn't work cause I am missing something.

Private Sub RunScript(ByVal x As Mesh)
If IsDBNull(x) = False Then
print("what")
End If
End Sub

Any insights on that?

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service