Last modified: 2021-04-30
2. Both Python 3 dll and ptsxpy core files needed to run your script. First, select "Python" tab below.
3. If you have already had the same version with below, skip this tab and select "ptsx3py" tab above. If not so (you don't have the version below), download the file below. (Please read "License" to know about Python distributions, and "Quick Start" to know how to install")
4. Select "ptsx3py" tab above to download ptsxpy core files.
5. Download "Main" and "tSXX", for Python 3 (where XX is trueSpace version you use; 43=tS4.3, 51=tS5.1, 60=tS6.0, 66=tS6.6 and tS7 Model side. please read also "Quick Start" tab above.)
Click to see old versions, but are more buggy and not recommended.
2. Both Python 2 dll and ptsxpy core files needed to run your script. First, select "Python" tab below.
3. If you have already had the same version with below, skip this tab and select "ptsx2py" tab above. If not so (you don't have the version below), download the file below. (Please read "License" to know about Python distributions, and "Quick Start" to know how to install")
4. Select "ptsx2py" tab above to download ptsxpy core files.
5. Download "Main" and "tSXX", for Python 2. (where XX is trueSpace version you use; 43=tS4.3, 51=tS5.1. 60=tS6.0, 66=tS6.6 and tS7 Model side. please read also "Quick Start" tab above.)
Click to see old versions, but are more buggy and not recommended.
Last modified: 2021-04-30
- Corrected functions that take one or more "float *" (i.e. pointer to float) as parameter.
- Added to constants to ptsxpydef1.py
- Corrected directory to load dll for tS6.0. (Unchanged for tS4.3, tS5.1, and tS6.6 (Model side of tS7))
- CharArray class - Corrected loaduchar/storeuchar to loadchar/storechar.
- UcharArray class - Added.
- ptsxgp module - Added loadchar() and storechar().
- Corrected number of methods' arguments for patch and surface.
- Added a definition for tsxNPatchBuildVisRepAuto() to ptsxpydef1.py. (it was originally defined in tsxnpatch.h of tSxAPI SDK)
- RegisterWidgetType(). Changed type of 3rd and 4th argument from C++ pointer to user script side Python function object so that user can specify function in the script.
- CreateWidget(). Changed type of 5th argument from C++ pointer to Python function object so that user can specify function in the script.
- Added to ptsxgp module.
ptsxgp.getpymjrver() Returns Python major version (2 or 3).
ptsxgp.alloc_double() Allocates an array of C++ double (64 bit floatin point value)
ptsxgp.loaddouble() Loads from C++ double.
ptsxgp.storedouble() Stores to C++ double.
- Added to ptsxpydef1.py
tsxWDG_DRAW = true # draw widget
tsxWDG_NODRAW = false # skip drawing
copyfrom() method to copy from C++ address to the instance (for some classes).
xxxx_p() method to get address of a member in the C++ struct of the instance (for some classes)
adr() method to get C++ address of an element of xxxxArray class instance.
Type checking and value checking in some classes
- Other changes in ptsxpydef1.py
Corrected CtsxSubDivEdge class. At address calculating for load and store, from sizeof_CtsxVector3f to sizeof_CtsxSubDivEdge.
Corrected CtsxSubDivFace class. At address calculating for load and store, from sizeof_short to sizeof_CtsxSubDivFace.
WidgetReg class. The 4th and 5th parameter from C++ pointer to user script side Python function object.
WDG_CALLBACKS class. All 10 callbacks from C++ pointer to user script side Python function object.
Added type checking and value checking in some classes.
- Corrected shader parameter ID definitions (CSPID_xxxxx_xxxxxx) in ptsxdef1.py. Some IDs (CSPID_C_CALTEXTURE_FILTER=85, CSPID_D_CALBUMPMAP_FILTER=220) were missing and the following IDs are misaligned. Newly added them and corrected the misaligned IDs. Added some IDs (246 - 635) for tS5.1 and later tS.
- Changed starting and ending message. "build --> built", "runscriptfile() ended" --> "scriptfilename ended".
- Changed PhysSimGetCenterOfGravity(). It previously returned a tuple to the 2nd argument specified as a list objec. It stores a pointer to CtsxVector3f. User can allocate a memory area using ptsxgp.alloc_long( 1 ), call the function, load the area using ptsxgp.loadptr(), and assign it to a pointer to Vec3f() using Vec3f_p()
- Added zipped python27.dll of Python 2.7.16 to the download page.
- Zipped python27.dll of Python 2.7.15 in the download page in order to keep updated date. The displayed hash codes change.
- Changed the functions that require one or more "char *" for their arguments so that each user script can specify str objects for the visible string arguments and can specify addresses (unsigned long) for the char * arguments.
- Changed the functions that return a visible string pointer so that each script can receive str objects from such functions.
- Removed some obsolete (auxiliary) functions from the ptsxgp module. Please use classes predefined in ptsxdef1.py instead.
- Corrected following function so that the last argument receives not a str but a pointer (unsigned integer).
- Added a line for initializing "self.num" to each pointer class definition (named xxxx_p) in the ptsxdef1.py so that user can specifiy an index to the pointer class instance.
- Added some definitions of tsxSHCLASS_xxxx for the value 5-8 to ptsxdef1.py.
- Corrected following functions so that each argument receives not a list but a pointer (unsigned integer).
GNodeGetAxesOrientation() 2nd arg.
ParameterValueGetData() 2nd arg.
LatticeGetResolution() 2nd and 3rd arg.
- Corrected CollisionCheckObjWithScene() and FreeCollisionReport() so that two pointer parameters are passed to the API function tsxCollisionCheckTwoObj() correctly.
- Corrected CollisionCheckTwoObj() so that the 5th and 6th arguments are passed to the API function tsxCollisionCheckTwoObj() correctly.
- The first official release.
Last modified: 2018-07-29
- trueSpace 4, 5, 6, or 7 *1
- Windows PC (64 bit or 32 bit OS) *2
- Microsoft Visual C++ 2017 Runtime Redistributable (x86) *3
- text editor
*1 Each of ptsxpy distribution does not include trueSpace (tS). At least one tS must be installed in your computer to run this plugin (You may be able to find tS7.6 for free via the internet). The plugin is made to run on tS 4.3, 5.1, 6,0, 6,6 and 6.6 mode of tS7.6 (i.e. Model side of tS7.6). It may run on other versions like 5.2 or 7.5.
*2 Windows Vista SP2, Windows 7 or later. You need to update to SP2 (service pack 2) if your Windows Vista is SP1.
*3 Note that the runtime must be "x86" (for 32 bit) even if your OS is 64 bit. You can download and install the it from Microsoft's site. If a file, ucrtbase.dll, has already been installed in the directory Windows\SysWOW64\ or Windwos\System32\ of your computer, the installation of the runtime may be unnecessary.
You can select Python version (2 or 3) at the point of download.
Last modified: 2018-07-10
1. Use of the plugin
The version 0.x.x (where "x" is any number) of ptsxpy (this plugin) is developed and maintenanced by the author who holds the intellectual property rights. You (users) can use the distributed files of the version 0.x.x and your own script files freely for both personal and commercial use without any notice to the author, and you don't have to include the author's copyright notice in your own scripts.
The source codes of version 0.x.x of this plugin are not opened to public. Don't try to reverse-engineer, decompile, or disassemble.
2. Difference from Caligari's tsxPython
Each of trueSpace (tS) version has its original Python interpreter, tsxPython, and a script editor in it, and user can manipulate tS using Python language. But the functions are limited. For Example, as far as the author knows, sweep function and bevel function cannot be used from it, or the spec seem not to have been opened to the public at least.
The number of the functions written in the "latest" document TSXPYTHON.DOC ver.4.0 June 1998 was less than 100 though there are actually about 600 thru 1200 (which differs depending on tS version) API functions.
This plugin implements another interpreter to the tS, and user can manipulate using most functions described in tsxAPI documents and header files. Some classes that wrap C/C++ struct and some auxilialy general purpose funtions (e.g. storefloat()) are predefined and help user to use C/C++ resources and tS resources from Python.
3. About the Python DLL
Each distribution of this plugin includes python27.dll or python37.dll. It is not a product of the author of ptsxpy, but a part of Python distributed by Python Software Foundation. Please note that all Python DLL for 2.7.x has the same file name regardless of the tailing number "x" and of 32bit/64bit distribution. The plugin uses a DLL for 32-bit Python 2.7.15. To check the product version of the Python DLL, right-click it, select "Properties", and select "Detail" tab.
If you want to check if the included python27.dll is the legitimate file, please visit the download page of python.org, find "specific release" section, select "Python 2.7.15 (2018-05-01)", and download "Windows x86 MSI installer". After you installed it to your computer, you can find the 32-bit python27.dll in;
- C:\Windows\SysWOW64\python27.dll (if you installed on 64-bit Windows)
- C:\Windows\System32\python27.dll (if you installed on 32-bit Windows)
Then, please compare the size and updated date against the inluded python27.dll. You can check if it is 32-bit dll using the "dumpbin" command of Visual Studio or other tools. The plugin does not use the installed Python using above instrucion. You may uninstall the Python: Right-click the Start button - Programs and Features.
If you want check python37.dll, you need not to install Python 3.7. In this case, download only "Windows x86 embeddable zip file". (Please note that it's not "x86-64". The plugin uses 32 bit DLL)
It's highly recommended that you DON'T download any python DLL from the so-called "download sites" because we can not know where it comes and whether some modifications are done.
Similar but different
Primitive tsxPython (ptsxpy) has no connection with followings and other similar names;
- Primitive Itch, a trueSpace plugin vender well-known to tS fans.
- Ticker symbols like PTSXQ, PTSX, PTXSPY, etc. used for stock markets.
The Primitive tsxPython (ptsxpy) has some connections with followings but is not part of them and is not the same with them;
- tsx (or tSx), short for "trueSpace eXtension" named by Caligari corp.
- tsxPython, a Python interpreter bundled in each of Caligari's trueSpace series.
- Python, a programming language.
Python® is a registered trademark of the Python Software Foundation. Microsoft®, Windows®, Excel®, Visual Studio®, and other some terms are registered trademarks or trademarks of Microsoft Corporation in multiple countries.
Last modified: 2019-03-04
1. Author's Obligation
The author will not be held liable for any damage, disadvantages or expenses by using the software. The author has no obligation to provide maintenance, support, updates, enhancements, or modifications.
2. Changing your tS scene
Please bear in mind that trueSpace (tS) may crash or the current tS scene, objects, parameters, or other states may be broken by running the plugin and scripts. It's recommended to save the important scene and objects before loading or running the plugin
3. Specification changes
The specification of the plugin will change. Your scripts or sample scripts may be able to run on the newer version of the plugin. It's recommended to leave ptsxpy major and minor version (x.y of x.y.z) and Python versoin (2 or 3) as a comment line in your scripts so that you and other readers can distinguish whether the script can run on a specific pair of Python and ptsxpy.
4. 3rd party scripts
Beware of malicious scripts that destroy your PC. Some functions can easily change memory in your computer. You may get some 3rd party scripts for the plugin via the FORUM, etc.,but don't believe all people are good guys.
The author will take care not to leave bugs that give your computer fatal damages but there are some possibility of doing that accidentally.
Last modified: 2022-04-15
(1) Make sure that following runtime library has already been installed in your conputer.
Microsoft Visual C++ 2017 Redistributable (x86)
Note that it must be "x86" (i.e. for 32 bit) even if your OS is 64 bit. You can download and install it from Microsoft's site. If a file, ucrtbase.dll, has already been installed in the directory Windows\SysWOW64\ or Windwos\System32\ of your computer, the installation of the runtime may not be unnecessary. You can also check that by right-clicking Windows "Start" - "Programs and Features" (or "Control Panel" - "Programs and Features").
(2) Unzip the downloaded zip files (xxxx_Main_xxxx.zip, xxxx_tSxx_xxxx.zip, and pythonxxxxx.zip) to any folder you like. You get all or a part of the following files.
|Python 3 mode||Python 2 mode||Note|
|ptsx3pysb43.dll||ptsx2pysb43.dll||for trueSpace 4.3 only|
|ptsx3pysb51.dll||ptsx2pysb51.dll||for trueSpace 5.1 only|
|ptsx3pysb60.dll||ptsx2pysb60.dll||for trueSpace 6.0 only|
for trueSpace 6.6 and
|python37.zip||No unzip needed|
To check the version of each ptsxpy DLL file, right click the file, select "Property", select "Details" tab. You need to rename *.tsx to *.dll before you do that.
If you want to check the Python DLL files are genuine, please read "About the Python DLL" in License" page.
(3) Using Windows Explorer, locate to the directory where tS was installed. (If you forgot it, right click your trueSpace icon and select "Open file location")
(4) Find "tsx" (or "Tsx") folder and locate in it.
For example, you may be in: c:\xxxxxxx\trueSpace761\tS\tsx\
(5) Make a folder in the "tsx" folder, rename it to "ptsx3py" (or "ptsx2py") or any name you like, and move the downloaded and unzipped files to the folder. You need not unzip the python.37.zip.
2. Uninstall and partial update
If you would like to uninstall the ptsxpy, just delete the "ptsx3py" (or "ptsx2py") folder that you made at the installation precess. This plugin does not write any Windows registory on its installation.
If you would like to update to newly released version, just replace the files. Before you run your script, you should unload the old ptsxpy3 (or ptsxpy2) icon using Shift drag to trashcan icon, and then load the .tsx file to trueSpace.
3. Load ptsxpy to trueSpace
(1) Start your trueSpace.
(2) Find "Install new trueSpace extension" button ("plug" icon) and click it. A file selection dialog appears.
(3) Locate to the "ptsx3py" (or "ptsx2py") folder, double-click "ptsx3py.tsx" (or "ptsx2py.tsx") or select it and hit Enter key.
(4) The "ptsxpy3" (or "ptsxpy2") icon appears next to the "plug" icon. The Screen shot below is of tS7.6 (Model side)
, orfor tS4.3
If you would like to unload the plugin, Shift drag the icon to the trashcan. You can clone the icon by dropping any othre place.
You may load both ptsxpy3 and ptsxpy2 on a tS at the same time and can run script with each Python. However please note that the console window and the tS resources are common for both. You must avoid conflict of them.
4. Run a Python script file
(1) Prepare your script file. For example, create a text file, open it using a text editor, copy following code, save and rename it like "test1.py".
In Python language, the indentation level (i.e. blank preceding to each line) is significant. Please check the documents distributed by python.org: "PEP 8 -- Style Guide for Python Code" )
#------------------------------ # Crete and move some cubes. #------------------------------ import ptsxpy as p import ptsxgp import math x = 0. for i in range( 5 ): print( "i=", i ) cb1 = p.CreateCube( 2 , 1., 1., 1. ) p.SceneAddObject( cb1, e_tsxFALSE ) loc = Vec3f( x, 0., 0. ) print( "loc=", loc.prt() ) p.GNodeSetLocation( cb1, loc.p ) x += 2. p.SceneDraw()
In the example above, p.CreateCube() calls the correcponding C++ side tSxAPI function tsxCreateCube(). You can get information from tSxAPIxx.doc in SDK for each trueSpace version. The module "ptsxgp" and "math" are imported but not used in this example. They are necessary only if you use methods of these module. The "math" is a satandard module of Python and the "ptsxgp" has general purpose functions for user script and "ptsxpydef1.py". The "ptsxpydef1.py" is always imported automatically to user script (please read also the section below).
(2) Click the "ptsxpython" button.
(3) A file selection dialog and a console window (with black background) appear. tS may hide the console window. you can bring it forward later using holding-Alt key and a few times of Tab key.
(4) Locate to the directory where a script you would like to run exists. Double-click your script file (or select and Enter key) to start it.
(5) A message "...ended" comes to the console window when the scripts ended.
Note: it's highly recommended that you manage the combination ofthe Python major version (2 or 3) and ptsxpy major.minor version (x.y in x.y.z), because the specifications and the implementations of ptsxpy may change in the future. In addition, if you attach the script to a post to the Uesr Forum, etc., you should clearly describe on which tS version the script can run.
5. Syntax of functions, predefined classes and constants
In the above sample code, the script is calling some tsxAPI functions like: p.XXXXX( ---- ). The "p" here is an alias of a module "ptsxpy" defined at the beginning of the script. The "XXXXX" here is the part of the name of each tsxAPI function, tsxXXXXX(). If you have the SDK (Software Development Kit) distributed by Caligari corporation for your trueSpace version, you can know the syntax and behavior of them from tsxAPIxx.doc and .h files. The SDK may be found via the net.
The plugin automatically imports a plain text, "ptsxpydef1.py", while it initializes Python. It defines some classes (e.g. Vec3f) and constants (e.g. sizeof_CtsxVector3f). Please don't modify the file. You can add your original classes and constants in each script file or in your file. In the sample script, an instance of Vec3f class is assigned to the variable "loc". The "loc.p" means the pointer to the three float values. The function GNodeSetLocation() receives it as the 2nd parameter, and sets the location of the cube object given to the 1st parameter. The "e_tsxFALSE" is defined in the "ptsxpydef1.py". You need not to write like "ptsxpydef1.e_tsxFALSE" and can omit the module name because the module is imported like "from ptsxpydef1 import *" by the plugin. The "ptsxgp" is a module of general purpose auxiliary functions.There are some ptsxpygp functions used in "ptsxpydef1.py".
Please read also HELP pages and visit FORUM where you can get sample scripts, read tutorials, report bugs, request features, discuss with members, or ask questions. Registration required before submitting your first post.