For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Iges import issue

Harish's picture
Forums: 

We are in process of building a simple application that would read iges files and perform some geometry operations. While testing some iges files generated by solid works, we noticed some issues. I have attached a simple sample file (test_Bad.IGS) for review. This example is a tube created using revolve option in solid works. When we load this file into OCCT using the precompiled Import-export sample program on windows, we noticed improper spherical surface at bottom.
However, if we load this IGES file into the Solid works and export back in iges format, we get a file that can be loaded properly into opencascade application.
I tested the test_Bad.IGS files in other cad tools and found it to be working fine.
Is there a way to read this test_Bad.IGS file properly using opencascade libraries? Please suggest.

Thanks,
Harish

Attachments: 
Francois Lauzon's picture

Hello,
I have just tried your file in our in-house software, which use OCC 6.5.0 standard IGES classes and it seems fine...

Attachments: 
Harish's picture

Thanks for your quick reply. I tested using sample import and Export application of OCC 6.5.0.The attached image shows the missing surface and inverted inner spherical surface.
Can you please let me know what iges reader settings you used for importing this file in your in-house software?

Attachments: 
Francois Lauzon's picture

I tried the file with and earlier release of OCC (6.3.1) and still good result. So here are the big line of our uses of OCC classes, we read every IGES entity so we could get the name, color, level... of each entity:

IGESControl_Controller::Init();
// load data exchange message files
Message_MsgFile::LoadFromEnv("CSF_XSMessage","IGES");

// load shape healing message files
Message_MsgFile::LoadFromEnv("CSF_SHMessageStd","SHAPEStd");

IGESControl_Reader aReader;
IFSelect_ReturnStatus stat=aReader.ReadFile(anOCName.ToCString());

// check file conformity and output stats
aReader.PrintCheckLoad(Standard_True,IFSelect_GeneralInfo);

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

// build a new list with group expanded
Handle(TColStd_HSequenceOfTransient) aList=new TColStd_HSequenceOfTransient();
Standard_Integer j;
for (j=1; jLength(); j++) {
if (aListInit->Value(j)->IsKind(STANDARD_TYPE(IGESBasic_Group))) {
Handle(IGESBasic_Group) igesGroup=
Handle(IGESBasic_Group)::DownCast(aListInit->Value(j));
for (Standard_Integer i=1; iNbEntities(); i++) {
aList->Append(igesGroup->Value(i));
}
}
else {
aList->Append(aListInit->Value(j));
}
}

// transfert all the iges entity
for (j=1; jLength(); j++) {
Standard_Boolean isTransfered=Standard_False;

Handle(IGESData_IGESEntity) igesEntity=
Handle(IGESData_IGESEntity)::DownCast(aList->Value(j));
if (!igesEntity.IsNull()) {
// clear any old shape
aReader.ClearShapes();
Standard_Boolean isTransfered=Standard_False;
try {
isTransfered=aReader.TransferEntity(igesEntity);
}
catch (Standard_Failure) {
isTransfered=Standard_False;
}
catch (...) {
isTransfered=Standard_False;
}
// transfer it
if (isTransfered) {

// it's ok
if (aReader.NbShapes()>0) {

// get the shape
TopoDS_Shape aShape=aReader.OneShape();

// add it to the context with the right color
// and blank status
if (!aShape.IsNull()) {

// a level number exist
Standard_Integer aLevel=-1;
if (igesEntity->DefLevel()==IGESData_DefValue) {
aLevel=igesEntity->Level();
}

QString aName;
if (igesEntity->HasShortLabel()) {
Handle(TCollection_HAsciiString) aLabel=igesEntity->ShortLabel();
aName=QString(aLabel->ToCString());
}

Quantity_Color aColor(Quantity_NOC_BLUE1);
if (igesEntity->RankColor()>-1)
aColor=ConvertRankColor(igesEntity->RankColor());
KeepObjectSomewhere(aShape,aColor,aLevel,aName);
isTransfered=Standard_True;
}
}
}

// not transfered
if (isTransfered==Standard_False) {
// do something
}
}
}

Harish's picture

Thanks for posting the sample code.
I use OCC 6.3.0. Version with Standard IGES classes, I even tried using the code you posted but still having the same issue. I’m not very sure the issue will get resolved when I upgrade to OCC 6.5.0 as the sample Import export application of OCC 6.5.0 has mentioned issues while reading the attached IGES file.
Is there a patch available to fix IGES import? Are you using any advance IGES classes? I’m very eager to know how you could fix this issue in your in-house software.

Francois Lauzon's picture

Hello Harish,
I did forgot one line, which is:

Interface_Static::SetIVal("read.surfacecurve.mode",3);

if you need more information about what this import parameter is doing, read the iges.pdf file at page 11...

Sorry I missed that line.
In fact, if you add the two line bellow (in the file Translate.cxx at the beginning of the Translate::importIGES method) to the Qt Import/Export sample, your file will import correctly.

IGESControl_Controller::Init();
Interface_Static::SetIVal("read.surfacecurve.mode",3);

Good Luck,
Francois.

Harish's picture

Thank you for the advice, Francois.

It solved the problem. I really appreciate your detailed and quick response.

Thanks,
Harish

AGPX's picture

Hi,

I have tried your code with the attached .IGES, but the colors (yellow) isn't applied. Can you please help me? Thank you very much.

Attachments: 
Forum supervisor's picture

Hi Harish,

I would like to inform you that the posted problem is checked and reproduced.
The corresponding issue with ID = OCC22566 has been registered.
Later you can know if the issue is resolved by checking references to the specified ID in OCCT Release Notes. The analysis of the issue will take some time depending on our technical capability and availability of resources.
If you can't wait and the problem is urgent for you, you may contact us via Contact Form http://www.opencascade.org/about/contacts/.
We will try to find a solution/workaround acceptable for you.
As well as training and e-learning courses are at your disposal - http://www.opencascade.org/support/training/.
Regards