More fun with Autoexp.dat - let's see those resbufs

I had a nice surprise this weekend. Jorge Lopez, an old friend and colleague, had been reading this blog entry and decided to create a Visual Studio AddIn that allows you to see resbufs content expanding automatically while debugging.

Jorge and I go back a long way - he used to work in DevTech (before it was called that) in our Americas team, back when I was based in Europe the first time. He later went on to join AutoCAD Engineering, and was one of the key contributors to AutoCAD's COM Automation API (although back then it was called either OLE Automation or ActiveX Automation - I can't remember exactly the nomenclature at the time).

[ A side note: This isn't an isolated phenomenon: a number of DevTech Engineers have moved into different teams and functions inside Autodesk over the years. Working in DevTech, providing technical services to ADN members, you learn a lot about our products and about developing software with Autodesk technology. Ex-DevTechers have moved into Product Management, Technical Publications, QA, Consulting and - most commonly - Software Development. Many do stay in the team, especially those that have already worked in Software Development and like the variety and relative freedom of DevTech.

Anyway - this has turned into a bit of a sales pitch, so before I get back on topic, here are our two open positions, one in Prague and the other in Beijing. 🙂 ]

I'm very pleased to say Jorge is back with Autodesk after several years away, once again developing software for our Platform Technologies division.

So here's the project and additional information that Jorge sent through...

Download arxdbgaddinSource.zip

If you build the Win32 projects, it will copy to the appropriate folder where Visual Studio can find it. Otherwise, just copy the included DLL in the Release folder of the zip to an appropriate location.

Add the following to [AutoExpand] section of autoexp.dat.

; ObjectARX resbuf
resbuf=$ADDIN(arxdbgaddin.dll,AddIn_Resbuf)

I used the BlockView sample on the ObjectARX 2007 SDK (under samples/graphics) to test this out in Visual Studio 2005, as this sample happens to use resbufs for two different purposes: it uses acedGetFileNavDialog() to select files, which returns the filename in a resbuf, and it uses acedGetVar() to get the value of the VIEWCTR system variable, a 3D point also returned in a resbuf.

Here's what you see in the debugger for resbufs containing strings and 3D points without the AddIn loaded:

Resbuf_debugging_rtstr_before_2

Resbuf_debugging_rt3dpoint_before

And here's what you see with the AddIn loaded:

Resbuf_debugging_rtstr_after

Resbuf_debugging_rt3dpoint_after_1

As mentioned earlier, this was coded for and tested with Visual Studio 2005 (VC8.0) - I have no idea whether it will work with previous versions or different flavours of Visual Studio.

5 responses to “More fun with Autoexp.dat - let's see those resbufs”

  1. I just wanted to clarify that this addin will only work with AutoCAD 2007+. The strings in resval.rstring are expected to be UNICODE.

  2. Török Zoltán Avatar

    Hello Kean,

    Nice work. Keep this add-in alive and
    put more ARX data structure into.
    It could be part of ObjectARX lib.

    Regards,
    Zoltán Török

  3. Hi Kean, I too wrote an VS addin (2002 and 2003). It displays some importent values of AcDbObject, AcDbEntity, AcDbLine, AcDbArc ... and for many AcGe object. Maybe we can "merge" them?

    Arnold

  4. Hi Arnold,

    Absolutely - if you're able to combine the code posted in this article with you're own, I'd be very happy to post another entry with the updated project (recognising your contribution, of course). Otherwise I'll combine them myself - that's fine by me (just email me the project).

    At some point - with your permission - it might be good to be made available via another mechanism, whether the discussion group, the ADN website or the ObjectARX SDK (it could be a useful addition to the ObjectARX Wizard, for instance).

    Thanks,

    Kean

  5. Hello Kean,

    Here is a [Visualizer] entry for VS2005's autoexp.dat to display resbufs:

    [Visualizer]

    resbuf{
    preview
    (
    #switch( $c.restype )
    #case 5000 ( #("RTNONE") )
    #case 5001 ( #("RTREAL= ", (float)$c.resval.rreal) )
    #case 5002 ( #("RTPOINT= (", (float)$c.resval.rpoint[0], "|", (float)$c.resval.rpoint[1], ")" ) )
    #case 5003 ( #("RTSHORT= ", $c.resval.rint) )
    #case 5004 ( #("RTANG= ", (float)$c.resval.rreal) )
    #case 5005 ( #("RTSTR= ", $c.resval.rstring) )
    #case 5006 ( #("RTENAME= (", $c.resval.rlname[0], ", ", $c.resval.rlname[1], ")") )
    #case 5007 ( #("RTPICKS= (", $c.resval.rlname[0], ", ", $c.resval.rlname[1], ")") )
    #case 5008 ( #("RTORINT= ", (float)$c.resval.rreal) )
    #case 5009 ( #("RT3DPOINT= (", (float)$c.resval.rpoint[0], "|", (float)$c.resval.rpoint[1], "|",(float)$c.resval.rpoint[2], ")" ) )
    #case 5010 ( #("RTLONG= " , $c.resval.rlong) )
    #default
    (
    #( "restype=", $c.restype )
    )
    )
    }

    In the debugger it looks like this:

    rb RTSTR= 0x087323a8 "Hallo"
    rbnext RTREAL= 12.3400
    rbnext RTPOINT= (1.1000000|2.2000000)
    rbnext RT3DPOINT= (1.1000|2.2000|3.3000)
    rbnext RTSHORT= 42
    rbnext RTLONG= 4242

    Enjoy
    -- Thomas

Leave a Reply to Jorge Lopez Cancel reply

Your email address will not be published. Required fields are marked *