MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0031504Open CASCADE[OCCT] OCCT:Data Exchangepublic2020-04-17 10:302020-06-20 13:42
Reporteravn 
Assigned Tobugmaster 
PrioritynormalSeverityminor 
StatusverifiedResolutionfixed 
PlatformWindowsOSVC++ 2013OS Version64 bit
Product Version[OCCT] 7.4.0 
Target Version[OCCT] 7.5.0*Fixed in Version 
Summary0031504: Data Exchange - Wrong output of progress indicator when writing to stl.
DescriptionThe function below allows you to read data from a file with the stl extension and write this data to a new file with the stl extension. In this case, the progress indicator is fed only to the input RWStl::WriteAscii.

#include <Draw_ProgressIndicator.hxx>
#include <RWStl.hxx>

static Standard_Integer DRAW_ReWriteSTL(Draw_Interpretor& theDI, Standard_Integer theArgc, const 
char** theArgv)
{
  TCollection_AsciiString aFilePathToRead  = theArgv[1];
  TCollection_AsciiString aFilePathToWrite = theArgv[2];
  if ( aFilePathToRead.IsEmpty() || aFilePathToWrite.IsEmpty() )
    return 1;
  //
  // Read STL file to the triangulation.
  Handle(Poly_Triangulation) aTriangulation = RWStl::ReadFile (aFilePathToRead.ToCString(), NULL);
  //
  //
  // Indicator.
  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI, 1);
  aProgress->SetTextMode(true);
  //
  // Write to STL.
  OSD_Path aPath (aFilePathToWrite.ToCString());
  if ( !RWStl::WriteAscii (aTriangulation, aPath, aProgress) )
    return 1; // Success
  //
  return 0;
}


theCommands.Add("rewrite_stl",
                "rewrite_stl filenameToRead filenameToWrite",
                __FILE__, DRAW_ReWriteSTL, grp);


Execute the command "rewrite_stl C:/dev_cad_party/wright_whirlwind_radial_engine_occ.stl C:/dev_cad_party/NEW_wright_whirlwind_radial_engine_occ.stl" on wright_whirlwind_radial_engine_occ.stl (attached to the problem). When writing, we have the output presented on write.png (attached to the task).

Bug: the progress indicator showed that it performed 3% (1000/36512) when writing, but in fact the model was completely recorded. We also see that 1000 triangles are loaded, although there should be 2000.

Note, if you submit the progress indicator to read, then we get the output presented on read.png.

A possible reason for this behavior (one of the following):

1. Incorrect call of the Next() method at aPS (Message_ProgressSentry) in the RWStl.cxx file. You can call the following Next: Next(const Standard_Real span, const Standard_CString name) with span = IND_THRESHOLD (RWStl.cxx).

2. Wrong step (the i index of myScopes(i) is incorrectly chosen) in Message_ProgressIndicator::NextScope() in the Message_ProgressIndicator.lxx file.

3. Error in the Message_ProgressIndicator::NextScope() method (file - Message_ProgressIndicator.cxx) when calling BaseToLocal - LocalToBase.
Steps To ReproduceExecute the command "rewrite_stl C:/dev_cad_party/wright_whirlwind_radial_engine_occ.stl C:/dev_cad_party/NEW_wright_whirlwind_radial_engine_occ.stl" on wright_whirlwind_radial_engine_occ.stl

Bug: the progress indicator showed that it performed 3% (1000/36512) when writing, but in fact the model was completely recorded. We also see that 1000 triangles are loaded, although there should be 2000.

#include <Draw_ProgressIndicator.hxx>
#include <RWStl.hxx>

static Standard_Integer DRAW_ReWriteSTL(Draw_Interpretor& theDI, Standard_Integer theArgc, const 
char** theArgv)
{
  TCollection_AsciiString aFilePathToRead  = theArgv[1];
  TCollection_AsciiString aFilePathToWrite = theArgv[2];
  if ( aFilePathToRead.IsEmpty() || aFilePathToWrite.IsEmpty() )
    return 1;
  //
  // Read STL file to the triangulation.
  Handle(Poly_Triangulation) aTriangulation = RWStl::ReadFile (aFilePathToRead.ToCString(), NULL);
  //
  //
  // Indicator.
  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI, 1);
  aProgress->SetTextMode(true);
  //
  // Write to STL.
  OSD_Path aPath (aFilePathToWrite.ToCString());
  if ( !RWStl::WriteAscii (aTriangulation, aPath, aProgress) )
    return 1; // Success
  //
  return 0;
}

theCommands.Add("rewrite_stl",
                "rewrite_stl filenameToRead filenameToWrite",
                __FILE__, DRAW_ReWriteSTL, grp);
TagsNo tags attached.
Test case numberde_mesh/shape_write_stl/B1
Attached Files? file icon wright_whirlwind_radial_engine_occ.stl (9,931,282 bytes) 2020-04-17 10:30
png file icon write.png (6,668 bytes) 2020-04-17 10:31
png file icon read.png (22,857 bytes) 2020-04-17 10:31

- Relationships
related to 0025748resolvedmsv Foundation Classes - Parallel version of progress indicator 

-  Notes
(0092136)
szy (developer)
2020-05-15 11:55

start it, please.
(0092305)
git (administrator)
2020-05-22 17:40

Branch CR31504 has been created by akaftasev.

SHA-1: 387fc74b4984bb4ac354260b286396b30cd4a51b


Detailed log of new commits:

Author: akaftasev
Date: Fri May 22 17:07:12 2020 +0300

    resolve problem with incomplete indicator output

Author: akaftasev
Date: Fri May 22 13:04:49 2020 +0300

    add commands rewrite
(0092345)
git (administrator)
2020-05-26 14:28

Branch CR31504 has been updated by akaftasev.

SHA-1: 3584b5dd376f8bbaeb0f5b015b9bc7343ffaeef4


Detailed log of new commits:

Author: akaftasev
Date: Tue May 26 14:29:07 2020 +0300

    change condition

(0092346)
git (administrator)
2020-05-26 14:31

Branch CR31504 has been updated forcibly by akaftasev.

SHA-1: fe11ecfb6513bc975ee3e9d23f31e6380a0b6fc2
(0092348)
git (administrator)
2020-05-26 19:10

Branch CR31504 has been updated by akaftasev.

SHA-1: 87784d9612ed91d1bbbe52ea2bc5c531d285167f


Detailed log of new commits:

Author: akaftasev
Date: Tue May 26 19:11:12 2020 +0300

    change tests for new condition

(0092362)
git (administrator)
2020-05-27 16:52

Branch CR31504 has been updated by akaftasev.

SHA-1: a7146a343cb3ed7699f966e869edb9c7b912e358


Detailed log of new commits:

Author: akaftasev
Date: Wed May 27 16:50:22 2020 +0300

    add test for this bug

(0092380)
git (administrator)
2020-05-28 11:09

Branch CR31504 has been updated forcibly by akaftasev.

SHA-1: cd330b037e10b9d285cd0c6847a607a9e77bb595
(0092444)
gka (developer)
2020-06-02 12:20

Branch CR31504 was reviewed
(0092465)
git (administrator)
2020-06-03 17:47

Branch CR31504 has been updated by akaftasev.

SHA-1: 31a453f5067eacbbb6bd72cc8a3c3766d92db4d9


Detailed log of new commits:

Author: kgv
Date: Thu May 28 19:42:13 2020 +0300

    0031477: Visualization, TKOpenGl - fetch/wrap getBufferSubData() function from WebGL 2.0
    
    Added OpenGl_Context::GetBufferSubData() implementing getBufferSubData() based on capabilities of various APIs.
    Added OpenGl_VertexBuffer::GetSubData() similar to OpenGl_VertexBuffer::SubData().

Author: kgv
Date: Wed May 27 20:46:34 2020 +0300

    0031583: Visualization, OpenGl_Context - load OpenGL ES 3.0 functions
    
    OpenGl_Context now retrieves complete functions sets of OpenGL ES 3.0, 3.1 and 3.2.

Author: vsv
Date: Wed May 20 15:50:15 2020 +0300

    0031573: Visualization - Do not show seam edge for shading presentation with boundary edges in VTK

Author: kgv
Date: Wed May 27 13:36:17 2020 +0300

    0031580: Visualization, TKOpenGl - cubemap initialization error on OpenGL ES 2.0
    
    OpenGl_Texture::InitCubeMap() now avoids using sized internal format in case of GLES2.
    OpenGl_Sampler::applySamplerParams() now checks OpenGL version before setting GL_TEXTURE_WRAP_R.

Author: mkrylova
Date: Fri May 15 13:54:26 2020 +0300

    0029917: Foundation Classes - OSD_FileNode AccessMoment and CreationMoment return the same date on Windows
    
    fAccess in CreationMoment() function for Windows has been modified from TRUE to FALSE

(0092471)
kgv (developer)
2020-06-04 10:28
edited on: 2020-06-04 10:30

   theCommands.Add("OCC31294", "OCC31294", __FILE__, OCC31294, group);
+  theCommands.Add("rewrite_stl",

Commands within TKQADraw are expected to be bug-prefixed, not free-form.
Anyway, it doesn't look that this command belongs to TKQADraw at all.
Please move it to XSDRAWSTLVRML.cxx, rename to "writestl" with syntax "writestl shape file" and proper checks - see writegltf as example in the same file.
The command then should not include "aProgress->SetTclOutput(Standard_True);" - this should be enabled via another Draw Harness command in test script.

-    if ((aTriIter % IND_THRESHOLD) == 0)
+    if ((aTriIter % IND_THRESHOLD) == 0 && aPS.More())

The place for aPS.More() is incorrect - aPS.More() is expected to be used for aborting progress instead of preventing progress updates.
It could be put inside if((aTriIter % IND_THRESHOLD) == 0) condition and properly abort the loop.

-    // if scope has subscopes, print end of subscope as its current position
-    Standard_Real locPos = ( i >1 ? GetScope ( i-1 ).GetLast() : GetPosition() );
+    // if scope has subscopes, print end of subscope as it s current position
+    Standard_Real locPos = ( (i >1 && GetPosition()!=0) ? GetScope ( i-1 ).GetLast() : GetPosition() 
);
...
-  {Progress: 0% Outer: 1 / 3}
+  {Progress: 0% Outer: 0 / 3}

Please provide more detailed description in commit for this change, e.g. describe that indication has been changed to report 0 instead of 1 for first step. This change looks unrelated to this bug.

(0092481)
git (administrator)
2020-06-04 13:33

Branch CR31504 has been updated by akaftasev.

SHA-1: ead524da13ff023ef792181391f43622be07d9d1


Detailed log of new commits:

Author: akaftasev
Date: Thu Jun 4 13:34:33 2020 +0300

    Merge branch 'CR31504' of ssh://dev.opencascade.org/occt [^] into CR31504

Author: akaftasev
Date: Fri May 22 13:04:49 2020 +0300

    0031504: Data Exchange - Wrong output of progress indicator when writing to stl
    
    add new condition for first indicated element
    change usage of Next() to Next(step)
    add test

(0092482)
git (administrator)
2020-06-04 13:34

Branch CR31504 has been updated forcibly by akaftasev.

SHA-1: cd330b037e10b9d285cd0c6847a607a9e77bb595
(0092483)
git (administrator)
2020-06-04 13:36

Branch CR31504 has been updated forcibly by akaftasev.

SHA-1: 81f02382c995fa7d72db29b96936c0f88e556789
(0092488)
git (administrator)
2020-06-05 14:28

Branch CR31504 has been updated forcibly by akaftasev.

SHA-1: 41dbc48947b818ac744a90eb7b7c0acb74fbb750
(0092490)
git (administrator)
2020-06-05 15:59

Branch CR31504 has been updated forcibly by akaftasev.

SHA-1: b4c74d2a5a144b59267309d8ae6c4abd419668f5
(0092491)
git (administrator)
2020-06-05 16:58

Branch CR31504 has been updated forcibly by akaftasev.

SHA-1: a5b70db256913fbd75307bbd12004ad90025aacd
(0092492)
git (administrator)
2020-06-05 17:14

Branch CR31504 has been updated forcibly by akaftasev.

SHA-1: 9fb1fbca168e7a9272a4306032daa336aa0241cb
(0092612)
git (administrator)
2020-06-20 13:42

Branch CR31504 has been deleted by inv.

SHA-1: 9fb1fbca168e7a9272a4306032daa336aa0241cb

- Related Changesets
occt: master 1fc1a207
Timestamp: 2020-05-22 10:04:49
Author: akaftasev
Committer: bugmaster
Details ] Diff ]
0031504: Data Exchange - Wrong output of progress indicator when writing to stl

Added new condition for first indicated element at Draw_ProgressIndicator::Show(),
because it’s more logical that at start progress starts at 0
Changed usage of Next() to Next(step) for increment progress to IND_THRESHOLD in RWStl::writeASCII() and RWStl::writeBinary()
Changed condition for continuation of writing and add interrupt to this function
Added possibility to use Progress indicator in writestl
Changed paremeter in constructor Message_ProgressSentry aPS() IND_THRESHOLD to 1
Changed test
mod - src/Draw/Draw_ProgressIndicator.cxx Diff ] File ]
mod - src/RWStl/RWStl.cxx Diff ] File ]
mod - src/StlAPI/StlAPI_Writer.cxx Diff ] File ]
mod - src/StlAPI/StlAPI_Writer.hxx Diff ] File ]
mod - src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx Diff ] File ]
mod - tests/bugs/fclasses/bug28478 Diff ] File ]
mod - tests/bugs/fclasses/bug31092 Diff ] File ]
add - tests/de_mesh/shape_write_stl/B1 Diff ] File ]

- Issue History
Date Modified Username Field Change
2020-04-17 10:30 avn New Issue
2020-04-17 10:30 avn Assigned To => gka
2020-04-17 10:30 avn File Added: wright_whirlwind_radial_engine_occ.stl
2020-04-17 10:31 avn File Added: write.png
2020-04-17 10:31 avn File Added: read.png
2020-04-17 10:37 avn Description Updated View Revisions
2020-04-17 10:37 avn Steps to Reproduce Updated View Revisions
2020-04-29 14:47 utverdov Assigned To gka => akaftasev
2020-05-08 00:11 kgv Summary Wrong output of progress indicator when writing to stl. => Data Exchange - Wrong output of progress indicator when writing to stl.
2020-05-08 00:11 kgv Description Updated View Revisions
2020-05-08 00:11 kgv Steps to Reproduce Updated View Revisions
2020-05-15 11:55 szy Note Added: 0092136
2020-05-15 11:55 szy Status new => assigned
2020-05-22 17:40 git Note Added: 0092305
2020-05-26 14:28 git Note Added: 0092345
2020-05-26 14:31 git Note Added: 0092346
2020-05-26 19:10 git Note Added: 0092348
2020-05-27 11:43 akaftasev Assigned To akaftasev => gka
2020-05-27 11:43 akaftasev Status assigned => resolved
2020-05-27 14:44 akaftasev Assigned To gka => akaftasev
2020-05-27 14:44 akaftasev Status resolved => assigned
2020-05-27 16:52 git Note Added: 0092362
2020-05-28 11:09 git Note Added: 0092380
2020-05-28 11:11 akaftasev Assigned To akaftasev => gka
2020-05-28 11:11 akaftasev Status assigned => resolved
2020-06-02 12:20 gka Note Added: 0092444
2020-06-02 12:20 gka Assigned To gka => bugmaster
2020-06-02 12:20 gka Status resolved => reviewed
2020-06-03 17:47 git Note Added: 0092465
2020-06-04 10:28 kgv Note Added: 0092471
2020-06-04 10:28 kgv Assigned To bugmaster => akaftasev
2020-06-04 10:28 kgv Status reviewed => assigned
2020-06-04 10:30 kgv Note Edited: 0092471 View Revisions
2020-06-04 13:33 git Note Added: 0092481
2020-06-04 13:34 git Note Added: 0092482
2020-06-04 13:36 git Note Added: 0092483
2020-06-05 14:28 git Note Added: 0092488
2020-06-05 15:59 git Note Added: 0092490
2020-06-05 16:58 git Note Added: 0092491
2020-06-05 17:14 git Note Added: 0092492
2020-06-05 17:21 akaftasev Assigned To akaftasev => kgv
2020-06-05 17:21 akaftasev Status assigned => resolved
2020-06-05 17:22 kgv Assigned To kgv => bugmaster
2020-06-05 17:22 kgv Status resolved => reviewed
2020-06-05 17:23 kgv Relationship added related to 0025748
2020-06-14 10:52 bugmaster Changeset attached => occt master 1fc1a207
2020-06-14 10:52 bugmaster Status reviewed => verified
2020-06-14 10:52 bugmaster Resolution open => fixed
2020-06-14 10:57 bugmaster Test case number => de_mesh/shape_write_stl/B1
2020-06-20 13:42 git Note Added: 0092612


Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker