How can I avoid V-REP to autoselect last created objects ?

Typically: "How do I... ", "How can I... " questions
Post Reply
RL_Niryo
Posts: 14
Joined: 03 Oct 2019, 17:05

How can I avoid V-REP to autoselect last created objects ?

Post by RL_Niryo »

Hi Coppelia team,

I finished the big part of my work on my pick and place chain. Cans are auto generated and place and a cardboard as we wanted to.
Now, I want to perfect it, so that, we will be able to show it to potential Niryo's customers.

I'm using dummies to tell to the robot where to go, and I dynamically generate dummies on cardboard to tell where cans should be placed.
The issues is that, when I'm creating these dummies in a n-iterations loop, the one created in the current iteration loop is selected, which make it visible and give a weird effect.
Moreover, this effect also appears when I'm generating my cans & cardboards, which leads to the impossibility of following an object in the objects' panel

Is there a way to disable this auto-selection or maybe, set something on the created object so that it won't be selected ?

Hope my issue is clear.

Cheers

Rémi

coppelia
Site Admin
Posts: 10362
Joined: 14 Dec 2012, 00:25

Re: How can I avoid V-REP to autoselect last created objects ?

Post by coppelia »

Hello Rémi,

try something like:

Code: Select all

local sel=sim.getObjectSelection()
-- create objects here...
sim.removeObjectFromSelection(sim.handle_all,-1)
sim.addObjectToSelection(sel)
If running inside of a threaded child script, do following to avoid being interrupted in-between:

Code: Select all

sim.setThreadAutomaticSwitch(false)
local sel=sim.getObjectSelection()
-- create objects here...
sim.removeObjectFromSelection(sim.handle_all,-1)
sim.addObjectToSelection(sel)
sim.setThreadAutomaticSwitch(true)

Cheers

RL_Niryo
Posts: 14
Joined: 03 Oct 2019, 17:05

Re: How can I avoid V-REP to autoselect last created objects ?

Post by RL_Niryo »

coppelia wrote: 15 Oct 2019, 11:00 Hello Rémi,

try something like:

Code: Select all

local sel=sim.getObjectSelection()
-- create objects here...
sim.removeObjectFromSelection(sim.handle_all,-1)
sim.addObjectToSelection(sel)
If running inside of a threaded child script, do following to avoid being interrupted in-between:

Code: Select all

sim.setThreadAutomaticSwitch(false)
local sel=sim.getObjectSelection()
-- create objects here...
sim.removeObjectFromSelection(sim.handle_all,-1)
sim.addObjectToSelection(sel)
sim.setThreadAutomaticSwitch(true)

Cheers
It's working pretty well now, thank you a lot team Coppelia ! And I would like to thank you once again for providing us with such a good help during our model conception :)

Cheers

Post Reply