Z position issues

line = rs.GetObject(‘’, rs.filter.curve)
midpoint = rs.CurveMidPoint(line)

print midpoint.Z

I have an object from where I create a dupedge. The curves Z-postition should be 0, but when running the code is says ‘9.53679008007e-09’. Where does that value come from? If i create a new line and select it it says 0.

9.5e-09 is 0.0000000095. That is pretty much 0, especially given your document tolerance (which most definitely is not in that range).

Also, this is a result of floating point representation in CPUs. There have been numerous posts about this on our forum as well. Let me dig up my favourite.

addendum: good thing I have it bookmarked:

from earlier in that thread

Ahhh! What I was trying to do was to delete curves above Z 0. No wonder the curves at position 0.0000000095 was deleted!
Thank you for your reply. Will check out those other posts.

Since there is a bit of fuzziness when working with floating point numbers it is best to take into account the epsilon. So if you need to delete above 0 you should check for 0+epsilon, where epsilon is a small value. 0.00001 could be a good value to start with.