• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk ObjectARX

    Reply
    Contributor
    Chaos0205
    Posts: 17
    Registered: 01-04-2012

    Can someone give me a XData example ?

    145 Views, 3 Replies
    02-22-2012 06:27 PM

    I am learning XData, and there is several things i do not understand about it. The help file is not much of a help, so can someone please give me an example to create a simple (string/integer type) Xdata, that would be a big help

    Or at the very least, please tell me how to check if a XData is working or not. Right now, i got some code without bug, but I do not know this is because i got the code right or simply forgot to add some critical line.

    Employee
    artc2
    Posts: 84
    Registered: 06-08-2010

    Re: Can someone give me a XData example ?

    02-22-2012 08:42 PM in reply to: Chaos0205

    The ObjectARX SDK has a sample specifically for XData, and parts of that sample are in the Developer's Guide.

     

    The sample is located in samples\database\xdata_dg.

    Contributor
    Chaos0205
    Posts: 17
    Registered: 01-04-2012

    Re: Can someone give me a XData example ?

    02-26-2012 06:34 PM in reply to: artc2

    This example seem to be written for VS 2003 , so when i try to build it with VS2005 or VS2008, it got an error LNK1104: cannot open file 'mfc70.lib'. And since I can not downgrade my VS any further, so testing is not possible now.
    Beside, this example create a Xdata with both CString variable. Is it possible to add 1 integer variable into the same XData ?

     

    Thanks in advance !

    Employee
    artc2
    Posts: 84
    Registered: 06-08-2010

    Re: Can someone give me a XData example ?

    02-26-2012 11:32 PM in reply to: Chaos0205

    Which ObjectARX SDK version do you have?  I'm using what will be the 2013 ObjectARX SDK and when I build the xdata sample using VS 2010, I don't get any errors and I don't have an mfc70.lib on my machine.

     

    Sure you can add an integer as well as a string.  I haven't tested this, but something like it should work.  The lines up to the assert(err == 0); are from the sample.  I just added the three lines at the end.:

     

        // Add user-specified string to the xdata.
        //
        pTemp->rbnext = acutNewRb(AcDb::kDxfXdAsciiString);
        pTemp = pTemp->rbnext;
        const size_t nSize = _tcslen(resString) + 1;
        pTemp->resval.rstring
            = (TCHAR*) malloc(nSize * sizeof(TCHAR));
        errno_t err = _tcscpy_s(pTemp->resval.rstring, nSize, resString);
        assert(err == 0);

     

        pTemp->rbnext = acutNewRb(AcDb::kDxfXdInteger32);
        pTemp = pTemp->rbnext;
        pTemp->resval.rlong = 146; // or whatever 32-bit int value you want