1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

...

8 Commits

Author SHA1 Message Date
jgv
d0d1cca740 Next version 2017-09-19 15:42:51 +03:00
jgv
b24ec104a3 Next version. 2017-09-19 15:42:50 +03:00
jgv
b3cb806901 Fix of exceptions 2017-09-19 15:42:49 +03:00
jgv
74c323de0a Creation of the test cases for new functionality. 2017-09-19 15:42:48 +03:00
jgv
e178d2fa16 0029003: Implementation of the algorithm for replacing faces in shape with new faces based on other surfaces
Implementation of the algorithm for replacing faces in shape with new faces based on other surfaces - BRepOffsetAPI_PatchFaces.

The algorithm runs the steps similar to 3d Offset algorithm for Join type Intersection (intersection of the faces with neighbors for trimming of the faces by the adjacent faces).
2017-09-19 15:42:47 +03:00
abv
8ee9c2f49a 0029077: Tests - improve command testfile
Command testfile is improved to be more usable by developers for checking data files used by the new test cases before their integration to the test data base:

1. Do not check and do not report problems found in the repo when checking new files -- this check is done only when argument is "-check"

2. Can check a file located in a directory listed in CSF_TestDataPath as new one without it being considered as already in the data base

3. For new BREP files, reports warning if the file contains triangulation, suggesting that it can be removed to minimize the size

4. Can identify the same (by content) file in the data base for the new files in DOS encoding (less than 1 MB)

5. Can detect duplicates among the input files

6. Outputs result in more clear form

7. When loading STL files, uses option "triangulation" to be efficient

Automated Testing System guide is updated to describe command testfile.

Added test demo testsystem testfile
2017-09-07 17:14:55 +03:00
kgv
75744d9c23 0029083: Samples - specify multiple Make jobs within make.sh for Qt sample 2017-09-07 17:08:23 +03:00
bugmaster
d0e5a2e38d 0029050: SKIPPED test cases are no listed in header of summary.html
Adding list of SKIPPED test cases in header of summary.html under header Skipped:, and in the end of text log file
2017-09-07 09:58:04 +03:00
59 changed files with 2539 additions and 1737 deletions

File diff suppressed because one or more lines are too long

View File

@@ -192,7 +192,11 @@ Use prefix <i>bug</i> followed by Mantis issue ID and, if necessary, additional
* If the test case reports error due to an existing problem and the fix is not available, add @ref testmanual_3_6 "TODO" statement for each error to mark it as a known problem. The TODO statements must be specific so as to match the actually generated messages but not all similar errors.
* To check expected output which should be obtained as the test result, add @ref testmanual_3_7 "REQUIRED" statement for each line of output to mark it as required.
* If the test case produces error messages (contained in parse.rules), which are expected in that test and should not be considered as its failure (e.g. test for *checkshape* command), add REQUIRED statement for each error to mark it as required output.
4. If the test uses data file(s) that are not yet present in the test database, it is possible to put them to (sub)directory pointed out by *CSF_TestDataPath* variable for running test. The files should be attached to the Mantis issue corresponding to the tested modification.
4. To check whether the data files needed for the test are already present in the database, use DRAW command *testfile* (see below).
If the data file is already present, use it for new test instead of adding a duplicate.
If the data file(s) are not yet present in the test database, put them to some folder and add it to the environment variable *CSF_TestDataPath* to be found by the test system.
Information on where the data files can be accessed by OCC team for putting to official database should be provided in comment to Mantis issue, clearly indicating how names of the files used by the test script match the actual names of the files.
The simplest way is to attach the data files to the Mantis issue, with the same names as used by the test script.
5. Check that the test case runs as expected (test for fix: OK with the fix, FAILED without the fix; test for existing problem: BAD), and integrate it to the Git branch created for the issue.
Example:
@@ -218,6 +222,33 @@ fixshape result a 0.01 0.01
checkshape result
~~~~~
DRAW command testfile should be used to check the data files being used by the test for possible duplication of content or names.
The command accepts list of paths to files being checked as single argument, and will give conclusion on each of the files, for instance:
~~~~~
Draw[1]> testfile [glob /my/data/path/bug12345*]
Collecting info on test data files repository...
Checking new file(s)...
* /my/data/path/bug12345.brep: duplicate
already present under name bug28773_1.brep
--> //server/occt_tests_data/public/brep/bug28773_1.brep
* /my/data/path/cadso.brep: new file
Warning: DOS encoding detected, consider converting to
UNIX unless DOS line ends are needed for the test
Warning: shape contains triangulation (946 triangles),
consider removing them unless they are needed for the test!
BREP size=201 KiB, nbfaces=33, nbedges=94 -> private
* /my/data/path/case_8_wire3.brep: already present
--> //server/occt_tests_data/public/brep/case_8_wire3.brep
* /my/data/path/case_8_wire4.brep: error
name is already used by existing file
--> //server/occt_tests_data/public/brep/case_8_wire4.brep
~~~~~
@section testmanual_2 Organization of Test Scripts
@subsection testmanual_2_1 General Layout

View File

@@ -3,19 +3,24 @@
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "custom.sh" ]; then
source "custom.sh";
source "custom.sh" $*;
fi
if [ -e "${aSamplePath}/../../../env.sh" ]; then
source "${aSamplePath}/../../../env.sh";
source "${aSamplePath}/../../../env.sh" $*;
fi
if test "${QTDIR}" == ""; then
echo "Environment variable \"QTDIR\" not defined. Define it in \"custom.sh\" script."
exit 1
if [ "${QTDIR}" != "" ]; then
export PATH=${QTDIR}/bin:${PATH}
else
aQMakePath=`which qmake`
echo "Environment variable \"QTDIR\" not defined.. Define it in \"custom.sh\" script."
if [ -x "$aQMakePath" ]; then
echo "qmake from PATH will be used instead."
else
exit 1
fi
fi
host=`uname -s`
export STATION=$host
export PATH=${QTDIR}/bin:${PATH}

View File

@@ -1,13 +1,14 @@
#!/bin/bash
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
cd $aSamplePath
qmake FuncDemo.pro
if [ "$(uname -s)" != "Darwin" ] || [ "$MACOSX_USE_GLX" == "true" ]; then
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
if [ "${CASDEB}" == "d" ]; then
make debug
make -j $aNbJobs debug
else
make release
make -j $aNbJobs release
fi
fi

View File

@@ -2,7 +2,7 @@
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
cd $aSamplePath
aSystem=`uname -s`

View File

@@ -3,20 +3,25 @@
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "custom.sh" ]; then
source "custom.sh";
source "custom.sh" $*;
fi
if [ -e "${aSamplePath}/../../../env.sh" ]; then
source "${aSamplePath}/../../../env.sh";
source "${aSamplePath}/../../../env.sh" $*;
fi
if test "${QTDIR}" == ""; then
echo "Environment variable \"QTDIR\" not defined. Define it in \"custom.sh\" script."
exit 1
if [ "${QTDIR}" != "" ]; then
export PATH=${QTDIR}/bin:${PATH}
else
aQMakePath=`which qmake`
echo "Environment variable \"QTDIR\" not defined.. Define it in \"custom.sh\" script."
if [ -x "$aQMakePath" ]; then
echo "qmake from PATH will be used instead."
else
exit 1
fi
fi
host=`uname -s`
export STATION=$host
export RES_DIR=${aSamplePath}/${STATION}/res
export PATH=${QTDIR}/bin:${PATH}

View File

@@ -1,13 +1,14 @@
#!/bin/bash
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
cd $aSamplePath
qmake IESample.pro
if [ "$(uname -s)" != "Darwin" ] || [ "$MACOSX_USE_GLX" == "true" ]; then
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
if [ "${CASDEB}" == "d" ]; then
make debug
make -j $aNbJobs debug
else
make release
make -j $aNbJobs release
fi
fi

View File

@@ -2,7 +2,7 @@
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
cd $aSamplePath
aSystem=`uname -s`

View File

@@ -3,20 +3,25 @@
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "custom.sh" ]; then
source "custom.sh";
source "custom.sh" $*;
fi
if [ -e "${aSamplePath}/../../../env.sh" ]; then
source "${aSamplePath}/../../../env.sh";
source "${aSamplePath}/../../../env.sh" $*;
fi
if test "${QTDIR}" == ""; then
echo "Environment variable \"QTDIR\" not defined. Define it in \"custom.sh\" script."
exit 1
if [ "${QTDIR}" != "" ]; then
export PATH=${QTDIR}/bin:${PATH}
else
aQMakePath=`which qmake`
echo "Environment variable \"QTDIR\" not defined.. Define it in \"custom.sh\" script."
if [ -x "$aQMakePath" ]; then
echo "qmake from PATH will be used instead."
else
exit 1
fi
fi
host=`uname -s`
export STATION=$host
export RES_DIR=${aSamplePath}/${STATION}/res
export PATH=${QTDIR}/bin:${PATH}

View File

@@ -1,13 +1,14 @@
#!/bin/bash
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
cd $aSamplePath
qmake Tutorial.pro
if [ "$(uname -s)" != "Darwin" ] || [ "$MACOSX_USE_GLX" == "true" ]; then
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
if [ "${CASDEB}" == "d" ]; then
make debug
make -j $aNbJobs debug
else
make release
make -j $aNbJobs release
fi
fi

View File

@@ -2,7 +2,7 @@
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
cd $aSamplePath
aSystem=`uname -s`

View File

@@ -2865,7 +2865,7 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S,
const Standard_Boolean GlobalEnlargeVfirst,
const Standard_Boolean GlobalEnlargeVlast)
{
const Standard_Real coeff = 4.;
const Standard_Real coeff = 2.; //4.;
const Standard_Real TolApex = 1.e-5;
Standard_Boolean SurfaceChange = Standard_False;
@@ -3248,7 +3248,8 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
const Standard_Boolean UpdatePCurve,
const Standard_Boolean enlargeU,
const Standard_Boolean enlargeVfirst,
const Standard_Boolean enlargeVlast)
const Standard_Boolean enlargeVlast,
const Standard_Boolean UseInfini)
{
//---------------------------
// extension de la geometrie.
@@ -3270,8 +3271,20 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
}
S->Bounds (US1,US2,VS1,VS2);
UU1 = VV1 = - TheInfini;
UU2 = VV2 = TheInfini;
if (UseInfini)
{
UU1 = VV1 = - TheInfini;
UU2 = VV2 = TheInfini;
}
else
{
Standard_Real FaceDU = UF2 - UF1;
Standard_Real FaceDV = VF2 - VF1;
UU1 = UF1 - FaceDU;
UU2 = UF2 + FaceDU;
VV1 = VF1 - FaceDV;
VV2 = VF2 + FaceDV;
}
if (CanExtentSurface) {
SurfaceChange = EnlargeGeometry( S, UU1, UU2, VV1, VV2, isVV1degen, isVV2degen, UF1, UF2, VF1, VF2,

View File

@@ -104,7 +104,14 @@ public:
//! if <UpdatePCurve> is TRUE, update the pcurves of the
//! edges of <F> on the new surface.if the surface has been changed,
//! Returns True if The Surface of <NF> has changed.
Standard_EXPORT static Standard_Boolean EnLargeFace (const TopoDS_Face& F, TopoDS_Face& NF, const Standard_Boolean ChangeGeom, const Standard_Boolean UpDatePCurve = Standard_False, const Standard_Boolean enlargeU = Standard_True, const Standard_Boolean enlargeVfirst = Standard_True, const Standard_Boolean enlargeVlast = Standard_True);
Standard_EXPORT static Standard_Boolean EnLargeFace (const TopoDS_Face& F,
TopoDS_Face& NF,
const Standard_Boolean ChangeGeom,
const Standard_Boolean UpDatePCurve = Standard_False,
const Standard_Boolean enlargeU = Standard_True,
const Standard_Boolean enlargeVfirst = Standard_True,
const Standard_Boolean enlargeVlast = Standard_True,
const Standard_Boolean UseInfini = Standard_True);
Standard_EXPORT static void ExtentFace (const TopoDS_Face& F, TopTools_DataMapOfShapeShape& ConstShapes, TopTools_DataMapOfShapeShape& ToBuild, const TopAbs_State Side, const Standard_Real TolConf, TopoDS_Face& NF);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,111 @@
// Created on: 2012-08-06
// Created by: jgv@ROLEX
// Copyright (c) 2012-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BRepOffsetAPI_PatchFaces_HeaderFile
#define _BRepOffsetAPI_PatchFaces_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <Standard_Boolean.hxx>
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_DataMapOfOrientedShapeShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <BRepBuilderAPI_MakeShape.hxx>
class TopoDS_Shape;
//! Describes functions to replace some faces in a shape
//! by patches
class BRepOffsetAPI_PatchFaces : public BRepBuilderAPI_MakeShape
{
public:
DEFINE_STANDARD_ALLOC
//! General constructor.
Standard_EXPORT BRepOffsetAPI_PatchFaces(const TopoDS_Shape& aShape);
//! Adds the patch face for the face in the shape.
Standard_EXPORT void AddPatchFace (const TopoDS_Face& theFace, const TopoDS_Face& thePatchFace);
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
protected:
private:
Standard_EXPORT void UpdateEdgesAndVertex(const TopoDS_Edge& thePrevEdge,
TopoDS_Edge& thePrevNewEdge,
const TopoDS_Edge& theCurEdge,
TopoDS_Edge& theCurNewEdge,
TopoDS_Vertex& theCurVertex,
const TopoDS_Face& theFace,
const TopoDS_Face& theNewFace,
TopoDS_Face& theBoundedNewFace);
Standard_EXPORT void PutVertexToEdge(const TopoDS_Vertex& theVertex,
const TopoDS_Vertex& theProVertex,
TopoDS_Edge& theEdge,
const TopoDS_Edge& theProEdge,
const Standard_Real theParamOnEdge);
Standard_EXPORT void ProjectVertexOnNewEdge_2d(const TopoDS_Vertex& theVertex,
const TopoDS_Edge& theEdge,
const TopoDS_Face& theFace,
const TopoDS_Edge& theNewEdge,
const TopoDS_Face& theNewFace,
Standard_Real& theParam,
gp_Pnt& thePnt,
gp_Pnt2d& thePnt2d,
Standard_Real& theTolReached);
TopoDS_Shape myInitialShape;
TopTools_IndexedDataMapOfShapeShape myFacePatchFace;
TopTools_IndexedDataMapOfShapeShape myFaceNewFace;
TopTools_DataMapOfShapeShape myNewFaceBoundedFace;
TopTools_DataMapOfShapeShape myEdgeNewEdge;
//TopTools_DataMapOfOrientedShapeShape myOrientedEdgeNewEdge;
TopTools_DataMapOfShapeShape myVertexNewVertex;
TopTools_MapOfShape myTangentEdges;
TopTools_IndexedDataMapOfShapeListOfShape myEFmap;
};
#endif // _BRepOffsetAPI_PatchFaces_HeaderFile

View File

@@ -27,3 +27,5 @@ BRepOffsetAPI_SequenceOfSequenceOfShape.hxx
BRepOffsetAPI_Sewing.hxx
BRepOffsetAPI_ThruSections.cxx
BRepOffsetAPI_ThruSections.hxx
BRepOffsetAPI_PatchFaces.cxx
BRepOffsetAPI_PatchFaces.hxx

View File

@@ -62,6 +62,8 @@
#include <DBRep_DrawableShape.hxx>
#include <BRepTest.hxx>
#include <BRepOffsetAPI_PatchFaces.hxx>
#include <BRepFilletAPI_MakeFillet.hxx>
#include <ChFi3d_FilletShape.hxx>
@@ -2287,6 +2289,36 @@ static Standard_Integer ComputeSimpleOffset(Draw_Interpretor& theCommands,
return 0;
}
//=======================================================================
//function : patchfaces
//purpose :
//=======================================================================
static Standard_Integer patchfaces(Draw_Interpretor& /*di*/,
Standard_Integer n, const char** a)
{
if (n < 5) return 1;
TopoDS_Shape aShape = DBRep::Get(a[2]);
if (aShape.IsNull()) return 1;
TopoDS_Shape aLocalFace = DBRep::Get(a[3], TopAbs_FACE);
if (aLocalFace.IsNull()) return 1;
TopoDS_Face aFace = TopoDS::Face(aLocalFace);
TopoDS_Shape aLocalNewFace = DBRep::Get(a[4], TopAbs_FACE);
if (aLocalNewFace.IsNull()) return 1;
TopoDS_Face aNewFace = TopoDS::Face(aLocalNewFace);
BRepOffsetAPI_PatchFaces Builder(aShape);
Builder.AddPatchFace(aFace, aNewFace);
Builder.Build();
TopoDS_Shape Result = Builder.Shape();
DBRep::Set(a[1], Result);
return 0;
}
//=======================================================================
//function : FeatureCommands
//purpose :
@@ -2435,4 +2467,7 @@ void BRepTest::FeatureCommands (Draw_Interpretor& theCommands)
theCommands.Add("offsetshapesimple",
"offsetshapesimple result shape offsetvalue [solid] [tolerance=1e-7]",
__FILE__, ComputeSimpleOffset);
theCommands.Add("patchfaces", "patchfaces res shape face newface",
__FILE__,patchfaces,g);
}

View File

@@ -800,20 +800,29 @@ proc testdiff {dir1 dir2 args} {
# Procedure to check data file before adding it to repository
help testfile {
Check data file and prepare it for putting to test data files repository.
Use: testfile [filelist]
Checks specified data files for putting them into the test data files repository.
Use: testfile filelist
Will report if:
- data file (non-binary) is in DOS encoding (CR/LF)
- same data file (with same or another name) already exists in the repository
- another file with the same name already exists
Note that names are assumed to be case-insensitive (for Windows).
Note that names are considered to be case-insensitive (for compatibility
with Windows).
Unless the file is already in the repository, tries to load it, reports
the recognized file format, file size, number of faces and edges in the
loaded shape (if any), and makes snapshot (in the temporary directory).
loaded shape (if any), information contained its triangulation, and makes
snapshot (in the temporary directory).
Finally it advises whether the file should be put to public section of the
repository.
Use: testfile -check
If "-check" is given as an argument, then procedure will check files already
located in the repository (for possible duplicates and for DOS encoding).
}
proc testfile {filelist} {
global env
@@ -823,8 +832,11 @@ proc testfile {filelist} {
error "Environment variable CSF_TestDataPath must be defined!"
}
set checkrepo f
if { "$filelist" == "-check" } { set checkrepo t }
# build registry of existing data files (name -> path) and (size -> path)
puts "Checking available test data files..."
puts "Collecting info on test data files repository..."
foreach dir [_split_path $env(CSF_TestDataPath)] {
while {[llength $dir] != 0} {
set curr [lindex $dir 0]
@@ -833,89 +845,143 @@ proc testfile {filelist} {
foreach file [glob -nocomplain -directory $curr -type f *] {
set name [file tail $file]
set name_lower [string tolower $name]
set size [file size $file]
# check that the file is not in DOS encoding
if { [_check_dos_encoding $file] } {
puts "Warning: file $file is in DOS encoding; was this intended?"
}
_check_file_format $file
# check if file with the same name is present twice or more
if { [info exists names($name_lower)] } {
puts "Error: more than one file with name $name is present in the repository:"
if { [_diff_files $file $names($name_lower)] } {
puts "(files are different by content)"
} else {
puts "(files are same by content)"
if { $checkrepo } {
if { [_check_dos_encoding $file] } {
puts "Warning: file $file is in DOS encoding; was this intended?"
}
puts "--> $file"
puts "--> $names($name_lower)"
continue
}
_check_file_format $file
# check if file with the same content exists
set size [file size $file]
if { [info exists sizes($size)] } {
foreach other $sizes($size) {
if { ! [_diff_files $file $other] } {
puts "Warning: two files with the same content found:"
puts "--> $file"
puts "--> $other"
# check if file with the same name is present twice or more
if { [info exists names($name_lower)] } {
puts "Error: more than one file with name $name is present in the repository:"
if { [_diff_files $file $names($name_lower)] } {
puts "(files are different by content)"
} else {
puts "(files are same by content)"
}
puts "--> $file"
puts "--> $names($name_lower)"
continue
}
# check if file with the same content exists
if { [info exists sizes($size)] } {
foreach other $sizes($size) {
if { ! [_diff_files $file $other] } {
puts "Warning: two files with the same content found:"
puts "--> $file"
puts "--> $other"
}
}
}
}
# add the file to the registry
set names($name_lower) $file
lappend names($name_lower) $file
lappend sizes($size) $file
}
}
}
if { [llength $filelist] <= 0 } { return }
if { $checkrepo || [llength $filelist] <= 0 } { return }
# check the new files
set has_images f
puts "Checking new file(s)..."
foreach file $filelist {
# check for DOS encoding
if { [_check_dos_encoding $file] } {
puts "$file: Warning: DOS encoding detected"
}
set name [file tail $file]
set name_lower [string tolower $name]
set found f
# check for presence of the file with same name
if { [info exists names($name_lower)] } {
if { [_diff_files $file $names($name_lower)] } {
puts "$file: Error: name is already used by existing file\n--> $names($name_lower)"
} else {
puts "$file: OK: already in the repository \n--> $names($name_lower)"
continue
set found f
foreach other $names($name_lower) {
# avoid comparing the file with itself
if { [file normalize $file] == [file normalize $other] } {
continue
}
# compare content
if { [_diff_files $file $other] } {
puts "\n* $file: error\n name is already used by existing file\n --> $other"
} else {
puts "\n* $file: already present \n --> $other"
}
set found t
break
}
if { $found } { continue }
}
# get size of the file; if it is in DOS encoding and less than 1 MB,
# estimate also its size in UNIX encoding to be able to find same
# file if already present but in UNIX encoding
set sizeact [file size $file]
set sizeunx ""
set isdos [_check_dos_encoding $file]
if { $isdos && $sizeact < 10000000 } {
set fd [open $file r]
fconfigure $fd -translation crlf
set sizeunx [string length [read $fd]]
close $fd
}
# check if file with the same content exists
set size [file size $file]
if { [info exists sizes($size)] } {
set found f
foreach size "$sizeact $sizeunx" {
if { [info exists sizes($size)] } {
foreach other $sizes($size) {
# avoid comparing the file with itself
if { [file normalize $file] == [file normalize $other] } {
continue
}
# compare content
if { ! [_diff_files $file $other] } {
puts "$file: OK: the same file is already present under name [file tail $other]\n--> $other"
puts "\n* $file: duplicate \n already present under name [file tail $other]\n --> $other"
set found t
break
}
}
if { $found } { continue }
if { $found } { break }
}
}
if { $found } { continue }
# file is not present yet, so to be analyzed
puts "\n* $file: new file"
# add the file to the registry as if it were added to the repository,
# to report possible duplicates among the currently processed files
lappend names($name_lower) $file
if { "$sizeunx" != "" } {
lappend sizes($sizeunx) $file
} else {
lappend sizes($sizeact) $file
}
# first of all, complain if it is in DOS encoding
if { $isdos } {
puts " Warning: DOS encoding detected, consider converting to"
puts " UNIX unless DOS line ends are needed for the test"
}
# try to read the file
set format [_check_file_format $file]
if { [catch {uplevel load_data_file $file $format a}] } {
puts "$file: Error: Cannot read as $format file"
puts " Warning: Cannot read as $format file"
continue
}
# warn if shape contains triangulation
pload MODELING
if { "$format" != "STL" &&
[regexp {contains\s+([0-9]+)\s+triangles} [uplevel trinfo a] res nbtriangles] &&
$nbtriangles != 0 } {
puts " Warning: shape contains triangulation ($nbtriangles triangles),"
puts " consider removing them unless they are needed for the test!"
}
# get number of faces and edges
set edges 0
set faces 0
@@ -928,16 +994,10 @@ proc testfile {filelist} {
set dir public
} else {
set dir private
# check if one of names of that file corresponds to typical name for
# MDTV bugs or has extension .rle, this should be old model
if { [regexp -nocase {.*(cts|ats|pro|buc|ger|fra|usa|uki)[0-9]+.*} $name] ||
[regexp -nocase {[.]rle\y} $name] } {
set dir old
}
}
# add stats
puts "$file: $format size=[expr $size / 1024] KiB, nbfaces=$faces, nbedges=$edges -> $dir"
puts " $format size=[expr $size / 1024] KiB, nbfaces=$faces, nbedges=$edges -> $dir"
set tmpdir [_get_temp_dir]
file mkdir $tmpdir/$dir
@@ -945,6 +1005,7 @@ proc testfile {filelist} {
# make snapshot
pload AISV
uplevel vdisplay a
uplevel vsetdispmode 1
uplevel vfit
uplevel vzfit
uplevel vdump $tmpdir/$dir/[file rootname [file tail $file]].png
@@ -1517,7 +1578,7 @@ proc _html_highlight {status line} {
# Internal procedure to generate HTML page presenting log of the tests
# execution in tabular form, with links to reports on individual cases
proc _log_html_summary {logdir log totals regressions improvements total_time} {
proc _log_html_summary {logdir log totals regressions improvements skipped total_time} {
global _test_case_regexp
# create missing directories as needed
@@ -1564,7 +1625,7 @@ proc _log_html_summary {logdir log totals regressions improvements total_time} {
}
# print regressions and improvements
foreach featured [list $regressions $improvements] {
foreach featured [list $regressions $improvements $skipped] {
if { [llength $featured] <= 1 } { continue }
set status [string trim [lindex $featured 0] { :}]
puts $fd "<h2>$status</h2>"
@@ -1671,13 +1732,16 @@ proc _log_summarize {logdir log {total_time {}}} {
set totals {}
set improvements {Improvements:}
set regressions {Failed:}
set skipped {Skipped:}
if { [info exists stat] } {
foreach status [lsort [array names stat]] {
lappend totals [list [llength $stat($status)] $status]
# separately count improvements (status starting with IMP) and regressions (all except IMP, OK, BAD, and SKIP)
# separately count improvements (status starting with IMP), skipped (status starting with SKIP) and regressions (all except IMP, OK, BAD, and SKIP)
if { [regexp -nocase {^IMP} $status] } {
eval lappend improvements $stat($status)
} elseif { [regexp -nocase {^SKIP} $status] } {
eval lappend skipped $stat($status)
} elseif { $status != "OK" && ! [regexp -nocase {^BAD} $status] && ! [regexp -nocase {^SKIP} $status] } {
eval lappend regressions $stat($status)
}
@@ -1692,6 +1756,9 @@ proc _log_summarize {logdir log {total_time {}}} {
if { [llength $regressions] > 1 } {
_log_and_puts log [join $regressions "\n "]
}
if { [llength $skipped] > 1 } {
_log_and_puts log [join $skipped "\n "]
}
if { [llength $improvements] == 1 && [llength $regressions] == 1 } {
_log_and_puts log "No regressions"
}
@@ -1701,7 +1768,7 @@ proc _log_summarize {logdir log {total_time {}}} {
# save log to files
if { $logdir != "" } {
_log_html_summary $logdir $log $totals $regressions $improvements $total_time
_log_html_summary $logdir $log $totals $regressions $improvements $skipped $total_time
_log_save $logdir/tests.log [join $log "\n"] "Tests summary"
}
@@ -2340,7 +2407,7 @@ proc load_data_file {file format shape} {
DRAW { uplevel restore $file $shape }
IGES { pload XSDRAW; uplevel igesbrep $file $shape * }
STEP { pload XSDRAW; uplevel stepread $file __a *; uplevel renamevar __a_1 $shape }
STL { pload XSDRAW; uplevel readstl $shape $file }
STL { pload XSDRAW; uplevel readstl $shape $file triangulation }
default { error "Cannot read $format file $file" }
}
}

View File

@@ -0,0 +1,52 @@
puts "# This test is for command testfile, used to check new data files "
puts "# before adding to the data base:"
puts "# - bottle.brep should be reported as already in data base"
puts "# - hammer_copy.igs should be reported as duplicate"
puts "# - square.brep should be reported as new, with warnings on DOS encoding"
puts "# and presence of triangulation"
puts ""
puts "# Preparing test data files..."
# find reference data files (they should be present, otherwise test is meaningless)
set bottle [locate_data_file bottle.brep]
set hammer [locate_data_file hammer.iges]
# bottle is simply copied
file copy -force $bottle ${imagedir}/bottle.brep
# hammer is copied with different name and DOS encoding
set fd [open $hammer r]
set hammer_content [read $fd]
close $fd
set fd [open ${imagedir}/_hammer_copy.igs w]
fconfigure $fd -translation crlf
puts -nonewline $fd $hammer_content
close $fd
# square is created anew
pload MODELING
box b 11.1 11.1 11.1
explode b f
tcopy b_1 f
incmesh f 0.01
save f ${imagedir}/_square.brep
set fd [open ${imagedir}/_square.brep r]
set square_content [read $fd]
close $fd
set fd [open ${imagedir}/_square.brep w]
fconfigure $fd -translation crlf
puts -nonewline $fd $square_content
close $fd
puts ""
puts "REQUIRED ALL: bottle.brep: already present"
puts "REQUIRED ALL: hammer_copy.igs: duplicate"
puts "REQUIRED ALL: square.brep: new file"
puts "REQUIRED ALL: Warning: DOS encoding detected"
puts "REQUIRED ALL: Warning: shape contains triangulation"
testfile [list ${imagedir}/bottle.brep ${imagedir}/_hammer_copy.igs ${imagedir}/_square.brep]
puts "TEST COMPLETED"

23
tests/patchfaces/begin Normal file
View File

@@ -0,0 +1,23 @@
# To prevent loops limit to 10 minutes
cpulimit 900
if { [array get Draw_Groups "TOPOLOGY Feature commands"] == "" } {
pload TOPTEST
}
if { [array get Draw_Groups "Shape Healing"] == "" } {
pload XSDRAW
}
if { [info exists imagedir] == 0 } {
set imagedir .
}
if { [info exists test_image ] == 0 } {
set test_image photo
}
proc PATCHFACES {i} {
uplevel #0 binrestore [locate_data_file shape_3_$i.bin] s
uplevel #0 tclean s
uplevel #0 removeloc s s
uplevel #0 explode s
uplevel #0 tcopy s_1 InitShape
uplevel #0 patchfaces result s_1 s_2 s_3
}

1
tests/patchfaces/end Normal file
View File

@@ -0,0 +1 @@
puts "TEST COMPLETED"

View File

@@ -0,0 +1 @@
001 replace

View File

@@ -0,0 +1,2 @@
FAILED /\bFaulty\b/ bad shape
OK /Relative error of mass computation/ message from vprops

View File

@@ -0,0 +1 @@
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1 @@
PATCHFACES 1

View File

@@ -0,0 +1 @@
PATCHFACES 10

View File

@@ -0,0 +1 @@
PATCHFACES 11

View File

@@ -0,0 +1 @@
PATCHFACES 12

View File

@@ -0,0 +1 @@
PATCHFACES 13

View File

@@ -0,0 +1 @@
PATCHFACES 14

View File

@@ -0,0 +1 @@
PATCHFACES 15

View File

@@ -0,0 +1 @@
PATCHFACES 16

View File

@@ -0,0 +1 @@
PATCHFACES 17

View File

@@ -0,0 +1 @@
PATCHFACES 18

View File

@@ -0,0 +1 @@
PATCHFACES 19

View File

@@ -0,0 +1 @@
PATCHFACES 2

View File

@@ -0,0 +1 @@
PATCHFACES 20

View File

@@ -0,0 +1 @@
PATCHFACES 21

View File

@@ -0,0 +1 @@
PATCHFACES 22

View File

@@ -0,0 +1 @@
PATCHFACES 23

View File

@@ -0,0 +1 @@
PATCHFACES 24

View File

@@ -0,0 +1 @@
PATCHFACES 25

View File

@@ -0,0 +1 @@
PATCHFACES 26

View File

@@ -0,0 +1 @@
PATCHFACES 27

View File

@@ -0,0 +1 @@
PATCHFACES 28

View File

@@ -0,0 +1 @@
PATCHFACES 29

View File

@@ -0,0 +1 @@
PATCHFACES 3

View File

@@ -0,0 +1 @@
PATCHFACES 30

View File

@@ -0,0 +1 @@
PATCHFACES 31

View File

@@ -0,0 +1 @@
PATCHFACES 32

View File

@@ -0,0 +1 @@
PATCHFACES 33

View File

@@ -0,0 +1 @@
PATCHFACES 34

View File

@@ -0,0 +1 @@
PATCHFACES 35

View File

@@ -0,0 +1 @@
PATCHFACES 4

View File

@@ -0,0 +1 @@
PATCHFACES 5

View File

@@ -0,0 +1 @@
PATCHFACES 6

View File

@@ -0,0 +1 @@
PATCHFACES 7

View File

@@ -0,0 +1 @@
PATCHFACES 8

View File

@@ -0,0 +1 @@
PATCHFACES 9