# Problem python measure distance points

I am trying to measure the distance between two points.
When doing it in Grasshopper it is 11.2
When doing it in Python it is 9.9

Do you see what I am doing wrong?

Just a question - why are you measuring the distance between two points this way? Why not use `pt_a.DistanceTo(pt_b)` ?

I want to calculate the distance with the formule.

What is the pull fonction in gh?

I want to solve my question with the formula, not with gh functions.

I cannot comprehend why there are two different outcomes while the principle is the same.

The only difference I saw is the â€śpullâ€ť fonction in ghâ€¦ This fonction have the 2pts in entry, why does the first point is use 2 times in the down solution?

Dunno, seems to be working here:

PtoP_DistCalc.gh (4.8 KB)

Itâ€™s because you ignore the Z value difference between your points here:

`xydistance=distanceCrdtsVa([linePn[0],linePn[1],0],[testPn[0],testPn[1],0])`

Your Z values are 0 in your formula, but your two points internalized in the point component do not have the same Z level.

Sholud look like this I think:
`xydistance=distanceCrdtsVa([linePn[0],linePn[1],linePn[2]],[testPn[0],testPn[1],testPn[2]])`

But why so complicated???

Z value in your script is 0.

xydistance=distanceCrdtsVa([linePn[0],linePn[1],linePn[2]],[testPn[0],testPn[1],testPn[2]])

grrr, not fast enough

I want the Z values to be the same. What am I doing wrong?
Do I need to shorten the formula?

I know that the zvals are the same. That is what I am going for.
Sorry, maybe I should have explain this in the beginning.

I want to get the XYdistanceVa and the ZdistanceVa seperated from each others. Sometimes the XZdistanceVa as well but that is not important for now. it is about the XYdistanceVa and the ZdistanceVa.

Yes, but you are comparing the real distance between the points (including Z difference) to the projected distance between the points - itâ€™s normal that they should be different.

I am sorry, I still cannot figure out how to solve my question.
Do I need to explain my question better?

I am trying to get many kinds of distances combined from XY to Y to XZ to YZ, etc. That is why my Z value in my script is in this case 0, to get a certain distance along certain axis.

I think you want this:

1 Like

thank you