diff --git a/dox/user_guides/step/step.md b/dox/user_guides/step/step.md index 5d6b238dce..1317b030d3 100644 --- a/dox/user_guides/step/step.md +++ b/dox/user_guides/step/step.md @@ -863,6 +863,22 @@ See description of parameter read.step.resource.name above for more details on u Default values: * read.step.resource.name - STEP, * read.step.sequence - ToSTEP. + +

write.step.vertex.mode

+This parameter indicates which of free vertices writing mode is switch on. +* 0 (One Compound) : (default) All free vertices are united into one compound and exported in one SHAPE DEFINITION REPRESENTATION (vertex name and style are lost). +* 1 (Single Vertex) : Each vertex exported in its own SHAPE DEFINITION REPRESENTATION (vertex name and style are not lost, but size of STEP file increases). + +Read this parameter with: +~~~~~ +Standard_Integer ic = Interface_Static::IVal("write.step.vertex.mode"); +~~~~~ +Modify this parameter with: +~~~~~ +if(!Interface_Static::SetIVal("write.step.vertex.mode",1)) +.. error .. +~~~~~ +Default value is 0. @subsubsection occt_step_3_3_3 Performing the Open CASCADE Technology shape translation An OCCT shape can be translated to STEP using one of the following models (shape_representations): diff --git a/src/QABugs/QABugs_19.cxx b/src/QABugs/QABugs_19.cxx index aa5c34d64b..e108b6fc8d 100755 --- a/src/QABugs/QABugs_19.cxx +++ b/src/QABugs/QABugs_19.cxx @@ -1806,8 +1806,8 @@ static Standard_Integer OCC23951 (Draw_Interpretor& di, Standard_Integer argc, c //======================================================================= static Standard_Integer OCC23950 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { - if (argc != 1) { - di << "Usage: " << argv[0] << " invalid number of arguments" << "\n"; + if (argc != 2) { + di << "Usage : " << argv[0] << " step_file\n"; return 1; } @@ -1837,7 +1837,7 @@ static Standard_Integer OCC23950 (Draw_Interpretor& di, Standard_Integer argc, c return 1; } - writer.Write ("test_point_assembly.step"); + writer.Write (argv[1]); return 0; } @@ -2687,7 +2687,7 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) { theCommands.Add ("OCC23951", "OCC23951", __FILE__, OCC23951, group); theCommands.Add ("OCC24931", "OCC24931", __FILE__, OCC24931, group); theCommands.Add ("OCC24945", "OCC24945", __FILE__, OCC24945, group); - theCommands.Add ("OCC23950", "OCC23950", __FILE__, OCC23950, group); + theCommands.Add ("OCC23950", "OCC23950 step_file", __FILE__, OCC23950, group); theCommands.Add ("OCC25004", "OCC25004", __FILE__, OCC25004, group); theCommands.Add ("OCC24925", "OCC24925 filename [pluginLib=TKXml storageGuid retrievalGuid]" diff --git a/src/STEPControl/STEPControl_ActorWrite.cxx b/src/STEPControl/STEPControl_ActorWrite.cxx index d7cd779b2e..efc1b6181c 100644 --- a/src/STEPControl/STEPControl_ActorWrite.cxx +++ b/src/STEPControl/STEPControl_ActorWrite.cxx @@ -524,17 +524,19 @@ Standard_Boolean STEPControl_ActorWrite::IsAssembly (TopoDS_Shape &S) const { if ( ! GroupMode() || S.ShapeType() != TopAbs_COMPOUND ) return Standard_False; // PTV 16.09.2002 OCC725 for storing compound of vertices - if (S.ShapeType() == TopAbs_COMPOUND ) { - Standard_Boolean IsOnlyVertices = Standard_True; - TopoDS_Iterator anItr( S ); - for ( ; anItr.More(); anItr.Next() ) { - if ( anItr.Value().ShapeType() != TopAbs_VERTEX ) { - IsOnlyVertices = Standard_False; - break; + if (Interface_Static::IVal("write.step.vertex.mode") == 0) {//bug 23950 + if (S.ShapeType() == TopAbs_COMPOUND ) { + Standard_Boolean IsOnlyVertices = Standard_True; + TopoDS_Iterator anItr( S ); + for ( ; anItr.More(); anItr.Next() ) { + if ( anItr.Value().ShapeType() != TopAbs_VERTEX ) { + IsOnlyVertices = Standard_False; + break; + } } + if ( IsOnlyVertices ) + return Standard_False; } - if ( IsOnlyVertices ) - return Standard_False; } if ( GroupMode() ==1 ) return Standard_True; TopoDS_Iterator it ( S ); @@ -756,6 +758,8 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran // create a list of items to translate Handle(TopTools_HSequenceOfShape) RepItemSeq = new TopTools_HSequenceOfShape(); + Standard_Boolean isSeparateVertices = + Interface_Static::IVal("write.step.vertex.mode") == 0;//bug 23950 // PTV 16.09.2002 OCC725 separate shape from solo vertices. Standard_Boolean isOnlyVertices = Standard_False; if (theShape.ShapeType() == TopAbs_COMPOUND) { @@ -766,24 +770,26 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran aB.MakeCompound(aNewShape); aB.MakeCompound(aCompOfVrtx); TopoDS_Iterator anCompIt(theShape); - for (; anCompIt.More(); anCompIt.Next()) { - TopoDS_Shape aCurSh = anCompIt.Value(); - if (aCurSh.ShapeType() != TopAbs_VERTEX) { - aB.Add(aNewShape, aCurSh); - countSh++; - } - else { - aB.Add(aCompOfVrtx, aCurSh); - countVrtx++; + if (isSeparateVertices) { + for (; anCompIt.More(); anCompIt.Next()) { + TopoDS_Shape aCurSh = anCompIt.Value(); + if (aCurSh.ShapeType() != TopAbs_VERTEX) { + aB.Add(aNewShape, aCurSh); + countSh++; + } + else { + aB.Add(aCompOfVrtx, aCurSh); + countVrtx++; + } } + // replace the shapes + if (countSh) + theShape = aNewShape; + if (countVrtx) + RepItemSeq->Append(aCompOfVrtx); + if (countSh == 0) + isOnlyVertices = Standard_True; } - // replace the shapes - if (countSh) - theShape = aNewShape; - if (countVrtx) - RepItemSeq->Append(aCompOfVrtx); - if (countSh == 0) - isOnlyVertices = Standard_True; } if (theShape.ShapeType() == TopAbs_COMPOUND) { @@ -1280,6 +1286,8 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound (const Handle(T Handle(TopTools_HSequenceOfShape) RepItemSeq = new TopTools_HSequenceOfShape(); // Prepare a collection for non-manifold group of shapes Handle(TopTools_HSequenceOfShape) NonManifoldGroup = new TopTools_HSequenceOfShape(); + Standard_Boolean isSeparateVertices = + (Interface_Static::IVal("write.step.vertex.mode") == 0);//bug 23950 // PTV OCC725 17.09.2002 -- begin -- Standard_Integer nbFreeVrtx = 0; TopoDS_Compound aCompOfVrtx; @@ -1293,7 +1301,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound (const Handle(T for (TopoDS_Iterator iter(theShape); iter.More(); iter.Next()) { TopoDS_Shape aSubShape = iter.Value(); - if (aSubShape.ShapeType() != TopAbs_VERTEX) { + if (aSubShape.ShapeType() != TopAbs_VERTEX || !isSeparateVertices) { // Store non-manifold topology as shells (ssv; 10.11.2010) if (!isManifold && aSubShape.ShapeType() == TopAbs_SOLID) { diff --git a/src/STEPControl/STEPControl_Controller.cxx b/src/STEPControl/STEPControl_Controller.cxx index e6e3f2188c..fe9f6b8700 100644 --- a/src/STEPControl/STEPControl_Controller.cxx +++ b/src/STEPControl/STEPControl_Controller.cxx @@ -177,6 +177,14 @@ STEPControl_Controller::STEPControl_Controller () Interface_Static::Init ("step","read.step.ideas",'&',"eval Off"); Interface_Static::Init ("step","read.step.ideas",'&',"eval On"); Interface_Static::SetIVal("read.step.ideas",0); + + //Parameter to write all free vertices in one SDR (name and style of vertex are lost) (default) + //or each vertex in its own SDR (name and style of vertex are exported). (ika; 21.07.2014) + Interface_Static::Init ("step","write.step.vertex.mode",'e',""); + Interface_Static::Init ("step","write.step.vertex.mode",'&',"enum 0"); + Interface_Static::Init ("step","write.step.vertex.mode",'&',"eval One Compound"); + Interface_Static::Init ("step","write.step.vertex.mode",'&',"eval Single Vertex"); + Interface_Static::SetIVal("write.step.vertex.mode",0); // abv 15.11.00: ShapeProcessing Interface_Static::Init ("XSTEP","write.step.resource.name",'t',"STEP"); diff --git a/tests/bugs/xde/bug23950 b/tests/bugs/xde/bug23950 index 263ef1c879..753467a621 100644 --- a/tests/bugs/xde/bug23950 +++ b/tests/bugs/xde/bug23950 @@ -1,5 +1,3 @@ -puts "TODO OCC23950 ALL: ERROR: OCC23950 is reproduced" - puts "==========" puts "OCC23950" puts "==========" @@ -10,7 +8,14 @@ puts "" pload QAcommands -set info [OCC23950] +#switch on writing of vertices names and styles +param write.step.vertex.mode 1 + +set aFile ${imagedir}/bug23950.step + +catch {file delete ${aFile}} + +set info [OCC23950 ${aFile}] if {[regexp "Write Done" $info] != 1} { puts "Error: file was not written" @@ -19,7 +24,7 @@ if {[regexp "Write Done" $info] != 1} { } set is23950fixed "FALSE" -set file23950 [open test_point_assembly.step RDONLY] +set file23950 [open ${aFile} RDONLY] while {[eof $file23950] == 0} { set file23950line [string trim [gets $file23950]] if {[string first "Point1" $file23950line] != -1} { @@ -31,3 +36,6 @@ close $file23950 if {[string compare $is23950fixed "FALSE"] == 0} { puts "ERROR: OCC23950 is reproduced" } + +#return default behavior +param write.step.vertex.mode 0