Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Apply physics to each object (Application builder)
Posted Mar 16, 2019, 9:28 p.m. EDT Acoustics & Vibrations, Simulation Apps, Geometry Version 5.4 1 Reply
Please login with a confirmed email address before reporting spam
Hello, I'm generating a vector of circle objects programmatically (2D), this works well, but I want to apply an acceleration to each generated circle (different in each one).
To apply the acceleration must indicate the indices of the segments of the circle, but when generating it programmatically I do not have them and they are not constant because in each execution the number of circles is changed, how can I obtain those indexes? Is there another solution?
The example code of the loop that generates the circles and tries to apply the acceleration is the following:
// LOOP (N = input value)
for (int i = 0; i < N; ++i) {
// BUILD CIRCLE i
String tag = "cloop"+(i+1);
String pos = "aCol-d/2-d*"+i; // VERTICAL POSITION
model.component("comp1").geom("geom1").create(tag, "Circle");
model.component("comp1").geom("geom1").feature(tag).set("pos", new String[]{"0", pos});
model.component("comp1").geom("geom1").feature(tag).set("r", "a/2");
// ADD TO ACUMMULATIVE SELECTION FOR DIFFERENCE AFTER THE LOOP
model.component("comp1").geom("geom1").feature(tag).set("contributeto", "csel1");
// GET INDEX
int[] idx = Unknown(tag); // ??????
// ACCELERATION
String atag = "naccloop"+(i+1);
model.component("comp1").physics("acpr").create(atag, "NormalAcceleration", 1);
model.component("comp1").physics("acpr").feature(atag).set("nacc", "exp(iniDist*"+i+"/c0 * j*2*pi*frecMax)"); // ACCELERATION VALUE i
model.component("comp1").physics("acpr").feature(atag).selection().set(idx); // APPLY ACCEL
}
Thanks!