0023379: Exporting single point into STEP produces a compound with two points
authorika <ika@opencascade.com>
Fri, 23 Nov 2012 10:57:23 +0000 (14:57 +0400)
committerika <ika@opencascade.com>
Fri, 23 Nov 2012 10:57:23 +0000 (14:57 +0400)
Adding single vertex for second time was removed.
Adding single vertex in first time was removed, but for second time was returned.
Duplication of vertex compound in STEPControl_GeometricCurveSet mode was removed.
Some cosmetic changes
Test case for this bug

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

index 3d8c29d..e2c499b 100755 (executable)
@@ -760,6 +760,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran
   Handle(TopTools_HSequenceOfShape) RepItemSeq = new TopTools_HSequenceOfShape();
   
   // PTV 16.09.2002 OCC725 separate shape from solo vertices.
+  Standard_Boolean isOnlyVertices = Standard_False;
   if (theShape.ShapeType() == TopAbs_COMPOUND) {
     Standard_Integer countVrtx = 0;
     Standard_Integer countSh = 0;
@@ -784,11 +785,10 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran
       theShape = aNewShape;
     if (countVrtx)
       RepItemSeq->Append(aCompOfVrtx);
+    if (countSh == 0) 
+      isOnlyVertices = Standard_True;
   } 
-  else if (theShape.ShapeType() == TopAbs_VERTEX)
-    RepItemSeq->Append(theShape); // to translate one vertex
   
-
   if (theShape.ShapeType() == TopAbs_COMPOUND) {
     TopExp_Explorer SolidExp, ShellExp, FaceExp;
     if (mymode != STEPControl_GeometricCurveSet) {
@@ -807,7 +807,8 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran
       }
     }
     else {
-      RepItemSeq->Append(theShape); //:j1
+      if (!isOnlyVertices) 
+        RepItemSeq->Append(theShape); //:j1
     }
     if(mymode == STEPControl_AsIs) {
       TopExp_Explorer WireExp, EdgeExp;
diff --git a/tests/bugs/step/bug23379 b/tests/bugs/step/bug23379
new file mode 100755 (executable)
index 0000000..84eb7e8
--- /dev/null
@@ -0,0 +1,40 @@
+set os $env(os_type)
+if { [string compare $os "windows"] == 0 } {
+#     puts "TODO OCC23561 $os: child process exited abnormally"
+} else {
+    puts "TODO OCC23561 ALL: An exception was caught"
+    puts "TODO OCC23561 ALL: Tcl Exception:"
+    puts "TODO OCC23561 ALL: \\*\\* Exception \\*\\*.*"
+}
+puts "TODO OCC23561 ALL: TEST INCOMPLETE"
+
+puts "================"
+puts "OCC23379"
+puts "================"
+puts ""
+#################################
+# Exporting single point into STEP produces a compound with two points
+#################################
+
+pload XDE
+
+set filedir ${imagedir}
+
+set Name bug23379_point
+set brepFileName ${Name}.brep
+set stepFileName ${imagedir}/${Name}.step
+
+restore [locate_data_file ${brepFileName}] point
+
+stepwrite 0 point ${stepFileName}
+stepread ${stepFileName} a *
+set L [llength [explode a_1]]
+puts "L=$L"
+
+if { ${L} == 1} {
+  puts "OK : Number of points is good"
+} else {
+  puts "Error : Number of points is bad"
+}
+
+catch {exec rm -f ${stepFileName}}