Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
Open CASCADEShowroomGet it!Developer CornerSupport and ProductsAbout us
Technical overview
Areas of use
Advantages
FAQ
Screenshots
Shape factory
Shape gallery
Demonstrations
What's new
System requirements
Download Center
Public license
Documentation
Getting started
Forums
Open Source community
Training and e-learning
A-la Carte Support
Value-added software
Complementary Components
Customer Corner
Company Profile
Marketing Materials
Contact Us
News
Home / Developer Corner / Forums / Usage issues / Iges import issue

Iges import issue

Iges import issue
Harish 2011/06/02 14:08
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

You have to be logged in to download the attached file
François Lauzon 2011/06/02 14:17
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...
You have to be logged in to download the attached file
Harish 2011/06/02 14:43
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?
You have to be logged in to download the attached file
François Lauzon 2011/06/02 15:21
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; j<=aListInit->Length(); 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; i<=igesGroup->NbEntities(); i++) {
               aList->Append(igesGroup->Value(i));
          }
     }
     else {
          aList->Append(aListInit->Value(j));
     }
}

// transfert all the iges entity
for (j=1; j<=aList->Length(); 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 2011/06/03 08:39
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.
François Lauzon 2011/06/03 13:06
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 2011/06/03 15:20
Thank you for the advice, Francois.

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

Thanks,
Harish
AGPX 2011/12/07 20:00
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.
You have to be logged in to download the attached file
Forum supervisor 2011/06/02 15:45
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
 
 
Latest news
  • Open CASCADE Technology 6.6.0 is available for download!
  • Open CASCADE Technology 6.5.5 is available for download!
  • Open CASCADE Technology 6.5.4 is available for download!

  • © OPEN CASCADE 2000 - 2013  |  Search  |  Contacts   |  Site map