Jump to content

Python Examples on DevWiki


twk

Recommended Posts

Greetings All,

Just read through the code for the sample python PIO's on the DevWiki, just noticed that most function calls were passing variables into it after initialising it first to '0' or an empty string.

global paramName, paramHandle, paramRecHandle, wallHandle
ok, paramName, paramHandle, paramRecHandle, wallHandle = vs.GetCustomObjectInfo( paramName, paramHandle, paramRecHandle, wallHandle )

From 'PythonSample_ObjectPt3'.

Why are variables being passed into the vs.GetCustomObjectInfo function? Shouldn't it be written like this:

global paramName, paramHandle, paramRecHandle, wallHandle
ok, paramName, paramHandle, paramRecHandle, wallHandle = vs.GetCustomObjectInfo()

??

Is the first method the correct one?

Thanks

Tui

Link to comment

Oh ok cool, thanks Dieter.

Do you know what this part of the example code does? :

if paramHandle == 0:
       paramName = 'PythonSample_ObjectPt3'

Is that checking to see if there is no handle to the PIO object to force a PIO name? What is the benefit of doing this?

Thanks

Tui

Link to comment
Oh ok cool, thanks Dieter.

Do you know what this part of the example code does? :

if paramHandle == 0:
       paramName = 'PythonSample_ObjectPt3'

Is that checking to see if there is no handle to the PIO object to force a PIO name? What is the benefit of doing this?

Thanks

Tui

Lol, it doesn't do anything.... as paramName isn't used anywhere further in the script. So it can be removed. The example scripts aren't all that great you know. I get the feeling they were made by people that are just starting out with Python.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...