|
|
Pyton scripts
About Truespace Archives
These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.
They are retained here for archive purposes only.
Pyton scripts // Archive: Tech Forum
Post by achilles // May 3, 2007, 9:43pm
|
achilles
Total Posts: 24
|
Hallo, I need to know where to find python scripts for TS.
I notice that is very hard to find any on the Web. I can try to produce something by myself but am not so able to program.
I need, for example a scipt that make several copies of a mesh at diferrent position in the space controlling that position numerically.
Does exist in TS 6.6 a similar tool or command?
Thank you.
Achille |
Post by TomG // May 4, 2007, 3:11am
|
TomG
Total Posts: 3397
|
tS6.6 has the Array tool that can work in 1, 2 or 3 dimensions. If you are looking for something to position objects in space in regular, repeated intervals (not sure what you mean by "numerically you see), then that would do the trick without the need for a Python script.
There is no repository of Python scripts for tS6.6 - not that many were made that I am aware of.
More of a description of what you want to achieve will let people advise 1) How to do it in tS6. with no plugin if possible; 2) recommend a plugin that can help (those are often free); 3) how a script might tackle it, if one doesn't already exist.
HTH!
Tom |
Post by achilles // May 4, 2007, 6:37am
|
achilles
Total Posts: 24
|
Thank you. I mean a command to place several objects in the space at a given distance between them an in different positions in the 3d space, like this one http://www.tb-software.com/oneline_docu/rh3_help/dialog2.htm?zoom_highlightsub=array.
By TS array command I'm not able to obtain what i want, pherhaps am i that don't understand it.
Bye.
Achill |
Post by chamaeleon // May 4, 2007, 6:50am
|
chamaeleon
Total Posts: 74
|
Not sure if this is the most elegant way.. Anyway.. Paste the following in the scene script window, have an object select and click the run button. Hope it is of some help..
import trueSpace
import math
doc = trueSpace.GetActiveDocument()
obj = doc.CurrentSelection()
copies = 20
if obj != None and obj.Name != "":
for i in range(1, copies+1):
obj.Select()
doc.CurrobjCopy()
newobj = doc.CurrentSelection()
newobj.Position = 4*math.sin(2*math.pi*i/copies), 4*math.cos(2*math.pi*i/copies), 0
trueSpace.Stop() |
Post by achilles // May 4, 2007, 7:55am
|
achilles
Total Posts: 24
|
Fine, but with more options and a complete interface the job will be more useful.
Bye and thanks.
Achille |
Post by chamaeleon // May 4, 2007, 8:12am
|
chamaeleon
Total Posts: 74
|
Fine, but with more options and a complete interface the job will be more useful.
Bye and thanks.
Achille
That's left as an exercise to the interested reader. Your initial post did not say anything about GUI, just that you wanted a script to position objects, which is what I replied to (bare minimum, but then, I didn't have a whole lot in the way of requirements to go by). If you truly only want a uniform distribution in 1, 2 or 3 dimensions, with same distance between each object, the Array tool will in fact do what you require. I recommend opening up the manual and reading the relevant information regarding the panel for the tool. The attached image consist of cubes of size 0.5x0.5x0.5, with a 0.5 distance between each one in each direction. |
Post by TomG // May 4, 2007, 8:36am
|
TomG
Total Posts: 3397
|
As Chamaeleon says, tS6.6 will do this with the Array tool. The manual will give the details, the tool is very flexible (define the distance and number of objects, tS will change the distance between the objects; or define a set static distance between objects and tS will calculate how many fit into your given distance; define repeats separately for the x, y and z axis; create 1D, 2D or 3D arrays).
So looks like you have all you need, including GUI interface (with ability to manipulate it directly in the 3D space even), built-in to tS6.6 :)
HTH!
Tom |
Post by Emma // May 4, 2007, 11:34am
|
Emma
Total Posts: 344
|
If you want to continue with Python scripts you better hurry to get everything together that's still online available. Unfortunately the resources become less and less (fortunately trueSpace 7.x doesn't need anymore python ;) )
On the german truespace forum
http://forum.3dspace.de/thread.php?threadid=20&sid=82b001dc4c9424e6aa3c4cc9731a45ea
you find several samples for python scripts. There is also used a GUI
Also on the german trueSpace forum is a bunch of links
http://forum.3dspace.de/thread.php?threadid=77&sid=82b001dc4c9424e6aa3c4cc9731a45ea
here go to the lunadude site and there folllow the GUI link. If you manage to get there in contact
with the author he hopefully will send you the needed GUI files.
Perhaps someone else knows another source ?
The links disappear more and more, so don't expect that all still work. |
Post by ProfessorKhaos // May 4, 2007, 6:15pm
|
ProfessorKhaos
Total Posts: 622
|
You might find the following link interesting as well.
http://home.mindspring.com/~clintonr/MyTruespace/TSPython.html
Looks like they're even creating an array of cubes with slightly different colors (according to RGB color dimensions)
I looked through a few posts in the CaliArchive (next to 'new posts' dropdown menu). I think you'll find quite a few good examples there as well.
If you're looking to build object meshes from scratch in python, you'll definitely want Chamaeleon's mesher extension to python for trueSpace. It opened up huge possibilities for procedural mesh creation.
If you're sticking with 6.6 and want to get the most out of python possible, there are a few good ones out there. I had a few of them including one that used mesher to create and animate a car along a roller coaster track.
See this thread:
http://forums.caligari.com/discus/messages/1585/10466.html?1062223989
I may have to port this one over to tS7+ some day soon.
If you're really REALLY into scripting and can afford it, I'd recommend moving to truespace 7.11 (or higher when available). The access to object properties is much more flexible and components written in Jscript and VBScript are compatible with each other thanks to Rosetta. The interface provided by Rosetta overcomes a significant drawback to python on the old system. Dialogs and control panels could be made in python but you had to install some additional files under 6.6 which made widespread distribution a bit more painful. |
Post by achilles // May 5, 2007, 7:11am
|
achilles
Total Posts: 24
|
Thanks everyone. Maybe my question wasn't well post: what i mean is not an array like the one internal in TS where the objects are all at the same distance and level each from others, but (like the one present in Rheingold and other programs) where i can decide numerically the position of each object in 3d space, or to automatically make copies of an object in different positions. For example first obj at 0,0,0 the others at a variable distance and position in x, y, and z. Pherhaps am i that haven't understood the TS array function, but i am not able to do what i said before.
By from Achille |
|