#include <TDF_ChildIterator.hxx>
#include <TDataStd_Name.hxx>
#include <IGESData_NameEntity.hxx>
+#include <IGESSolid_Face.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TColStd_HSequenceOfExtendedString.hxx>
#include <NCollection_DataMap.hxx>
// analyze whether current entity should get a color
Standard_Boolean hasColor = Standard_False;
Quantity_Color col;
- if ( S.ShapeType() == TopAbs_FACE ) {
+ if ( S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SOLID) {
if ( style.IsSetColorSurf() ) {
hasColor = Standard_True;
col = style.GetColorSurf();
Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FP, S );
if ( FP->FindTypedTransient ( mapper, STANDARD_TYPE(IGESData_IGESEntity), ent ) ) {
ent->InitColor ( colent, rank );
+ Handle(IGESSolid_Face) ent_f = Handle(IGESSolid_Face)::DownCast(ent);
+ if (!ent_f.IsNull())
+ {
+ if (!ent_f->Surface().IsNull())
+ ent_f->Surface()->InitColor ( colent, rank );
+ }
}
else {
// may be S was splited during shape process
for (i=1; i<=nb; i++) {
Handle(Standard_Transient) t = TransientListBinder->Transient(i);
ent = Handle(IGESData_IGESEntity)::DownCast(t);
- if (!ent.IsNull()) ent->InitColor ( colent, rank );
+ if (!ent.IsNull())
+ {
+ ent->InitColor ( colent, rank );
+ Handle(IGESSolid_Face) ent_f = Handle(IGESSolid_Face)::DownCast(ent);
+ if (!ent_f.IsNull())
+ {
+ if (!ent_f->Surface().IsNull())
+ ent_f->Surface()->InitColor ( colent, rank );
+ }
+ }
}
}
/* // alternative: consider recursive mapping S -> compound -> entities
--- /dev/null
+puts "========"
+puts "OCC25518"
+puts "========"
+puts ""
+######################################
+# Colors are not written to IGES 5.3
+######################################
+
+catch {exec rm ${imagedir}/OCC25518.igs}
+psphere s 10
+XNewDoc D
+XAddShape D s
+XSetColor D s 0 0 1
+param write.iges.brep.mode 1
+WriteIges D ${imagedir}/OCC25518.igs
+ReadIges T ${imagedir}/OCC25518.igs
+if {[string trim [XGetAllColors T]] != "BLUE1"} {
+ puts "ERROR: OCC25518 is reproduced. Color is lost."
+}
+XShow T
+vfit
+vsetdispmode 1
+set only_screen 1