Python Lesson II

Python scripting resources
User avatar
tsn
Posts: 891
Joined: Fri Oct 27, 2006 10:36 am

Python Lesson II

Postby tsn » Mon Nov 20, 2006 10:30 am

Dear friends,

now I finally managed to finish the sceond Python lesson. You can download the RTF file directly from here:

[ Link has expired. Tutorials will be revised during the next weeks ]

There´s also a solution for the last homework coming with the document. The exercise was a bit ambiguous, so in the future I´ll try to describe better what I want you to do.

Have fun,
Thomas


shaun_michael
Posts: 4766
Joined: Sun Sep 10, 2006 8:04 am

Python Lesson II

Postby shaun_michael » Mon Nov 20, 2006 12:52 pm

As always Thomas, thank you for your time and effort. It is very much appreciated.

Shaun

User avatar
tsn
Posts: 891
Joined: Fri Oct 27, 2006 10:36 am

Python Lesson II

Postby tsn » Wed Nov 22, 2006 2:56 pm

Please reload the last lesson from

[ Link has expired. Tutorials will be revised during the next weeks ]

There´s a little mistake in "Example 1 - Batch Script". Well, it´s not a true mistake because the example´s working fine, but it can lead to some misunderstandings:

number_of_objects = 5
start = 0
increment = 1
factor_posX = 1.5

for objects in range (start,number_of_objects, increment):
cube = scene.addCube()
cube.setParameter("Position", Vector.new(objects * factor_posX, 0.0, 0.0))


We don´t have to introduce the last statement with a variable.

Regards,
tsn

shaun_michael
Posts: 4766
Joined: Sun Sep 10, 2006 8:04 am

Python Lesson II

Postby shaun_michael » Wed Nov 22, 2006 7:36 pm

Wow, this is excellent news Thomas. Looking forward to it.

Shaun

shiv_d
Posts: 14
Joined: Sat Apr 07, 2007 6:28 am

Python Lesson II

Postby shiv_d » Fri Nov 30, 2007 7:44 am

i tried a different approach:

Code: Select all

count = 1
pos = 2
mySphere = scene.addSphere()

while(count < 10):
   newSphere = scene.addSphere()
   newSpherePos = newSphere.getParameter("Position")
   newSpherePosX = newSpherePos.getX()
   newSpherePosX = count * pos
   newSphereNewPos = Vector.new(newSpherePosX, 0.0, 0.0)
   newSphere.setParameter("Position", newSphereNewPos)
   count += 1

User avatar
tsn
Posts: 891
Joined: Fri Oct 27, 2006 10:36 am

Python Lesson II

Postby tsn » Fri Nov 30, 2007 8:42 am

shiv_d wrote: i tried a different approach

Thanks shiv_d. It´s nice to see that these little tuts are still on the way through the web.

shiv_d
Posts: 14
Joined: Sat Apr 07, 2007 6:28 am

Python Lesson II

Postby shiv_d » Fri Nov 30, 2007 9:20 pm

tsn wrote: [quote=shiv_d]i tried a different approach

Thanks shiv_d. It´s nice to see that these little tuts are still on the way through the web.[/quote]
thanks, i like your approach a lot better and more efficient.

oh and btw, your RF magazine on scripting is probably about the best thing i have got my hands on ina long time. thank you sooo much for that! :)

pleeeeease make a new one on advanced scripting =)

cheers,
SD

shaun_michael
Posts: 4766
Joined: Sun Sep 10, 2006 8:04 am

Python Lesson II

Postby shaun_michael » Fri Nov 30, 2007 9:31 pm

shiv_d wrote:

pleeeeease make a new one on advanced scripting

Ditto that.

Shaun

User avatar
tsn
Posts: 891
Joined: Fri Oct 27, 2006 10:36 am

Python Lesson II

Postby tsn » Sat Dec 01, 2007 8:42 am

shiv_d wrote: oh and btw, your RF magazine on scripting is probably about the best thing i have got my hands on ina long time. thank you sooo much for that! :)

Thank you so much, shiv_d.

Indeed, I´m planning to make an issue covering advanced scripting. This, of course, needs a lot of R&D, so there´s currently no release date.

Regards,
tsn

shiv_d
Posts: 14
Joined: Sat Apr 07, 2007 6:28 am

Python Lesson II

Postby shiv_d » Wed Dec 05, 2007 12:59 am

tsn wrote: Thank you so much, shiv_d.

Indeed, I´m planning to make an issue covering advanced scripting. This, of course, needs a lot of R&D, so there´s currently no release date.

Regards,
tsn

wonderful! can't wait for it :)


Return to “Python Tutorials and Resources”

Who is online

Users browsing this forum: No registered users and 1 guest