From: symion <sy...@pr...> - 2008-10-24 14:40:21
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body bgcolor="#ffffff" text="#000000"> <font size="-1"><br> I have been studying Vpython modules Text and Controls and I am a little confused by the use of 'range'.<br> The __init__ parameter list looks like this:<br> <br> def __init__(self, x=0, y=0, width=300, height=320, range=100,title=None, foreground=None, background=None):<br> <br> Now RANGE is of course a keyword, but it is being used here as a variable.<br> <br> Using IDLE 1.2.2 produces the following error.<br> <br> >>> range=100<br> >>> range<br> 100<br> >>> for a in range(1,10):<br> print a<br> <br> Traceback (most recent call last):<br> File "<pyshell#5>", line 1, in <module><br> for a in range(1,10):<br> TypeError: 'int' object is not callable<br> <br> Am I missing something?<br> <br> Also, I have cleaned up my <a href="http://home.primusonline.com.au/knoware/python/index.html">Web page</a><a style="color: rgb(0, 0, 255);" href="http://home.primusonline.com.au/knoware/python/index.html"></a><br> </font><font size="-1"><br> </font> </body> </html> |
From: Doug M. <dou...@gm...> - 2008-10-26 21:52:29
|
Hi all, What is the VPython code to draw a cylinder between two arbitrary 3D points? I'm looking for an equivalent to the Windows GDI: line(x1, y1, x2, y2), but in 3d. Maybe Line(x1, y1, z1, x2, y2, z2) or Line(point1=(x,y,z), point2=(x,y,z)) It seems that I would have to calculate the angle vector between the two points and use that as the axis. Then I would have to calculate the distance between the two points. Is there an easier way? Sample code would help too. Thanks, Doug Mair |
From: Anders P. <an...@gm...> - 2008-10-26 22:20:47
|
Hello! This is simple to to. You need to write like this: point1=(a,b,c) point2=(x,y,z) cylinder(pos=point1, axis=point2-point1) Regards /Anders Petersson On Sun, Oct 26, 2008 at 10:40 PM, Doug Mair <dou...@gm...> wrote: > Hi all, > > What is the VPython code to draw a cylinder between two arbitrary 3D > points? > > I'm looking for an equivalent to the Windows GDI: > line(x1, y1, x2, y2), but in 3d. > > Maybe Line(x1, y1, z1, x2, y2, z2) or Line(point1=(x,y,z), > point2=(x,y,z)) > > It seems that I would have to calculate the angle vector between the two > points and use that as the axis. > > Then I would have to calculate the distance between the two points. > > Is there an easier way? Sample code would help too. > > Thanks, > Doug Mair > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > > |
From: <bre...@un...> - 2008-10-26 22:48:56
|
I'm no expert, but wouldn't it be cylinder(pos=(x1,y1,z1), axis=(x2-x1,y2-y1,z2-z1)) "Doug Mair" <dou...@gm...> 27/10/2008 08:40 AM To <vis...@li...> cc Subject [Visualpython-users] Line between two 3D points. Hi all, What is the VPython code to draw a cylinder between two arbitrary 3D points? I'm looking for an equivalent to the Windows GDI: line(x1, y1, x2, y2), but in 3d. Maybe Line(x1, y1, z1, x2, y2, z2) or Line(point1=(x,y,z), point2=(x,y,z)) It seems that I would have to calculate the angle vector between the two points and use that as the axis. Then I would have to calculate the distance between the two points. Is there an easier way? Sample code would help too. Thanks, Doug Mair ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Visualpython-users mailing list Vis...@li... https://lists.sourceforge.net/lists/listinfo/visualpython-users UNITED GROUP This email message is the property of United Group. The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, you may not disclose, copy or distribute this email, nor take or omit to take any action in reliance on it. United Group accepts no liability for any damage caused by this email or any attachments due to viruses, interference, interception, corruption or unauthorised access. If you have received this email in error, please notify United Group immediately by email to the sender's email address and delete this document. |
From: Jose A. M. H <jam...@fd...> - 2008-10-26 22:35:47
|
Hi Doug, It is easier to use a curve between the points. try it. Hope this help, bests, jamh. ----- Original Message ----- From: Doug Mair To: vis...@li... Sent: Sunday, October 26, 2008 10:40 PM Subject: [Visualpython-users] Line between two 3D points. Hi all, What is the VPython code to draw a cylinder between two arbitrary 3D points? I'm looking for an equivalent to the Windows GDI: line(x1, y1, x2, y2), but in 3d. Maybe Line(x1, y1, z1, x2, y2, z2) or Line(point1=(x,y,z), point2=(x,y,z)) It seems that I would have to calculate the angle vector between the two points and use that as the axis. Then I would have to calculate the distance between the two points. Is there an easier way? Sample code would help too. Thanks, Doug Mair ------------------------------------------------------------------------------ ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ------------------------------------------------------------------------------ _______________________________________________ Visualpython-users mailing list Vis...@li... https://lists.sourceforge.net/lists/listinfo/visualpython-users |