Find linked objects

About advanced scenes, and the Thyme scripting language used in Algodoo.

Find linked objects

Postby Kilinich » Mon Jan 14, 2013 2:07 pm

Sometimes in complex scenes with lots of overlapping objects you need to select related.
For example the axis attached to this geom. This can be done, though it's difficult.
So:

1) Select desired shape and in the script menu find it's geomID

2) From the console create a variable
scene.my.selected = []

3) Select all the axes in area and in script menu add two variables:
_geom0 = {(readable(entity)).Geom0}
and
_geom1 = {(readable(entity)).Geom1}

4) In the same menu, enter the command scripts (instead of ID use geomID from desired geom)
(_geom0 == ID) | | (_geom1 == ID) ? {scene.my.selected = scene.my.selected + + [entityID]} : {}

5) In the console, type the command
scene.addGroup {name = "selected"; entityIDs = scene.my.selected}

Voila, we have selected axes, which are attached to the geom.
Similarly, you can look for other related objects ... :thumbup:
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Find linked objects

Postby Kilinich » Mon Jan 14, 2013 2:13 pm

I've re-discover script window for myself. :geek:

You can do some batch operation like increase density of white objects
... just by selecting all and enter in script window:

color == [1,1,1,1] ? {density = density * 2} : {}
8-)
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Find linked objects

Postby Xray » Sat Oct 12, 2013 5:48 am

Kilinich wrote:Sometimes in complex scenes with lots of overlapping objects you need to select related.
For example the axis attached to this geom.



Kilinich wrote:3) Select all the axes in area and in script menu add two variables:


Kilinich wrote:Voila, we have selected axes, which are attached to the geom.



In each of those quoted statements you refer to "axis" and "axes". I don't understand how an axis can be selected or attached to a geometry. An axis is either the X axis or the Y axis of a geometry. Did you mean to say something different, like maybe "axle"? Please explain. (A sample scene would be very helpful to understand this tutorial).
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 8 guests