access Objects of TObj_Model

Hi,

I guess I don't have much experience with Opencascade. I have started a program, in which I can draw the bottle tutorial. Now I would like to show the objects (in my case only the bottle) in a tree product structure. I am trying to access all the objects doing this:

Handle(TObj_ObjectIterator) objs = Handle(TObj_Model)::GetObjects();

but the compiler says 'GetObjects' is not a member of 'opencascade::handle<TObj_Model>'

I also tried on 2 lines with the same error:

Handle_TObj_Model mModel;
Handle(TObj_ObjectIterator) objs = mModel.GetObjects();

What am I missing? Thanks!

 

Andrey BETENEV's picture

Use -> instead of dot

Handle(TObj_ObjectIterator) objs = mModel->GetObjects();

mfregeau's picture

Great! Now however I have a linking error:

undefined reference to `TDF_Attribute::DynamicType() const'

Which library am I missing?

mfregeau's picture

I got it to compile now by adding the additional library, in a very particular order. Also the declaration of the needed .h files had to be ordered specifically.

When I test run the program however, the gui does not show up and the exe stops after 1 second. In Debug mode it throws:

Process terminated with status 255.

This means something went of out range. My only 2 lines creating this bug are:

Handle_TObj_Model mModel;

Handle(TObj_ObjectIterator) objs = mModel->GetObjects();