IGES writer 128 vs 144

It appears that when I load a model into OCCT using IGESCAFControl_Reader and then export the model using IGESCAFControl_Writer, that each non-trimmed NURBS surface (IGES 128 entity) in the original model is converted to a trimmed NURBS surface (IGES 144) in the output file. The trimming curves of each trimmed NURB are the edges of the original surface.

While this is geometrically correct, and I can understand from the OCCT point of view why its better to map faces to trimmed surfaces and edges to trimming curves, it is computationally undesirable for my application because trimmed NURBS surfaces are much more expensive for our simulation engine to process. Is there a way to disable or prevent this conversion for NURBS surfaces that are originally not trimmed? Specifically, is there a way to write an IGES file so that it contains the same number of trimmed surfaces and non-trimmed surfaces as the file that was originally read?

Is this behavior different between IGESControl_* classes and IGESCAFControl_* classes?

Thanks,
Tod Courtney

Roman Lygin's picture

Tod,

As you correctly understood, when converting OCC TopoDS_Face to IGES, the IGES writer saves both underlying surface and a boundary TopoDS_Wire. Thus, you get type 144.
If you only need to convert a surface you could probably try to work around this by using IGESControl_Writer::AddGeom() specifying Geom_Surface. You should likely be able to mix several calls of AddGeom() and ::AddShape().

If you have to deal from the XDE level (using IGESCAFControl_Writer) it will be more challenging - you will need to take care of maintaining a correspondence between contents of the XDE document and faces/surfaces. You might need to subclass _Writer class and reimplement Transfer().

By the way, a likely hint to recognize a TopoDS_Face built on a full NURBS could be using BRep_Tool::NaturalRestriction().

Hope this helps.
Roman

Tod Courtney's picture

thanks Roman. I think BRep_Tool::NaturalRestriction() is what I want. I can read the IGES file in using the normal approach and only need to use the trimming curves when NaturalRestriction() is false.