Hi,
I had a model where I wanted to add the selected walls or actually pillars to a group so that I could easily move the group around. However, if I select the pillars and then use right click and Object groups --> Add to new group (see image below) then only the Walls object is added to the group and none of the pillars.
I was able to get around this by using the script below which loops the drawsurrogate node (containing the pillars) and adds them to the given group if the pillar is selected.
// DEFINE GROUP TO ADD TO Group test = Group("Group1"); // FOR ALL SELECTED (RED) PILLAR OBJECTS IN MODEL. // THEY EXIST UNDER THE WALLS OBJECT IN THE DRAWSURROGATE NODE forobjecttreeunder(Model.find("Walls").find(">visual/drawsurrogate")){ // IF THE PILLAR IS SELECTED if(switch_selected(a,-1) == 1) { // ADD TO GROUP test.addMember(a.as(Object)); } }
The code works nicely, but one needs to give the group manually. So it would be nicer if FlexSim would handle this automatically if pillars are selected and added to a group. Could this perhaps be added to FlexSim?
Thank you!
Kind regards,
Axel