1. Overview of General purpose auxiliary functions

 The ptsxpy provides General purpose auxiliary functions that can be used in your Python scripts. Import ptsxgp module to your script aside from ptsxpy.

import ptsxgp
    ptsxgp.msgbox_info( "your title here", "Hello World!" )

You could give it an alias like "gp" like we do for ptsxpy, but the aliasing may not be necessary because you wouldn't have many opportunities to use ptsxgp.

2. Currently active functions

Name Usage
getpymjrver Gets Python major version (2 or 3).
scrfname Gets user script file name.
scrdir Gets user script directory name.
memcpy_p2top1 Copies memory area pointed by parameter 2 to one pointed by parameter 1.
msgbox_info Display a Windows popup message box with infomation icon. Specify a title and a body of text.
msgbox_excl Display a Windows popup message box with exclamation icon. Specify a title and a body of text.
rand Returns a random number using tsxAPI.
randomize Randomizes the seed of random number.
doosevents Waits Windows events have done.
getdlldir Gets the directory name where the ptsxpy.tsx is placed.

 

3. Functions for internal use

Name Usage
alloc_char() alloc_short() alloc_int() alloc_long() alloc_float() alloc_double() alloc_str() alloc_vec3f() alloc_vec2f() alloc_txmx3f() alloc_axes3f() alloc_bbox3f() alloc_latvec() alloc_wdgreg() alloc_colrpt() alloc_quaternion() alloc_viewparam() alloc_wdg_callbacks() alloc_color() alloc_surfaceprops() alloc_protexgranite() alloc_protexmarble() alloc_protexwood() alloc_textureprops() alloc_bumpprops() alloc_txmx2f() alloc_rect() alloc_facevx() alloc_face() alloc_hole() alloc_uv() alloc_edge() alloc_latticevector() alloc_matrectprops() alloc_derivcurves() alloc_subdivedge() alloc_physenvir() alloc_floatcolor() alloc_rendertofiledata() alloc_renderdata() alloc_image() alloc_texturefromlightingdata() Allocates memory dynamically. These are used internally by ptsxpydef1.py (one of the ptsxpy's parts), and you don't need to use them directly. It is recommended to use predefined classes (e.g. Float, Short, IntArray, Vec3f, Vec3f_p, etc. The reason is that the freeing of memory is done automatically by each class instance. ----- In case that you use these methods, write like p1 = alloc_xxxx( n ). Where xxxx is a C/C++ type name such as float or short. A heap memory area with n times of the size for each type is dynamically allocated, and the address is returned. You must free it using ptsxpy's p.Free( p1 ) before the script terminates. ----- In case of classes (recommended), write like f1 = Float() or fa1 = FloatArray( 10 ) in your script. An instance is returned and assign to the left side (f1 of fa1 in this example), and your script can access the address of the emmory area using the attribute p (f1.p or fa1.p in this example). No explicit freeing needed. Please read ptsxpydef1.py installed in your tS's tsx folder for details.
loadfloat() storefloat() loaddouble() storedouble() loadlong() storelong() loadulong() storeulong() loadint() storeint() loadshort() storeshort() loadushort() storeushort() loadchar() storechar() loaduchar() storeuchar() loadptr() storeptr() loadstr() storestr() Reads from or write to memory area. The methods for load takes an address like x = ptsxgp.loadxxxx( p1 ) and returns the memory contents. The methods for store takes an address and a value like ptsxgp.storexxxx( p1, val1 ) and write the value to the memory addressed. In both cases, the addresses must be one got from tS via some tsxAPI functions. The storing value may be one got from tS or may be your value. It's recommended to use pre-defined classes (like Vec3f, p1 = Vec3f_p, p1.x(), p1.set_ z(), p1.inc(). etc.) insted.
sizeof_int() sizeof_float() sizeof_long() sizeof_short() sizeof_pointer() sizeof_struct_CtsxAxes3f() sizeof_struct_CtsxBBox3f() sizeof_struct_CtsxBumpProps() sizeof_struct_CtsxCollFaceReport() sizeof_struct_CtsxCollisionReport() sizeof_struct_CtsxCollVertexReport() sizeof_struct_CtsxColor() sizeof_struct_CtsxDerivCurves() sizeof_struct_CtsxEdge() sizeof_struct_CtsxFace() sizeof_struct_CtsxFaceVx() sizeof_struct_CtsxFloatColor() sizeof_struct_CtsxGraniteProps() sizeof_struct_CtsxHole() sizeof_struct_CtsxLatticeFloor() sizeof_struct_CtsxLatticeVector() sizeof_struct_CtsxMarbleProps() sizeof_struct_CtsxMatRectProps() sizeof_struct_CtsxPhysEnvir() sizeof_struct_CtsxProcTexture() sizeof_struct_CtsxQuaternion() sizeof_struct_CtsxRect() sizeof_struct_CtsxSubDivEdge() sizeof_struct_CtsxSubDivFace() sizeof_struct_CtsxSurfaceProps() sizeof_struct_CtsxTextureProps() sizeof_struct_CtsxTxmx2f() sizeof_struct_CtsxTxmx3f() sizeof_struct_CtsxUV() sizeof_struct_CtsxVector2f() sizeof_struct_CtsxVector3f() sizeof_struct_CtsxViewParam() sizeof_struct_CtsxWDG_CALLBACKS() sizeof_struct_CtsxWidgetReg() sizeof_struct_CtsxWoodProps() sizeof_struct_CtsxWoodProps() sizeof_struct_tsxEventMouseData() sizeof_struct_tsxEventRenderData() sizeof_struct_tsxEventViewMsgData() sizeof_struct_tsxImage() sizeof_struct_tsxMousetool() sizeof_struct_tsxObjectNotifyMessage() sizeof_struct_tsxRenderData() sizeof_struct_tsxRenderToFileData() sizeof_struct_tsxTextureFromLightingData() These are called from ptsxdef1.py and pre-defined as constants like sizeof_int (without parentheses), so you don't need to call these methods directly. You can simply use the constants in your scripts like p1 = p1 + sizeof_Vec3f. However it's recommended to use predefined classes (e.g. Vec3f_p() and the inc() method of it).