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-22 17:40
Reporteravn 
Assigned Toakaftasev 
PrioritynormalSeverityminor 
StatusassignedResolutionopen 
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

- 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


Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker