Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 4146

Point3d object can't be compared to None

$
0
0

I don’t expect this to gather a lot of support, but many of the RhinoScriptSyntax functions use/return Point3d objects and they can’t be compared to None.

import Rhino.Geometry as rg
ImportantPoint = rg.Point3d(1,2,3)
if ImportantPoint == None:
    print('Not Defined Yet')

Complains that

TypeError: No method matches given arguments for Point3d.op_Equality: (<class ‘NoneType’>)

Instead of setting the default value of my objects to None, I thought I would create an “empty” Point3d object and then use the IsValid to see if it is defined yet. But that doesn’t work because even an empty Point3d is still valid because it defaults to the origin.

Q = rg.Point3d()
print(Q.IsValid)  <- True

Back to the old try:except block :slight_smile:

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 4146

Trending Articles