I am trying to DLLImport the function simxGetObjects
from remoteApi.dll of v-rep software. Here is the link to the function description:
http://www.coppeliarobotics.com/helpFiles/en/remoteApiFunctions.htm#simxGetObjects
and here is the brief description for this function from the above link:
Description: Retrieves object handles of a given type, or of all types (i.e. all object handles)
C synopsis: simxInt simxGetObjects(simxInt clientID,simxInt objectType,simxInt* objectCount,simxInt** objectHandles,simxInt operationMode)
C parameters:
clientID: the client ID. refer to simxStart.
objectType: object type (sim_object_shape_type, sim_object_joint_type, etc., or sim_handle_all for any type of object
objectCount: pointer to a value that will receive the number of retrieved handles
objectHandles: pointer to a pointer that will receive an object handle array. The array remains valid until next remote API function is called. operationMode: a remote API function operation mode. Recommended operation mode for this function is simx_opmode_oneshot_wait
Here is the way I am importing it (simxGetObjects function):
[DllImport("remoteApi.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int simxGetObjects(int clientID, string objectType, IntPtr objectCount, ref IntPtr objectHandles, string operationMode);
and here is how I am calling it:
int intClientID = simxStart("127.0.0.1", 19999, true, true, 5000, 5);
IntPtr intptrObjectCount = IntPtr.Zero;
IntPtr intptrObjectHandles = IntPtr.Zero;
simxGetObjects(intClientID, "sim_handle_all", intptrObjectCount, ref intptrObjectHandles, "simx_opmode_oneshot_wait");
It does not show any error, however both intptrObjectCount and intptrObjectHandles variables are zero.
I really appreciate if someone can help me on this.
objectCountandobjectHandlesthat I need to obtain. It basically calls the software that is running in the background and retrieve the number and handle of all of the objects that are in the scene.