Sharpening your tools

Let me share with you a couple of simple things that could make your life a bit easier if you use Microsoft Visual Studio for development on Open CASCADE.

1. Highlighting Open CASCADE class names in the editor

This will improve your code readability and what is more important, can serve as additional quick check whether you correctly spell a OCC class name before you get a compiler error ;-).

What you just need to do is to copy the file UserType.dat shipped with Open CASCADE (tools subdirectory) it to where devenv.exe is located. For instance, on my laptop it’s here - c:\Program Files\Microsoft Visual Studio 8\Common7\IDE\. If you already have some UserType.dat, just concatenate the contents.

2. More convenient display of Open CASCADE data types in debugger

Have you even been tired of clicking in a deep nested tree in the Watcher window to dig down from your surface just to check its reference count ? If yes, this can be for you.

As you might know, the debugger allows you to display complex types (e.g. classes) not only as default ‘{…}’. To do that you can describe display rules, modifying the autoexp.dat file.
I have found and extended one with a few frequently used OCC types. Go download it here and insert into autoexp.dat, located inside Visual Studio hierarchy. For instance, for VS2005 it is here - c:\Program Files\Microsoft Visual Studio 8\Common7\Packages\Debugger\Autoexp.dat.
Compare these two screenshots. The one below (with modified autoexp.dat) displays everything what one above does but in a more concise form without forcing you to expand the tree.

OCC team: feel free to include this file or its extended version into Open CASCADE release ;-).

There is yet another functionality – skipping stepping into a function in the Debugger, so that when you click F11, it bypasses some internal functions you don’t want to spend your time in. This is an undocumented technique described here. I did not try it but you may want to. If you are a success, please share your settings with us, this will likely be helpful for several people.

There are likely more than that. If anyone is willing to share his/her experience, please send me an email at roman.lygin@gmail.com and I can post it.


  1. Roman,

    Thanks a lot for the last hint - I did not knew this is possible. After some experiments I have been able to set it up on MS VS 2005 SP1; for the moment I have arranged it to avoid entering operator->() functions of OCCT Handle() and Boost smart_ptr classes. Here is extract of my registry (hope text will not be broken...):



    "Debugger: do not go into Handle_*::operator -> ()"="Handle_.*\\:\\:operator.*=NoStepInto"

    "Debugger: do not go into boost::shared_ptr::operator -> ()"="boost\\:\\:shared_ptr.*\\:\\:operator-\\>=NoStepInto"

  2. Cool !

    By the way, it seems SourceForge did not set up download mirrors yet. So you can use some direct links, e.g. http://internap.dl.sourceforge.net/sourceforge/opencascade/autoexp-occ.dat

  3. I know intellisense in earlier versions of Visual Studio were not working so good with OpenCASCADE and the Handle() macro (I don't know with VS2008).
    A trick to have it work better was to use the real handle class name instead of the macro
    Handle_Geom_Curve instead of Handle(Geom_Curve)
    So now I'm used to it and only use the Handle_ way.



  4. Hi Stephane!

    Thanks for a hint. I'm using MSVS2005 and it seems to work fine with handles. So, when I type something like:

    Handle(TDocStd_Document) aDoc;

    it pops up a list of methods. Don't remember 2003 and did not use 2008 yet.

  5. Hello,

    just tested the 'debugger hack' - very nice.

    Regarding intellisense and syntax highlighting - I haven't found anything better than Visual Assist so far...


  6. And one "tool" which I use very often - the old HTM documentation for OCC 5. It's pretty old, but it's useful. I hate the bloated doxygen docs!!!


  7. Andrey sent me a file he was using in his project, and I posted it on SourceForge. He added a fragment to be inserted into the [Visualizer] subpart of autoexp.dat which is used to visualize internal details of the variable. This feature comes in VS2005.
    Here is the article that you might find helpful in this regard.