Create custom views of OpenCASCADE objects in the Visual Studio debugger

From Visual Studio 2012, it introduced the Natvis framework. The Visual Studio Natvis framework lets you customize the way Visual Studio displays native types in debugger variable windows such as the Watch, Locals, and Data Tips windows. It supersedes the autoexp.dat file that has been used in earlier versions of Visual Studio and offers Xml syntax, better diagnostics, versioning, and multiple file support.
Component authors can use the natvis framework to create visualization rules for their types that make it easy for developers to inspect them during debugging.

I use the Natvis framework to customize the views for OpenCASCADE container classes, such as:
* TColStd_Array1OfInteger;
* TColStd_ListOfInteger;
* .etc. ;
The custom views works for TColStd_Array1OfInteger, see the attach file. but does not work on TColStd_ListOfInteger, maybe the method I used is not correct, see the natvis code below:

{{size = {myUpperBound - myLowerBound + 1}}}

myUpperBound - myLowerBound + 1

myUpperBound - myLowerBound + 1
(Standard_Integer*)(myStart) + myLowerBound

{{current = {myValue}}}




Anyone can help? Thanks a lot.

Best Regards,
Shing Liu

Forum supervisor's picture

Dear eryar,

You can check some existing visualizers for OCCT classes in sub-folder 'dox/dev_guides/debug/occt.natvis' of OCCT folder. Please feel free to contribute your improvements!

Shing Liu's picture


I found the occt.natvis and add the TopoDS_ListOfShape, it works!
See the attach file.

Thank you very much.

Shing Liu's picture

And the occt.natvis...