MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0031504Open CASCADE[OCCT] OCCT:Data Exchangepublic2020-04-17 10:302020-05-28 11:11
Reporteravn 
Assigned Togka 
PrioritynormalSeverityminor 
StatusresolvedResolutionopen 
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 number
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

-  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

- 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


Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker