Wed, 07/12/2023 - 10:46
Hi,
I am trying to understand why a DownCast is not working. I am starting from an IGESCAFReader and want to get the GlobalSection
I tryed this:
Handle(IGESData_IGESModel) modl = Handle(IGESData_IGESModel)::DownCast(reader.IGESModel());
and got this from the Compiler:
In template: 'IGESData_IGESModel' is an incomplete type
If I check the code in debug mode,
Handle(IGESData_IGESModel) modl = reader.IGESModel();
Shows the whole structure with the information I am looking for in the header section.
How do I get the header (GlobalSection) object?
If I try
Handle(IGESData_IGESModel) modl = reader.IGESModel();
IGESData_GlobalSection GS = modl->GlobalSection();
I get from the compiler:
In template: static_cast from 'Standard_Transient *' to 'IGESData_IGESModel *', which are not related by inheritance, is not allowed
Member access into incomplete type 'IGESData_IGESModel'
Thank you in advance
Wed, 07/12/2023 - 11:27
Hello,
Please include each file that are you use(including base class header and goal class header).
But in you case for extract IGESData_IGESModel you don't need to down-cast. Method returns goal class.
#include <IGESData_IGESModel.hxx>
#include <IGESData_GlobalSection.hxx>
Best regards, Dmitrii.
Wed, 07/12/2023 - 16:32
Turns out the problem was the missing #include <IGESData_IGESModel.hxx>
I was only including #include <IGESCAFControl_Reader.hxx>, and I could get the handle, but it was useless.
By including the IGESModel.hxx it was possible to use the handle correctly.
So, I guess the error Message was not clear to me.