twk Posted November 26, 2015 Share Posted November 26, 2015 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 Quote Link to comment
Dieter @ DWorks Posted November 26, 2015 Share Posted November 26, 2015 (edited) The second is correct. I'm using this. You can look at DLibrary: https://bitbucket.org/dieterdworks/vw-dlibrary/src/77b4aad5d060ef573db4f172653b8feadd24e74f/dlibrary/vectorworks.py?at=master&fileviewer=file-view-default in the Vectorworks module. Edited November 26, 2015 by Dieter @ DWorks Quote Link to comment
twk Posted December 3, 2015 Author Share Posted December 3, 2015 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 Quote Link to comment
Dieter @ DWorks Posted December 3, 2015 Share Posted December 3, 2015 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. Quote Link to comment
Recommended Posts
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.