585,575 active members*
4,016 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Fanuc > FOCAS cnc_rdaxisdata function in the c#
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2021
    Posts
    3

    Post FOCAS cnc_rdaxisdata function in the c#

    CNC_RDAXISDATA from within the Focas library | POSITION I want to pull this function using the ready-made function below, but I am getting an error in the byte part, can you help?

    Absolute position, machine position, relative position, distance to go,
    of all axes are got and displayed.

    class example
    {
    public void sample()
    {
    Focas1.ODBAXDT_data pos = new Focas1.ODBAXDT_data();
    short[] types = { 0, 1, 2, 3 };
    short len = Focas1.MAX_AXIS;

    byte[] bytes = new byte[Marshal.SizeOf(pos) * 4 * Focas1.MAX_AXIS];
    IntPtr ptrWork = Marshal.AllocCoTaskMem(Marshal.SizeOf(pos));

    short ret = Focas1.cnc_rdaxisdata(h, 1, types, 4, ref len, bytes);
    if (ret == Focas1.EW_OK)
    {
    int i;
    Console.WriteLine(“ABSOLUTE:”);
    for (i = 0 * Focas1.MAX_AXIS; i < 0 * Focas1.MAX_AXIS + len; i++)
    {
    Marshal.Copy(bytes, i * Marshal.SizeOf(pos), ptrWork, Marshal.SizeOf(pos));
    Marshal.PtrToStructure(ptrWork, pos);
    Console.WriteLine("{0} = {1}", pos.name, pos.data);
    }
    Console.WriteLine("MACHINE:");
    for (i = 1 * Focas1.MAX_AXIS; i < 1 * Focas1.MAX_AXIS + len; i++)
    {
    Marshal.Copy(bytes, i * Marshal.SizeOf(pos), ptrWork, Marshal.SizeOf(pos));
    Marshal.PtrToStructure(ptrWork, pos);
    Console.WriteLine("{0} = {1}", pos.name, pos.data);
    }
    Console.WriteLine("RELATIVE:");
    for (i = 2 * Focas1.MAX_AXIS; i < 2 * Focas1.MAX_AXIS + len; i++)
    {
    Marshal.Copy(bytes, i * Marshal.SizeOf(pos), ptrWork, Marshal.SizeOf(pos));
    Marshal.PtrToStructure(ptrWork, pos);
    Console.WriteLine("{0} = {1}", pos.name, pos.data);
    }
    Console.WriteLine("DISTANCE TO GO:");
    for (i = 3 * Focas1.MAX_AXIS; i < 3 * Focas1.MAX_AXIS + len; i++)
    {
    Marshal.Copy(bytes, i * Marshal.SizeOf(pos), ptrWork, Marshal.SizeOf(pos));
    Marshal.PtrToStructure(ptrWork, pos);
    Console.WriteLine("{0} = {1}", pos.name, pos.data);
    }
    }
    Marshal.FreeCoTaskMem(ptrWork);
    }
    }
    Attached Thumbnails Attached Thumbnails cnc_rdaxisdata.png  

  2. #2
    Join Date
    Apr 2022
    Posts
    1

    Re: FOCAS cnc_rdaxisdata function in the c#

    Hello Mr. Emir. I want to collect data via Fanuc Oi-TF Plus.
    Working signal.
    counter signal.
    I need tag addresses for On which screen can I see these addresses?

    Thank You.

Similar Threads

  1. FOCAS pmc_rdpmcrng function in the c#
    By EmirC in forum Fanuc
    Replies: 1
    Last Post: 07-04-2023, 08:35 PM
  2. FOCAS cnc_rddynamic function in the c#
    By EmirC in forum Fanuc
    Replies: 2
    Last Post: 11-30-2022, 07:56 PM
  3. FOCAS. What is that?
    By Leha_Blin in forum Fanuc
    Replies: 2
    Last Post: 06-06-2013, 06:10 PM
  4. Fanuc FOCAS 31ib
    By abhthree in forum Fanuc
    Replies: 0
    Last Post: 01-17-2013, 06:19 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •