From 66d6976f7a8b0b51d47ae1a3a49fab5546b895d8 Mon Sep 17 00:00:00 2001 From: ika <ika@opencascade.com> Date: Fri, 23 Nov 2012 14:57:23 +0400 Subject: [PATCH] 0023379: Exporting single point into STEP produces a compound with two points 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 | 9 ++--- tests/bugs/step/bug23379 | 40 ++++++++++++++++++++++ 2 files changed, 45 insertions(+), 4 deletions(-) create mode 100755 tests/bugs/step/bug23379 diff --git a/src/STEPControl/STEPControl_ActorWrite.cxx b/src/STEPControl/STEPControl_ActorWrite.cxx index 3d8c29d670..e2c499b2d6 100755 --- a/src/STEPControl/STEPControl_ActorWrite.cxx +++ b/src/STEPControl/STEPControl_ActorWrite.cxx @@ -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 index 0000000000..84eb7e8c82 --- /dev/null +++ b/tests/bugs/step/bug23379 @@ -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}}