Python reading point.Z values

Somehow python reads different z-values than there are. It seems witch craft to me.
Do you might know what I am doing wrong?

Thank you for your response. :slight_smile:

201902012 problem z values (13.4 KB)

its a rounding thing I would say , they are all really close to their values shown in the native coponent solution.
For example:scin

1 Like

Hi @ForestOwl,

Like @Baris mentioned above, it may only be a rounding thing.

For instance, the z-value of the first point in your list is output by GHPython as -2.22044604925e-16. Like mentioned in @Baris’ post above, this is scientific e notation for a float with many zeros behind the decimal indicator, a sort of abbreviation, if you like.

The pDecon on the other hand seems to round the z-values to floats with only 1 decimal place. My guess would be that this is only for preview purposes in a panel, and that the entire float is passed in the background to the next component? Or the values are indeed rounded to save computing power?

As this might be, if you want to visually compare your python values to the values of the pDecon, you can simply format your GHPython output to print less decimal places:

for pt in pnts:
    print "%.1f" %(pt.Z) # prints one decimal place for each z-value

This prints the z-value of your first point as -0.0.

1 Like

Great! thank you both @Baris @p1r4t3b0y :smiley:

You can also use the built in round() function to check this programmatically eg
round(value1, 3) == round(value2, 3)
To check equality to 3 decimal places or abs(value1- value2) < 0.001

1 Like