Python error

is surely a trivial thing
I can not print the points p5, p6, p7, p8
Printing only 2 points
The problem is the calculation:

ALTMEZ-H2B / 2

ALTMEZ + H2B / 2

where ALTMEZ = 5
H2B = 1

I expect:

ALTMEZ-H2B / 2 = 5-1 / 2 = 4.5

ALTMEZ + H2B / 2 = 5 + 1/2 = 5.5

is instead:

H2B / 2 = 0

ALTMEZ-H2B / 2 = 5

ALTMEZ + H2B / 2 = 5

where is the error ??

Thanks for your cooperationpunti spariscono

I explain the problem better:
in the first figure the error is at line 17 (input = 2:02)
in the second picture I delete the row 17 -> works —> Press 4 points
in the third figure remit line 17 (input = 1 and 1) -> works —> Press Polygon

 

err1 err2 err3

good morning alex!

i think the problem is in the formula.

just change:

p5=Point.ByCoordinates(luce,-0.4,ALTMEZ-HB/2)

into

p5=Point.ByCoordinates(luce,-0.4,float(ALTMEZ-HB/2))

if ALTMEZ is 3 and HB = 1

if python assumes int the result for ALTMEZ -HB/2 = 3-0 = 3 ALTMEZ+HB/2=3+0 = 3

 

thanks Peter
I changed the points and work … but … if I use the phrase:
points = {p1, p2, p3, p4, p1} —> is error (see picture)
if you use the list ----> works (see picture)
what is wrong ??
Thanks again for your cooperation

 

 

utilizzo graffa

 

 

 

lista

alex, i didn’t test but i think “polygon” is always closed. so the second p1 is a duplicate point the result = a segement of length 0 (from p1 to p1)

OK Peter

Now it works … I put the float on all IN []
thanks again