How to get IGES entity types

Hi,

I would like to modify the source code in 08_SampleImportExpor. I am using Visual C++ 6.00. firstly I want to show user the list of IGES types from the data file. Then user can choose some of them to be imported.

Before performing the entity translation, how can I check how many IGES types there are and what they are in the specific IGES file. Which class or source file can I use.

Thanks a lot for your help!

Best wish and regard

David

a-helcman's picture

Hello David,

You can try this code for obtaining the number of entieties of type 120 (surface of revolution):

IGESControlStd_Reader o_iges_reader; Standard_Integer n_status;

n_status = o_iges_reader.ReadFile (s_file_name);

if (n_status == IFSelect_RetDone) {

Handle(TColStd_HSequenceOfTransient) po_entities = o_IGES_reader.GiveList ("iges-type(120)");

int n_count = po_entities->Length();

... }

Best regards, Adrian

Gilles DAVID's picture

HI Adrian,

Thanks a lot for your response!

It seems that I didn't explain my question clearly. I want to obtain the types of the IGES file, I want to know how many types there are in the IGEs file and waht they are. For example, can I know whether there is type 120 in the IGES file and what else types in the IGES file.

Thank you very much!

David

C. Caillet's picture

There are also some analysis tools, around "Signature" and "Counter".

Already GiveList allows you to filter according to a signaure :

// get all root shapes (for instance) Handle(TColStd_HSequenceOfTransient) aList = aReader.GiveList("xst-transferrable-roots");

// or get all all entities of the file

aList = aReader.GiveList ("xst-model-all");

// then apply a filter on that list

Handle(TColStd_HSequenceOfTransient) bList = aReader.GiveList ("iges-type(120)", aList);

bList then contains only the root entities of type 120

Other possibilites are to use operators Signature and SignCounter / SignaureList, either to print statistics, or to get more detailed infos by direct query

Francois Lauzon's picture

Hi David, Here is some code that you could use to get a list of IGES root entities. From there you can do whatever you want... Good Luck. Francois.

// read file in memory IGESControl_Controller::Init(); IGESControl_Reader aReader; IFSelect_ReturnStatus stat=aReader.ReadFile(aFilename); if (stat!=IFSelect_RetDone) {

return; }

aReader.Check(Standard_True); aReader.PrintCheckLoad(Standard_True,IFSelect_GeneralInfo);

// get all root shapes Handle(TColStd_HSequenceOfTransient) aList=aReader.GiveList("xst-transferrable-roots");

// transfert all the iges entity for (Standard_Integer j=1; j<=aList->Length(); j++) {

Standard_Boolean isTransfered=Standard_False;

// it's an iges entity

Handle(IGESData_IGESEntity) igesEntity=

Handle(IGESData_IGESEntity)::DownCast(aList->Value(j));

// do whatever you want with you iges entity,

// here I output the real type of this iges entity

cout << "IGES entity Name:"<DynamicType()->Name() <<" Type:"<TypeNumber()<< " Form:"<FormNumber()<< endl; }

Gilles DAVID's picture

Hi Francois,

Thanks a lot!!!

CASCADE is a very good open source for 3D graphic software programmer. Can I do something useful for it?

David

Francois Lauzon's picture

Hi David, you might have a look at all the ongoing projects at www.opencascade.org and see were you can be usefull. Francois.

Roman Lygin's picture

Hello David,

At Open CASCADE we have been pleased to see your positive reaction and your praiseworthy wish to help us. This is actually the way we would like to see overall community. In coming days I would like to contact you to define together the best way how you could contribute to Open CASCADE. Hope to talk to you soon.

Kind regards, Roman