user3380098
user3380098

Reputation: 31

While True loop python

I'm a beginner and I would like to make a while loop in python. I have two intersecting coplanar curves and I would like to move the first curve a certain vector on the common plane until they no longer intersect. I tried something like:

vec = [0,0.1,0]
int = True
while True:
    move=rs.MoveObject(curve1,vec)
    int=rs.CurveCurveIntersection(curve1, curve2)
    if int = False:
        break

Anyone knows what am I doing wrong? Thanks in advance!

Upvotes: 0

Views: 4532

Answers (2)

Hugh Bothwell
Hugh Bothwell

Reputation: 56694

Could be simplified to

vec = [0, .1, 0]

while rs.CurveCurveIntersection(curve1, curve2):
    move = rs.MoveObject(curve1, vec)

... and I don't quite understand what move is.

If rs.MoveObject() modifies the object, you just need rs.MoveObject(curve1, vec);

if it returns a modified object, you need curve1 = rs.MoveObject(curve1, vec) instead (and your current code would result in an endless loop).

Upvotes: 1

sabbahillel
sabbahillel

Reputation: 4425

First of all, you are using the int key word (integer type) as a variable and explicitly setting the 'int' variable to False (which is a syntax error in an if). This can mess up your system. You are also not showing what the error message is.

intersect = rs.CurveCurveIntersection(curve1, curve2)
if not intersect:
  break

Upvotes: 3

Related Questions