Here is the code
Code: Select all
simSetThreadSwitchTiming(2) -- Default timing for automatic thread switching
simDelegateChildScriptExecution()
h=simGetObjectHandle('Cuboid_model')
wasPreviouslyReadyForPicking=true
while true do
-- Save current selection state:
currentSelection=simGetObjectSelection()
-- Copy an object:
simRemoveObjectFromSelection(sim_handle_all,-1)
simAddObjectToSelection(sim_handle_single,h)
simCopyPasteSelectedObjects()
copy=simGetObjectSelection()[1] -- this is the copy
-- Make the copied object dynamic (i.e. non-static):
simSetObjectIntParameter(copy,3003,0)
-- Make the copied object respondable:
simSetObjectIntParameter(copy,3004,1)
-- Make the copied object visible:
simSetObjectIntParameter(copy,10,1+256)
-- Restore the initial selection state:
simRemoveObjectFromSelection(sim_handle_all,-1)
simAddObjectToSelection(currentSelection)
simSwitchThread()
simWait(15) -- wait a bit before being able to produce again
end
http://postimg.org/image/da60tdx1b/