[SOLVED] invalid use of incomplete type ‘class XCAFDoc_ShapeTool’

Hello,

I've been reading the documentation and many example from the forums, and I can not understand why the following code is failing:


Handle(TDocStd_Document) new_document = new TDocStd_Document("step-caf-reader");
Handle(XCAFDoc_ShapeTool) shape_tool = XCAFDoc_DocumentTool::ShapeTool(new_document->Main());

// Get the root labels
TDF_LabelSequence root_labels;
shape_tool->GetFreeShapes(root_labels);

I get:

146:19: error: invalid use of incomplete type ‘class XCAFDoc_ShapeTool’
  146 |         shape_tool->GetFreeShapes(root_labels);

I'm using OCC 7.8.1 and g++ 14.2.1

Any help is very appreciated !,

Thank you,

Dmitrii Pasukhin's picture

Hello, did you add #include <XCAFDoc_ShapeTool.hxx>?

Best regards, Dmitrii.

Dmitrii Pasukhin's picture

Latest documentation :

https://dev.opencascade.org/doc/overview/html/

https://dev.opencascade.org/doc/occt-7.8.0/refman/html/index.html

https://github.com/Open-Cascade-SAS/OCCT/wiki

_

As for your sample, the string as a argument for document is a schema name. These schemes used for save to file.

Additionally, you trying to get roots from empty documents. Needs to read something before extraction.

Best regards, Dmitrii.

Rafael SM's picture

Thank you @Dmitrii !

The problem is that I was missing the header, some how I tough that including XCAFDoc_DocumentTool was enough.

And regarding the documentation, I don't now if its important, but the google searches, lead to a 404 error, ex:
https://dev.opencascade.org/doc/refman/html/class_x_c_a_f_doc___shape_to...
So I landed in older versions,

Best regards,
rsm

Dmitrii Pasukhin's picture

Yes. It is an issue because I accidentally update the Doxygen version for the master branch. It takes a few weeks for google to recache the pages. I didn't expect critical changes on doxygen side. BUT we have a dark mode now ;)

* Additionally, I plan to migrate to Sphinx in some time (already create tasks for my team).

Best regards, Dmitrii.