Python beginner's woes

Discussions concerning programming of SOFTIMAGE©
Pooby
Posts: 501
Joined: 27 Aug 2010, 20:25

Python beginner's woes

Post by Pooby » 29 Jul 2011, 12:03

Moderator edit: I've split the following thread from this one - HB

Ive gone through hours of Python tutorials, downloaded ebooks on it and feel like i have a decent understanding of the concepts, but as soon as I start to combine that with anything in XSI, I get errors I cant resolve after about 2 lines, then look around to get to the bottom of why.. find nothign that is related to my issues and give up resigning myself to the fact I'm not a coder, (which is slightly hypocritical of me, seeing as thats the sort of thing I tell off the 'ICE is too technical' crew about.)
I need practical examples.. Separating the learning of Python and XSI's object model etc doesnt seem to work for me I'm afraid.

I went through that scripting in XSI example you posted. Even when I copy and paste bits in directly from that PDF I get errors.

User avatar
Hirazi Blue
Administrator
Posts: 5113
Joined: 04 Jun 2009, 10:15

Re: Softimage Tutorial Vimeo Group

Post by Hirazi Blue » 29 Jul 2011, 12:08

But then you probably would be best served with some kind of workshop (with "expert" guidance), not necessarily a tutorial (series), as someone will have to help you find your specific errors and gotchas, things you can't really learn from a one-way tutorial, I'm afraid. ;)

P.S. Yes,the scripting pdf I mentioned, sadly, still contains some ugly errors, this however doesn't disqualify it completely IMHO (in other words: for lack of other tutorials apart from the SI-WIKI I personally still learned a lot from it), although confusing newcomers should obviously not be happening in such cases.
Stay safe, sane & healthy!

User avatar
Rork
Posts: 1359
Joined: 09 Jul 2009, 06:59
Location: Close to The Hague, Netherlands

Re: Softimage Tutorial Vimeo Group

Post by Rork » 29 Jul 2011, 12:17

There was an excellent videoset on scripting for XSI a awhile ago, done by Helge.

Unfortunately that's not on sale anymore, you might find somebody that still has that one somewhere?
It was hosted for a short while on Redi-Vivus, but Joe decided it was better to remove it due to some legal issues and age of the XSI versions used.
SI UI tutorials: Toolbar http://goo.gl/iYOL0l | Custom Layout http://goo.gl/6iP5xQ | RenderManager View http://goo.gl/b4ZkjQ
So long, and thanks for all the Fish!!

Pooby
Posts: 501
Joined: 27 Aug 2010, 20:25

Re: Softimage Tutorial Vimeo Group

Post by Pooby » 29 Jul 2011, 12:19

Sorry to Hijack this thread but Can anyone tell me what I did wrong here? I copied the script on the left and you can see the error on the right. If I cant even copy and paste someone esle's working script without error, what hope do I have of writing my own?
You do not have the required permissions to view the files attached to this post.

User avatar
Hirazi Blue
Administrator
Posts: 5113
Joined: 04 Jun 2009, 10:15

Re: Softimage Tutorial Vimeo Group

Post by Hirazi Blue » 29 Jul 2011, 12:25

Probably just the indentation in the original text that is purely for typographic reasons, not for programming's sake
(and therefore stupid as Python highly depends on correct indentation and strict syntax).
Move the contents of line 5 back to the end of line 4, making it one line.
And do the same for line 13, appending it to line 12
Stay safe, sane & healthy!

Pooby
Posts: 501
Joined: 27 Aug 2010, 20:25

Re: Softimage Tutorial Vimeo Group

Post by Pooby » 29 Jul 2011, 12:55

like this? This is specifically the kind of frustration that gets me so irritated I can't keep my focus on scripting for too long before I start getting irrational violent urges to hit monitors etc. Its about as much fun as going out for a joyride at rush hour through the centre of a big city.
You do not have the required permissions to view the files attached to this post.

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 16:43

Re: Softimage Tutorial Vimeo Group

Post by Chris_TC » 29 Jul 2011, 13:11

I don't know much about this stuff, but for what it's worth, here is the SDK documentation of this command:
http://download.autodesk.com/global/doc ... ement_html

The Python example in the documentation uses this line
oPicked = Application.PickElement( c.siModelFilter, 'Pick model', 'Pick model' )

So maybe it's supposed to be <<c.siObjectFilter>> instead of <<constants.siObjectFilter>>? Sorry if this is silly, I have no idea :D

EricTRocks
Moderator
Posts: 754
Joined: 25 Nov 2009, 00:41

Re: Softimage Tutorial Vimeo Group

Post by EricTRocks » 29 Jul 2011, 13:46

Pooby wrote:Sorry to Hijack this thread but Can anyone tell me what I did wrong here? I copied the script on the left and you can see the error on the right. If I cant even copy and paste someone esle's working script without error, what hope do I have of writing my own?
Hey Paul,

You need to replace the ' marks with the none curly kind I believe.
Eric Thivierge
Lead Kraken Developer, Fabric Engine
http://fabric-engine.github.io/Kraken

Pooby
Posts: 501
Joined: 27 Aug 2010, 20:25

Re: Softimage Tutorial Vimeo Group

Post by Pooby » 29 Jul 2011, 14:14

EricTRocks wrote:
Pooby wrote:Sorry to Hijack this thread but Can anyone tell me what I did wrong here? I copied the script on the left and you can see the error on the right. If I cant even copy and paste someone esle's working script without error, what hope do I have of writing my own?
Hey Paul,

You need to replace the ' marks with the none curly kind I believe.
Yay!! that was it.. Thanks, now i've shuffled another inch toward the moon. on a unrelated note, I find it ironic when people think I'm some kind of coder just because I can invent stuff in ICE. I dont know any maths l and I can't script at all. YET!

Eric.. Why not make a tutorial set on Scripting in XSI for twits like me? It'd make a nice addition to your Tutorial Group.

EricTRocks
Moderator
Posts: 754
Joined: 25 Nov 2009, 00:41

Re: Softimage Tutorial Vimeo Group

Post by EricTRocks » 29 Jul 2011, 15:13

Pooby wrote: Eric.. Why not make a tutorial set on Scripting in XSI for twits like me? It'd make a nice addition to your Tutorial Group.
Time and money sir.... time and money... I was thinking of doing a weekly tutorial for the vimeo group though... hmm. It'll have to wait until after Siggraph though cause I'm pretty busy these days.
Eric Thivierge
Lead Kraken Developer, Fabric Engine
http://fabric-engine.github.io/Kraken

Pooby
Posts: 501
Joined: 27 Aug 2010, 20:25

Re: Softimage Tutorial Vimeo Group

Post by Pooby » 29 Jul 2011, 16:21

EricTRocks wrote:
Pooby wrote: Eric.. Why not make a tutorial set on Scripting in XSI for twits like me? It'd make a nice addition to your Tutorial Group.
Time and money sir.... time and money... I was thinking of doing a weekly tutorial for the vimeo group though... hmm. It'll have to wait until after Siggraph though cause I'm pretty busy these days.
I might do a reverse tutorial.. Showing me having a crack at scripting something and making an embarrassing mess of it. Much like I did with my ICE IK kinematics one.

User avatar
Hirazi Blue
Administrator
Posts: 5113
Joined: 04 Jun 2009, 10:15

Re: Softimage Tutorial Vimeo Group

Post by Hirazi Blue » 29 Jul 2011, 18:21

@Pooby - Just remembered something: there once was a training series from Digital Tutors
about Python in Softimage, aptly called "Introduction to Python ActiveX Scripting in Softimage".
Don't know if it's any good, but you could always check it out.
Stay safe, sane & healthy!

User avatar
Hirazi Blue
Administrator
Posts: 5113
Joined: 04 Jun 2009, 10:15

Re: Python beginner's woes

Post by Hirazi Blue » 30 Jul 2011, 12:17

In his "infinite wisdom" Stephen Blair now has created a short video
about the copy-paste and other troubles described earlier in this thread:
Python copy-and-paste gotchas
I even learned that some code CAN be split over multiple lines,
so my initial answer was totally wrong.
So thanks, Stephen!

And @Stephen - If only you would announce these little gems yourself
in the threads they were inspired by...
;)
Stay safe, sane & healthy!

User avatar
Memag
Posts: 339
Joined: 08 Aug 2010, 23:37
Location: Tits

Re: Python beginner's woes

Post by Memag » 31 Jul 2011, 10:34

How about cmiVFX "Intro to Python programming for CG"?

Image

People say it's not for a bare boned beginner but it is stuffed with matter.
Click image for cmiVFX page.

User avatar
Hirazi Blue
Administrator
Posts: 5113
Joined: 04 Jun 2009, 10:15

Re: Python beginner's woes

Post by Hirazi Blue » 31 Jul 2011, 18:51

I know I should have included this post in this thread also...
Ah well, "splitting threads" is a dying art! :D
Stay safe, sane & healthy!