0025092: COMPSOLIDs are not exported to STEP
authorika <ika@opencascade.com>
Thu, 24 Jul 2014 09:06:30 +0000 (13:06 +0400)
committerbugmaster <bugmaster@opencascade.com>
Thu, 24 Jul 2014 09:08:13 +0000 (13:08 +0400)
Now COMPSOLID is translated like a set of SOLIDs.

Test cases for issue CR25092

src/STEPControl/STEPControl_ActorWrite.cxx
tests/bugs/step/bug25092 [new file with mode: 0755]

index 8ee57c7..d7cd779 100644 (file)
@@ -827,14 +827,23 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran
   else if (theShape.ShapeType() == TopAbs_FACE) {
     RepItemSeq->Append(TopoDS::Face(theShape));
   }
+  else if (theShape.ShapeType() == TopAbs_COMPSOLID) {
+    FP->AddWarning(start,"NonManifold COMPSOLID was translated like a set of SOLIDs");
+    if ( GroupMode() > 0)
+      return TransferCompound(start, SDR0, FP);
+    else {
+      TopExp_Explorer SolidExp;
+      for (SolidExp.Init(theShape, TopAbs_SOLID);
+           SolidExp.More();SolidExp.Next()) {
+        RepItemSeq->Append(TopoDS::Solid(SolidExp.Current()));
+      }
+    }
+  }
+
   else if (mymode != STEPControl_GeometricCurveSet && mymode != STEPControl_AsIs) {
     FP->AddFail(start,"The Shape is not a SOLID, nor a SHELL, nor a FACE");
     return binder;
   }
-  else if (theShape.ShapeType() == TopAbs_COMPSOLID) {
-    FP->AddWarning(start, "COMPSOLID is not exported yet"); 
-    return binder;
-  }
   else RepItemSeq->Append (theShape);
 
   //    COMPUTING 3D TOLERANCE
diff --git a/tests/bugs/step/bug25092 b/tests/bugs/step/bug25092
new file mode 100755 (executable)
index 0000000..8130e1e
--- /dev/null
@@ -0,0 +1,14 @@
+puts "============"
+puts "OCC25092"
+puts "============"
+puts ""
+#######################################################################
+# COMPSOLIDs are not exported to STEP
+#######################################################################
+
+restore [locate_data_file bug25092_compsolid.brep] b 
+
+set aFile ${imagedir}/bug25092.stp
+catch { file delete ${aFile} }
+
+stepwrite 0 b ${aFile}