1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

..

17 Commits

Author SHA1 Message Date
anv
2e2f7fa6db 0033829: Data Exchange - Implementing common logic for scaling during Write procedure (part 2)
Implementation for BRep, XCAF, IGES, Obj, Ply, Stl, Vrml formats.
2024-09-18 09:53:19 +01:00
anv
e82d98d345 0033816: Data Exchange - Implementing common logic for scaling during Write procedure (part 1)
Implementation for Gltf and STEP formats.
2024-09-17 17:22:30 +01:00
dpasukhi
72c6d55bf2 0033765: Data Exchange, IGES Export - Missing Model Curves in transfer cache
Curve list should be not unique, list is recommended.
One curve can be used by multiple edges.
2024-09-14 20:26:41 +00:00
oan
d0e33902bc 0033806: Shape Healing - ShapeCustom optimization while rebuilding compounds
Avoid double binding of shapes to context.
Take all changes into account by reshape
2024-09-14 20:26:41 +00:00
dpasukhi
a52ee17c73 Coding - Precision.hxx file optimization
Precision.hxx optimized to have compiler-time
  constants for the most common floating-point values.
Reorganized code to avoid static jumping for parametric.
2024-09-14 20:26:41 +00:00
dpasukhi
72b244bc98 Coding - Resolving C26439 & type formatting warnings
Sprintf  with %s always convert values into char*, not safety from int.
Move operators and constructors can be marked as noexcept
2024-09-14 20:26:41 +00:00
dpasukhi
9c6914c3cc Coding - Resolving C6319 warning
Use of the comma-operator in a tested expression
  causes the left argument to be ignored when it has no side-effects.
2024-09-14 20:26:41 +00:00
dpasukhi
4ab54d60ef Coding - Resolving C26498 warning
C26498 - marking variables constexpr to improve performance
2024-09-14 20:26:41 +00:00
dpasukhi
09a69618da Coding - Resolving C6287 & C6282 warnings
Removing redundant code and incorrect operator
2024-09-14 15:16:54 +00:00
dpasukhi
6cb0b9b4e3 Coding - Resolving C6263 warnings
Reorganizing code to not call alloca inside loop.
  alloca allocated memory from stack and free after finishing function
2024-09-14 15:16:54 +00:00
dpasukhi
33339b0dc2 Coding - GeomConvert_CurveToAnaCurve warnings fix 2024-09-14 11:01:24 +00:00
dpasukhi
392ba7dbb6 Coding - Image_AlienPixMap unused parameters 2024-09-14 11:01:10 +00:00
dpasukhi
ed20837d8b 0033703: Data Exchange, Step Export - Transfer edge speed improvement
Move optional code close to use case to avoid extra calculation
2024-09-06 20:22:00 +00:00
reciprocal
2ab4e9e180 0033319: Coding - Static linking fails with unresolved symbols due to linking order and missing transitive dependencies
The absence of target_link_libraries calls for static libraries caused CMake to fail
in modeling the link dependencies correctly.
This fix ensures that CMake correctly exports the dependencies in OpenCASCADEConfig.cmake and
resolves downstream linking errors for projects that link against static OpenCASCADE libraries.
2024-09-05 18:15:57 +00:00
dpasukhi
d83d72acf9 0033805: Configuration - Implement GitHub Actions build scripts
Enable MSVC code analyzing to push SARIF files
2024-09-05 17:55:07 +00:00
dpasukhi
fae5678dc7 0033750: Configuration - make file configuration failed in mfc example
Updated MFC sample to build together with OCCT
2024-09-05 17:55:01 +00:00
dpasukhi
488c43ed0c 0033812: Configuration, MacOS - Debug Symbols Stripped From Dynamic Libraries
Update optimization flag to release only
2024-09-05 09:14:24 +00:00
60 changed files with 502 additions and 369 deletions

View File

@@ -56,14 +56,7 @@ jobs:
# ignoredPaths: ${{ github.workspace }}/dependencies;${{ github.workspace }}/test
# Upload SARIF file to GitHub Code Scanning Alerts
#- name: Upload SARIF to GitHub
# uses: github/codeql-action/upload-sarif@v3.26.5
# with:
# sarif_file: ${{ steps.run-analysis.outputs.sarif }}
# Upload SARIF file as an Artifact to download and view
- name: Upload SARIF as an Artifact
uses: actions/upload-artifact@v4.3.6
- name: Upload SARIF to GitHub
uses: github/codeql-action/upload-sarif@v3.26.5
with:
name: sarif-file
path: ${{ steps.run-analysis.outputs.sarif }}
sarif_file: ${{ steps.run-analysis.outputs.sarif }}

View File

@@ -168,7 +168,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
set (CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}")
endif()
# Optimize size of binaries
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,-s ${CMAKE_SHARED_LINKER_FLAGS}")
set (CMAKE_SHARED_LINKER_FLAGS_RELEASE "-Wl,-s ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
elseif(MINGW)
add_definitions(-D_WIN32_WINNT=0x0601)
# _WIN32_WINNT=0x0601 (use Windows 7 SDK)

View File

@@ -479,8 +479,8 @@ if (BUILD_SHARED_LIBS OR EXECUTABLE_PROJECT)
if(IS_VTK_9XX)
string (REGEX REPLACE "vtk" "VTK::" USED_TOOLKITS_BY_CURRENT_PROJECT "${USED_TOOLKITS_BY_CURRENT_PROJECT}")
endif()
target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
endif()
target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
if (USE_QT)
foreach (PROJECT_LIBRARY_DEBUG ${PROJECT_LIBRARIES_DEBUG})

View File

@@ -11,7 +11,7 @@ project (ImportExport)
add_definitions (-DWINVER=0x0501 -DUNICODE -D_UNICODE)
set (CMAKE_MFC_FLAG 2)
set (ImportExport_SRC_DIR ${MFC_STANDARD_SAMPLES_DIR}/05_ImportExport/src)
set (ImportExport_SRC_DIR ${MFC_STANDARD_SAMPLES_DIR}/03_ImportExport/src)
set (ImportExport_HEADER_FILES ${ImportExport_SRC_DIR}/ColoredShapes.h
${ImportExport_SRC_DIR}/ImportExportApp.h
${ImportExport_SRC_DIR}/ImportExportDoc.h
@@ -21,7 +21,7 @@ set (ImportExport_SOURCE_FILES ${ImportExport_SRC_DIR}/ColoredShapes.cpp
${ImportExport_SRC_DIR}/ImportExportDoc.cpp
${ImportExport_SRC_DIR}/StdAfx.cpp)
set (ImportExport_RESOURCE_DIR ${MFC_STANDARD_SAMPLES_DIR}/05_ImportExport/res)
set (ImportExport_RESOURCE_DIR ${MFC_STANDARD_SAMPLES_DIR}/03_ImportExport/res)
set (ImportExport_RESOURCE_HEADER ${ImportExport_RESOURCE_DIR}/resource.h)
set (ImportExport_RESOURCE_FILES ${ImportExport_RESOURCE_DIR}/Toolbar.bmp
${ImportExport_RESOURCE_DIR}/ImportExport.rc)
@@ -55,7 +55,7 @@ else()
endif()
include_directories (${CMAKE_BINARY_DIR}/inc
${MFC_STANDARD_SAMPLES_DIR}/05_ImportExport
${MFC_STANDARD_SAMPLES_DIR}/03_ImportExport
${ImportExport_SRC_DIR}
${MFC_STANDARD_SAMPLES_DIR}/Common)

View File

@@ -11,7 +11,7 @@ project (HLR)
add_definitions(-DWINVER=0x0501 -DUNICODE -D_UNICODE)
set (CMAKE_MFC_FLAG 2)
set (HLR_SRC_DIR ${MFC_STANDARD_SAMPLES_DIR}/08_HLR/src)
set (HLR_SRC_DIR ${MFC_STANDARD_SAMPLES_DIR}/04_HLR/src)
set (HLR_HEADER_FILES ${HLR_SRC_DIR}/HLRApp.h
${HLR_SRC_DIR}/HLRDoc.h
${HLR_SRC_DIR}/HLRView2D.h
@@ -23,7 +23,7 @@ set (HLR_SOURCE_FILES ${HLR_SRC_DIR}/HLRApp.cpp
${HLR_SRC_DIR}/SelectionDialog.cpp
${HLR_SRC_DIR}/StdAfx.cpp )
set (HLR_RESOURCE_DIR ${MFC_STANDARD_SAMPLES_DIR}/08_HLR/res)
set (HLR_RESOURCE_DIR ${MFC_STANDARD_SAMPLES_DIR}/04_HLR/res)
set (HLR_RESOURCE_HEADER ${HLR_RESOURCE_DIR}/resource.h)
set (HLR_RESOURCE_FILES ${HLR_RESOURCE_DIR}/axoviewd.bmp
${HLR_RESOURCE_DIR}/axoviewf.bmp

View File

@@ -82,7 +82,6 @@ set (COMMON_HEADER_FILES ${MFC_STANDARD_COMMON_SAMPLES_DIR}/AISDialogs.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_StereoConfigDlg.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/ParamsFacesPage.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/ResultDialog.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/User_Cylinder.hxx
${MFC_STANDARD_COMMON_SAMPLES_DIR}/ColoredMeshDlg.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/DimensionDlg.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsEdgePage.h

View File

@@ -229,7 +229,6 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
return 0;
}
//
char buf[64];
Standard_Boolean bRunParallel;
Standard_Integer aNb;
BOPAlgo_BOP aBOP;
@@ -237,8 +236,7 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
const TopTools_ListOfShape& aLC=pPF->Arguments();
aNb=aLC.Extent();
if (aNb!=2) {
Sprintf (buf, " wrong number of arguments %s\n", aNb);
di << buf;
di << " wrong number of arguments " << aNb << '\n';
return 0;
}
//
@@ -298,7 +296,6 @@ Standard_Integer bopsection(Draw_Interpretor& di,
return 0;
}
//
char buf[64];
Standard_Boolean bRunParallel;
Standard_Integer aNb;
BOPAlgo_Section aBOP;
@@ -306,8 +303,7 @@ Standard_Integer bopsection(Draw_Interpretor& di,
const TopTools_ListOfShape& aLC=pPF->Arguments();
aNb=aLC.Extent();
if (aNb!=2) {
Sprintf (buf, " wrong number of arguments %s\n", aNb);
di << buf;
di << " wrong number of arguments " << aNb << '\n';
return 0;
}
//

View File

@@ -43,7 +43,7 @@ static Standard_Integer
IntersectionOfSets( const NCollection_List<Standard_Integer>& theSet1,
const NCollection_List<Standard_Integer>& theSet2)
{
const Standard_Integer anIntMax = IntegerLast();
constexpr Standard_Integer anIntMax = IntegerLast();
Standard_Integer aRetVal = anIntMax;
for(NCollection_List<Standard_Integer>::Iterator
anIt1 = theSet1.begin().Iterator();

View File

@@ -234,7 +234,7 @@ Standard_Integer BRepToIGESBRep_Entity::AddEdge(const TopoDS_Edge& myedge,
Standard_Integer index = myEdges.FindIndex(E);
if (index == 0) {
index = myEdges.Add(E);
myCurves.Add(C);
myCurves.Append(C);
}
return index;

View File

@@ -23,6 +23,7 @@
#include <TopTools_IndexedMapOfShape.hxx>
#include <TColStd_IndexedMapOfTransient.hxx>
#include <TColStd_SequenceOfTransient.hxx>
#include <BRepToIGES_BREntity.hxx>
#include <Standard_Integer.hxx>
#include <Message_ProgressRange.hxx>
@@ -136,7 +137,7 @@ private:
TopTools_IndexedMapOfShape myVertices;
TopTools_IndexedMapOfShape myEdges;
TColStd_IndexedMapOfTransient myCurves;
TColStd_SequenceOfTransient myCurves;
Handle(IGESSolid_EdgeList) myEdgeList;
Handle(IGESSolid_VertexList) myVertexList;

View File

@@ -720,7 +720,7 @@ static Standard_Boolean IsSegmentOut(Standard_Real x1,Standard_Real y1,
Standard_Real xs1,Standard_Real ys1,
Standard_Real xs2,Standard_Real ys2)
{
Standard_Real eps = RealSmall();
constexpr Standard_Real eps = RealSmall();
Standard_Real xsmin = Min (xs1, xs2);
Standard_Real xsmax = Max (xs1, xs2);
Standard_Real ysmin = Min (ys1, ys2);
@@ -765,7 +765,7 @@ Standard_Boolean Bnd_Box::IsOut(const gp_Pnt& P1, const gp_Pnt& P2, const gp_Dir
if (IsWhole()) return Standard_False;
else if (IsVoid()) return Standard_True;
Standard_Real eps = RealSmall();
constexpr Standard_Real eps = RealSmall();
Standard_Real myXmin, myYmin, myZmin, myXmax, myYmax, myZmax;
Get (myXmin, myYmin, myZmin, myXmax, myYmax, myZmax);

View File

@@ -180,7 +180,7 @@ static void TreatInfinitePlane(const gp_Pln &aPlane,
{
// Get 3 coordinate axes of the plane.
const gp_Dir &aNorm = aPlane.Axis().Direction();
const Standard_Real anAngularTol = RealEpsilon();
constexpr Standard_Real anAngularTol = RealEpsilon();
// Get location of the plane as its barycenter
gp_Pnt aLocation = BaryCenter(aPlane, aUMin, aUMax, aVMin, aVMax);

View File

@@ -154,7 +154,8 @@ public:
//!< Internal parameters for transfer process
struct DE_SectionGlobal
{
Standard_Real LengthUnit = 1.0; //!< Scale length unit value from MM, default 1.0 (MM)
Standard_Real LengthUnit = 1.0; //!< Target Unit (scaling based on MM) for the transfer process, default 1.0 (MM)
Standard_Real SystemUnit = 1.0; //!< System Unit (scaling based on MM) to be used when initial unit is unknown, default 1.0 (MM)
} GlobalParameters;
private:

View File

@@ -290,6 +290,7 @@ Standard_Boolean DE_Wrapper::Load(const Handle(DE_ConfigurationContext)& theReso
const Standard_Boolean theIsRecursive)
{
GlobalParameters.LengthUnit = theResource->RealVal("general.length.unit", GlobalParameters.LengthUnit, THE_CONFIGURATION_SCOPE());
GlobalParameters.SystemUnit = theResource->RealVal("general.system.unit", GlobalParameters.SystemUnit, THE_CONFIGURATION_SCOPE());
if (theIsRecursive)
{
for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
@@ -372,8 +373,10 @@ TCollection_AsciiString DE_Wrapper::Save(const Standard_Boolean theIsRecursive,
aResult += "\n";
}
aResult += "!Global parameters. Used for all providers\n";
aResult += "!Length scale unit value. Should be more the 0. Default value: 1.0(MM)\n";
aResult += "!Length scale unit value. Should be more than 0. Default value: 1.0(MM)\n";
aResult += THE_CONFIGURATION_SCOPE() + ".general.length.unit :\t " + GlobalParameters.LengthUnit + "\n";
aResult += "!System unit value. Should be more than 0. Default value: 1.0(MM)\n";
aResult += THE_CONFIGURATION_SCOPE() + ".general.system.unit :\t " + GlobalParameters.SystemUnit + "\n";
if (theIsRecursive)
{
for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);

View File

@@ -110,6 +110,13 @@ bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
return false;
}
Handle(DEBRepCascade_ConfigurationNode) aNode = Handle(DEBRepCascade_ConfigurationNode)::DownCast(GetNode());
if (aNode->GlobalParameters.LengthUnit != 1.0)
{
Message::SendWarning() << "Warning in the DEBRepCascade_Provider during writing the file " <<
thePath << "\t: Target Units for writing were changed, but current format doesn't support scaling";
}
if (aLabels.Length() == 1)
{
aShape = aSTool->GetShape(aLabels.Value(1));
@@ -223,6 +230,11 @@ bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
return false;
}
Handle(DEBRepCascade_ConfigurationNode) aNode = Handle(DEBRepCascade_ConfigurationNode)::DownCast(GetNode());
if (aNode->GlobalParameters.LengthUnit != 1.0)
{
Message::SendWarning() << "Warning in the DEBRepCascade_Provider during writing the file " <<
thePath << "\t: Target Units for writing were changed, but current format doesn't support scaling";
}
if (aNode->InternalParameters.WriteBinary)
{
if (aNode->InternalParameters.WriteVersionBin > static_cast<BinTools_FormatVersion>(BinTools_FormatVersion_UPPER) ||

View File

@@ -145,6 +145,14 @@ bool DEXCAFCascade_Provider::Write(const TCollection_AsciiString& thePath,
{
Handle(TDocStd_Application) anApp = new TDocStd_Application();
BinXCAFDrivers::DefineFormat(anApp);
Handle(DEXCAFCascade_ConfigurationNode) aNode = Handle(DEXCAFCascade_ConfigurationNode)::DownCast(GetNode());
if (aNode->GlobalParameters.LengthUnit != 1.0)
{
Message::SendWarning() << "Warning in the DEXCAFCascade_Provider during writing the file " <<
thePath << "\t: Target Units for writing were changed, but current format doesn't support scaling";
}
PCDM_StoreStatus aStatus = PCDM_SS_Doc_IsNull;
if (!thePath.IsEmpty())
{

View File

@@ -108,7 +108,7 @@ FEmTool_ProfileMatrix::FEmTool_ProfileMatrix(const TColStd_Array1OfInteger& Firs
SMA--;
const Standard_Real * PM = &ProfileMatrix->Value(1);
PM--;
IsDecomp = Standard_False;
for(j = 1; j <= RowNumber(); j++) {
DiagAddr = profile(2, j);
Kj = j - profile(1, j);
@@ -118,7 +118,7 @@ FEmTool_ProfileMatrix::FEmTool_ProfileMatrix(const TColStd_Array1OfInteger& Firs
a = PM[DiagAddr] - Sum;
if(a < Eps) {
return IsDecomp = Standard_False;// Matrix is not positive defined
return Standard_False;// Matrix is not positive defined
}
a = Sqrt(a);
SMA[DiagAddr] = a;
@@ -139,7 +139,8 @@ FEmTool_ProfileMatrix::FEmTool_ProfileMatrix(const TColStd_Array1OfInteger& Firs
SMA[CurrAddr] = (PM[CurrAddr] - Sum)/a;
}
}
return IsDecomp = Standard_True;
IsDecomp = Standard_True;
return IsDecomp;
}
//=======================================================================

View File

@@ -99,7 +99,7 @@ GccAna_Lin2dTanPer::
IntAna2d_AnaIntersection Intp(linsol(1),TheCircle);
if (Intp.IsDone()) {
if (!Intp.IsEmpty()) {
Standard_Real maxdist = RealLast();
constexpr Standard_Real maxdist = RealLast();
for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
if (Intp.Point(i).Value().Distance(ThePnt) < maxdist) {
pntint2sol(1) = Intp.Point(i).Value();
@@ -244,7 +244,7 @@ GccAna_Lin2dTanPer::
IntAna2d_AnaIntersection Intp(linsol(NbrSol),TheCircle);
if (Intp.IsDone()) {
if (!Intp.IsEmpty()) {
Standard_Real maxdist = RealLast();
constexpr Standard_Real maxdist = RealLast();
for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
if (Intp.Point(i).Value().Distance(pnttg1sol(NbrSol)) < maxdist) {
pntint2sol(NbrSol) = Intp.Point(i).Value();

View File

@@ -41,6 +41,7 @@
#include <math_Matrix.hxx>
#include <math_Gauss.hxx>
#include <array>
GeomConvert_CurveToAnaCurve::GeomConvert_CurveToAnaCurve():
myGap(Precision::Infinite()),
@@ -650,15 +651,15 @@ Handle(Geom_Curve) GeomConvert_CurveToAnaCurve::ComputeCurve(const Handle(Geom_C
const GeomConvert_ConvType theConvType, const GeomAbs_CurveType theTarget)
{
cf = c1; cl = c2;
Handle(Geom_Curve) c3d, newc3d[3];
Standard_Integer i, imin = -1;
c3d = theC3d;
if (c3d.IsNull()) return newc3d[imin];
std::array<Handle(Geom_Curve), 3> newc3d = {};
Handle(Geom_Curve) c3d = theC3d;
if (c3d.IsNull()) return c3d;
gp_Pnt P1 = c3d->Value(c1);
gp_Pnt P2 = c3d->Value(c2);
gp_Pnt P3 = c3d->Value(c1 + (c2 - c1) / 2);
Standard_Real d[3] = { RealLast(), RealLast(), RealLast() };
Standard_Real fp[3], lp[3];
std::array<Standard_Real, 3> d = { RealLast(), RealLast(), RealLast() };
std::array<Standard_Real, 3> fp = {};
std::array<Standard_Real, 3> lp = {};
if (c3d->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
Handle(Geom_TrimmedCurve) aTc = Handle(Geom_TrimmedCurve)::DownCast(c3d);
@@ -723,7 +724,7 @@ Handle(Geom_Curve) GeomConvert_CurveToAnaCurve::ComputeCurve(const Handle(Geom_C
// theConvType == GeomConvert_MinGap
// recognition in case of small curve
imin = -1;
Standard_Integer imin = -1;
if((P1.Distance(P2) < 2*tolerance) && (P1.Distance(P3) < 2*tolerance)) {
newc3d[1] = ComputeCircle(c3d, tolerance, c1, c2, fp[1], lp[1], d[1]);
newc3d[0] = ComputeLine(c3d, tolerance, c1, c2, fp[0], lp[0], d[0]);
@@ -746,7 +747,7 @@ Handle(Geom_Curve) GeomConvert_CurveToAnaCurve::ComputeCurve(const Handle(Geom_C
newc3d[2] = ComputeEllipse(c3d, tol, c1, c2, fp[2], lp[2], d[2]);
}
Standard_Real dd = RealLast();
for (i = 0; i < 3; ++i)
for (Standard_Integer i = 0; i < 3; ++i)
{
if (newc3d[i].IsNull()) continue;
if (d[i] < dd)

View File

@@ -668,8 +668,8 @@ Bnd_Box Graphic3d_Structure::MinMaxValues (const Standard_Boolean theToIgnoreInf
aResult.Update (aBox.CornerMin().x(), aBox.CornerMin().y(), aBox.CornerMin().z(),
aBox.CornerMax().x(), aBox.CornerMax().y(), aBox.CornerMax().z());
Standard_Real aLimMin = ShortRealFirst() + 1.0;
Standard_Real aLimMax = ShortRealLast() - 1.0;
constexpr Standard_Real aLimMin = ShortRealFirst() + 1.0;
constexpr Standard_Real aLimMax = ShortRealLast() - 1.0;
gp_Pnt aMin = aResult.CornerMin();
gp_Pnt aMax = aResult.CornerMax();
if (aMin.X() < aLimMin && aMin.Y() < aLimMin && aMin.Z() < aLimMin
@@ -847,8 +847,8 @@ void Graphic3d_Structure::Transforms (const gp_Trsf& theTrsf,
const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ,
Standard_Real& theNewX, Standard_Real& theNewY, Standard_Real& theNewZ)
{
const Standard_Real aRL = RealLast();
const Standard_Real aRF = RealFirst();
constexpr Standard_Real aRL = RealLast();
constexpr Standard_Real aRF = RealFirst();
theNewX = theX;
theNewY = theY;
theNewZ = theZ;

View File

@@ -96,8 +96,6 @@ bool IGESCAFControl_ConfigurationNode::Load(const Handle(DE_ConfigurationContext
theResource->IntegerVal("write.brep.mode", InternalParameters.WriteBRepMode, aScope);
InternalParameters.WriteConvertSurfaceMode = (WriteMode_ConvertSurface)
theResource->IntegerVal("write.convertsurface.mode", InternalParameters.WriteConvertSurfaceMode, aScope);
InternalParameters.WriteUnit = (UnitsMethods_LengthUnit)
theResource->IntegerVal("write.unit", InternalParameters.WriteUnit, aScope);
InternalParameters.WriteHeaderAuthor =
theResource->StringVal("write.header.author", InternalParameters.WriteHeaderAuthor, aScope);
InternalParameters.WriteHeaderCompany =
@@ -272,14 +270,6 @@ TCollection_AsciiString IGESCAFControl_ConfigurationNode::Save() const
aResult += aScope + "write.convertsurface.mode :\t " + InternalParameters.WriteConvertSurfaceMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Allows choosing the unit. The default unit for Open CASCADE Technology is \"MM\" (millimeter).";
aResult += "You can choose to write a file into any unit accepted by IGES\n";
aResult += "!Default value: MM(2). Available values: \"INCH\"(1), \"MM\"(2), \"??\"(3), \"FT\"(4), \"MI\"(5), ";
aResult += "\"M\"(6), \"KM\"(7), \"MIL\"(8), \"UM\"(9), \"CM\"(10), \"UIN\"(11)\n";
aResult += aScope + "write.unit :\t " + InternalParameters.WriteUnit + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Gives the name of the author of the file\n";
aResult += "!Default value: {System name of the user}. Available values: <string>\n";

View File

@@ -157,7 +157,6 @@ public:
// Write
WriteMode_BRep WriteBRepMode = WriteMode_BRep_Faces; //<! Flag to define entities type to write
WriteMode_ConvertSurface WriteConvertSurfaceMode = WriteMode_ConvertSurface_Off; //<! Flag to convert surface to elementary
UnitsMethods_LengthUnit WriteUnit = UnitsMethods_LengthUnit_Millimeter; //<! Define unit to write IGES file
TCollection_AsciiString WriteHeaderAuthor; //<! Name of the author of the file
TCollection_AsciiString WriteHeaderCompany; //<! Name of the sending company
TCollection_AsciiString WriteHeaderProduct; //<! Name of the sending product

View File

@@ -90,7 +90,6 @@ void IGESCAFControl_Provider::initStatic(const Handle(DE_ConfigurationNode)& the
myOldValues.WriteBRepMode = (IGESCAFControl_ConfigurationNode::WriteMode_BRep)Interface_Static::IVal("write.iges.brep.mode");
myOldValues.WriteConvertSurfaceMode = (IGESCAFControl_ConfigurationNode::WriteMode_ConvertSurface)Interface_Static::IVal("write.convertsurface.mode");
myOldValues.WriteUnit = (UnitsMethods_LengthUnit)Interface_Static::IVal("write.iges.unit");
myOldValues.WriteHeaderAuthor = Interface_Static::CVal("write.iges.header.author");
myOldValues.WriteHeaderCompany = Interface_Static::CVal("write.iges.header.company");
myOldValues.WriteHeaderProduct = Interface_Static::CVal("write.iges.header.product");
@@ -135,7 +134,6 @@ void IGESCAFControl_Provider::setStatic(const IGESCAFControl_ConfigurationNode::
Interface_Static::SetIVal("write.iges.brep.mode", theParameter.WriteBRepMode);
Interface_Static::SetIVal("write.convertsurface.mode", theParameter.WriteConvertSurfaceMode);
Interface_Static::SetIVal("write.iges.unit", theParameter.WriteUnit);
Interface_Static::SetCVal("write.iges.header.author", theParameter.WriteHeaderAuthor.ToCString());
Interface_Static::SetCVal("write.iges.header.company", theParameter.WriteHeaderCompany.ToCString());
Interface_Static::SetCVal("write.iges.header.product", theParameter.WriteHeaderProduct.ToCString());
@@ -232,8 +230,26 @@ bool IGESCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
Handle(IGESCAFControl_ConfigurationNode) aNode = Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
personizeWS(theWS);
initStatic(aNode);
XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->InternalParameters.WriteUnit, UnitsMethods_LengthUnit_Millimeter);
IGESCAFControl_Writer aWriter(theWS);
Standard_Integer aFlag = IGESData_BasicEditor::GetFlagByValue(aNode->GlobalParameters.LengthUnit);
IGESCAFControl_Writer aWriter(theWS, (aFlag > 0) ? IGESData_BasicEditor::UnitFlagName(aFlag) : "MM");
IGESData_GlobalSection aGS = aWriter.Model()->GlobalSection();
Standard_Real aScaleFactorMM = 1.;
Standard_Boolean aHasUnits = XCAFDoc_DocumentTool::GetLengthUnit(theDocument, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter);
if (aHasUnits)
{
aGS.SetCascadeUnit(aScaleFactorMM);
}
else
{
aGS.SetCascadeUnit(aNode->GlobalParameters.SystemUnit);
Message::SendWarning() << "Warning in the IGESCAFControl_Provider during writing the file " <<
thePath << "\t: The document has no information on Units. Using global parameter as initial Unit.";
}
if (aFlag == 0)
{
aGS.SetScale(aNode->GlobalParameters.LengthUnit);
}
aWriter.Model()->SetGlobalSection(aGS);
aWriter.SetColorMode(aNode->InternalParameters.WriteColor);
aWriter.SetNameMode(aNode->InternalParameters.WriteName);
aWriter.SetLayerMode(aNode->InternalParameters.WriteLayer);
@@ -342,10 +358,16 @@ bool IGESCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
}
Handle(IGESCAFControl_ConfigurationNode) aNode = Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
initStatic(aNode);
TCollection_AsciiString aUnit(UnitsMethods::DumpLengthUnit(aNode->InternalParameters.WriteUnit));
aUnit.UpperCase();
IGESControl_Writer aWriter(aUnit.ToCString(),
aNode->InternalParameters.WriteBRepMode);
Standard_Integer aFlag = IGESData_BasicEditor::GetFlagByValue(aNode->GlobalParameters.LengthUnit);
IGESControl_Writer aWriter((aFlag > 0) ? IGESData_BasicEditor::UnitFlagName(aFlag) : "MM",
aNode->InternalParameters.WriteBRepMode);
IGESData_GlobalSection aGS = aWriter.Model()->GlobalSection();
aGS.SetCascadeUnit(aNode->GlobalParameters.SystemUnit);
if (!aFlag)
{
aGS.SetScale(aNode->GlobalParameters.LengthUnit);
}
aWriter.Model()->SetGlobalSection(aGS);
Standard_Boolean aIsOk = aWriter.AddShape(theShape);
if (!aIsOk)
{

View File

@@ -134,6 +134,23 @@ IGESCAFControl_Writer::IGESCAFControl_Writer (const Handle(XSControl_WorkSession
// SetWS (WS,scratch); // this should be the only required command here
}
//=======================================================================
//function : IGESCAFControl_Writer
//purpose :
//=======================================================================
IGESCAFControl_Writer::IGESCAFControl_Writer(const Handle(XSControl_WorkSession)& WS,
const Standard_CString theUnit)
:IGESControl_Writer(theUnit)
{
WS->SetModel(Model());
WS->SetMapWriter(TransferProcess());
myColorMode = Standard_True;
myNameMode = Standard_True;
myLayerMode = Standard_True;
}
//=======================================================================
//function : Transfer
//purpose :

View File

@@ -65,6 +65,11 @@ public:
//! Creates a reader tool and attaches it to an already existing Session
//! Clears the session if it was not yet set for IGES
Standard_EXPORT IGESCAFControl_Writer(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
//! Creates a reader tool and attaches it to an already existing Session
//! Clears the session if it was not yet set for IGES
//! Sets target Unit for the writing process.
Standard_EXPORT IGESCAFControl_Writer(const Handle(XSControl_WorkSession)& theWS, const Standard_CString theUnit);
//! Transfers a document to a IGES model
//! Returns True if translation is OK

View File

@@ -92,17 +92,27 @@ void IGESData_BasicEditor::Init (const Handle(IGESData_IGESModel)& model, const
//#73 rln 10.03.99 S4135: "read.scale.unit" does not affect GlobalSection
//if (Interface_Static::IVal("read.scale.unit") == 1) vmm = vmm * 1000.;
// vmm est exprime en MILLIMETRES
if (vmm >= 25. && vmm <= 26. ) return SetUnitFlag(1);
if (vmm >= 0.9 && vmm <= 1.1 ) return SetUnitFlag(2);
if (vmm >= 300. && vmm <= 310. ) return SetUnitFlag(4);
if (vmm >= 1600000. && vmm <= 1620000. ) return SetUnitFlag(5);
if (vmm >= 990. && vmm <= 1010. ) return SetUnitFlag(6);
if (vmm >= 990000. && vmm <= 1010000. ) return SetUnitFlag(7);
if (vmm >= 0.025 && vmm <= 0.026 ) return SetUnitFlag(8);
if (vmm >= 0.0009 && vmm <= 0.0011 ) return SetUnitFlag(9);
if (vmm >= 9. && vmm <= 11. ) return SetUnitFlag(10);
if (vmm >= 0.000025 && vmm <= 0.000026) return SetUnitFlag(11);
return Standard_False;
Standard_Integer aFlag = GetFlagByValue(vmm);
return (aFlag > 0) ? SetUnitFlag(aFlag) : Standard_False;
}
//=======================================================================
//function : GetFlagByValue
//purpose :
//=======================================================================
Standard_Integer IGESData_BasicEditor::GetFlagByValue(const Standard_Real theValue)
{
if (theValue >= 25. && theValue <= 26.) return 1;
if (theValue >= 0.9 && theValue <= 1.1) return 2;
if (theValue >= 300. && theValue <= 310.) return 4;
if (theValue >= 1600000. && theValue <= 1620000.) return 5;
if (theValue >= 990. && theValue <= 1010.) return 6;
if (theValue >= 990000. && theValue <= 1010000.) return 7;
if (theValue >= 0.025 && theValue <= 0.026) return 8;
if (theValue >= 0.0009 && theValue <= 0.0011) return 9;
if (theValue >= 9. && theValue <= 11.) return 10;
if (theValue >= 0.000025 && theValue <= 0.000026) return 11;
return 0;
}
//=======================================================================

View File

@@ -131,6 +131,10 @@ public:
//! Returns the maximum allowed value for Drafting Flag
Standard_EXPORT static Standard_Integer DraftingMax();
//! Returns Flag corresponding to the scaling theValue.
//! Returns 0 if there's no such flag.
Standard_EXPORT static Standard_Integer GetFlagByValue(const Standard_Real theValue);

View File

@@ -1251,6 +1251,7 @@ bool Image_AlienPixMap::Save (Standard_Byte* theBuffer,
}
return true;
#else
(void)theLength;
if (theBuffer != NULL)
{
Message::SendFail ("Error: no image library available");
@@ -1450,6 +1451,8 @@ bool Image_AlienPixMap::Save (std::ostream& theStream, const TCollection_AsciiSt
}
return true;
#else
(void)theExtension;
(void)theStream;
Message::SendFail ("Error: no image library available");
return false;
#endif

View File

@@ -977,7 +977,7 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
fprm=aSeqFprm(i);
lprm=aSeqLprm(i);
//
Standard_Real aRealEpsilon=RealEpsilon();
constexpr Standard_Real aRealEpsilon=RealEpsilon();
if (Abs(fprm) > aRealEpsilon || Abs(lprm-2.*M_PI) > aRealEpsilon) {
//==============================================
////

View File

@@ -89,8 +89,8 @@ void LocOpe_CSIntersector::Perform(const LocOpe_SequenceOfLin& Slin)
myPoints =
(LocOpe_SequenceOfPntFace *) new LocOpe_SequenceOfPntFace[myNbelem];
Standard_Real binf = RealFirst();
Standard_Real bsup = RealLast();
constexpr Standard_Real binf = RealFirst();
constexpr Standard_Real bsup = RealLast();
TopExp_Explorer exp(myShape,TopAbs_FACE);
for (; exp.More(); exp.Next()) {
const TopoDS_Face& theface = TopoDS::Face(exp.Current());

View File

@@ -50,6 +50,85 @@
IMPLEMENT_STANDARD_RTTIEXT(MeshVS_MeshPrsBuilder,MeshVS_PrsBuilder)
namespace
{
//================================================================
// Function : ProcessFace
// Purpose : Fill array with triangles for the face
//================================================================
static void ProcessFace(const Handle(MeshVS_HArray1OfSequenceOfInteger)& theTopo,
const TColStd_Array1OfReal& theNodes,
const Standard_Real* theCenter,
const Standard_Real theShrinkCoef,
const Standard_Boolean theIsShrinked,
const Standard_Boolean theIsShaded,
Handle(Graphic3d_ArrayOfPrimitives) theArray)
{
for (Standard_Integer aFaceIdx = theTopo->Lower(); aFaceIdx <= theTopo->Upper(); ++aFaceIdx)
{
const TColStd_SequenceOfInteger& aFaceNodes = theTopo->Value (aFaceIdx);
const Standard_Integer aNbPolyNodes = aFaceNodes.Length();
Standard_Real* aPolyNodesBuf = (Standard_Real*) alloca ((3 * aNbPolyNodes + 1) * sizeof (Standard_Real));
TColStd_Array1OfReal aPolyNodes (*aPolyNodesBuf, 0, 3 * aNbPolyNodes);
for (Standard_Integer aNodeIdx = 0; aNodeIdx < aNbPolyNodes; ++aNodeIdx)
{
Standard_Integer anIdx = aFaceNodes.Value (aNodeIdx + 1);
Standard_Real aX = theNodes.Value (theNodes.Lower() + 3 * anIdx + 0);
Standard_Real aY = theNodes.Value (theNodes.Lower() + 3 * anIdx + 1);
Standard_Real aZ = theNodes.Value (theNodes.Lower() + 3 * anIdx + 2);
if (theIsShrinked)
{
aX = theCenter[0] + theShrinkCoef * (aX - theCenter[0]);
aY = theCenter[1] + theShrinkCoef * (aY - theCenter[1]);
aZ = theCenter[2] + theShrinkCoef * (aZ - theCenter[2]);
}
aPolyNodes.SetValue (3 * aNodeIdx + 1, aX);
aPolyNodes.SetValue (3 * aNodeIdx + 2, aY);
aPolyNodes.SetValue (3 * aNodeIdx + 3, aZ);
}
gp_Vec aNorm;
if (theIsShaded)
{
aPolyNodes.SetValue (0, aNbPolyNodes);
if (!MeshVS_Tool::GetAverageNormal (aPolyNodes, aNorm))
{
aNorm.SetCoord (0.0, 0.0, 1.0);
}
}
for (Standard_Integer aNodeIdx = 0; aNodeIdx < aNbPolyNodes - 2; ++aNodeIdx) // triangulate polygon
{
for (Standard_Integer aSubIdx = 0; aSubIdx < 3; ++aSubIdx) // generate sub-triangle
{
if (theIsShaded)
{
theArray->AddVertex (aPolyNodes.Value (3 * (aSubIdx == 0 ? 0 : (aNodeIdx + aSubIdx)) + 1),
aPolyNodes.Value (3 * (aSubIdx == 0 ? 0 : (aNodeIdx + aSubIdx)) + 2),
aPolyNodes.Value (3 * (aSubIdx == 0 ? 0 : (aNodeIdx + aSubIdx)) + 3),
aNorm.X(),
aNorm.Y(),
aNorm.Z());
}
else
{
theArray->AddVertex (aPolyNodes.Value (3 * (aSubIdx == 0 ? 0 : (aNodeIdx + aSubIdx)) + 1),
aPolyNodes.Value (3 * (aSubIdx == 0 ? 0 : (aNodeIdx + aSubIdx)) + 2),
aPolyNodes.Value (3 * (aSubIdx == 0 ? 0 : (aNodeIdx + aSubIdx)) + 3));
}
}
}
}
}
}
//================================================================
// Function : Constructor MeshVS_MeshPrsBuilder
// Purpose :
@@ -838,68 +917,7 @@ void MeshVS_MeshPrsBuilder::AddVolumePrs (const Handle(MeshVS_HArray1OfSequenceO
if (aIsPolygons)
{
for (Standard_Integer aFaceIdx = theTopo->Lower(), topoup = theTopo->Upper(); aFaceIdx <= topoup; ++aFaceIdx)
{
const TColStd_SequenceOfInteger& aFaceNodes = theTopo->Value (aFaceIdx);
const Standard_Integer aNbPolyNodes = aFaceNodes.Length();
Standard_Real* aPolyNodesBuf = (Standard_Real*) alloca ((3 * aNbPolyNodes + 1) * sizeof (Standard_Real));
TColStd_Array1OfReal aPolyNodes (*aPolyNodesBuf, 0, 3 * aNbPolyNodes);
for (Standard_Integer aNodeIdx = 0; aNodeIdx < aNbPolyNodes; ++aNodeIdx)
{
Standard_Integer anIdx = aFaceNodes.Value (aNodeIdx + 1);
Standard_Real aX = theNodes.Value (aLow + 3 * anIdx + 0);
Standard_Real aY = theNodes.Value (aLow + 3 * anIdx + 1);
Standard_Real aZ = theNodes.Value (aLow + 3 * anIdx + 2);
if (theIsShrinked)
{
aX = aCenter[0] + theShrinkCoef * (aX - aCenter[0]);
aY = aCenter[1] + theShrinkCoef * (aY - aCenter[1]);
aZ = aCenter[2] + theShrinkCoef * (aZ - aCenter[2]);
}
aPolyNodes.SetValue (3 * aNodeIdx + 1, aX);
aPolyNodes.SetValue (3 * aNodeIdx + 2, aY);
aPolyNodes.SetValue (3 * aNodeIdx + 3, aZ);
}
gp_Vec aNorm;
if (theIsShaded)
{
aPolyNodes.SetValue (0, aNbPolyNodes);
if (!MeshVS_Tool::GetAverageNormal (aPolyNodes, aNorm))
{
aNorm.SetCoord (0.0, 0.0, 1.0);
}
}
for (Standard_Integer aNodeIdx = 0; aNodeIdx < aNbPolyNodes - 2; ++aNodeIdx) // triangulate polygon
{
for (Standard_Integer aSubIdx = 0; aSubIdx < 3; ++aSubIdx) // generate sub-triangle
{
if (theIsShaded)
{
theArray->AddVertex (aPolyNodes.Value (3 * (aSubIdx == 0 ? 0 : (aNodeIdx + aSubIdx)) + 1),
aPolyNodes.Value (3 * (aSubIdx == 0 ? 0 : (aNodeIdx + aSubIdx)) + 2),
aPolyNodes.Value (3 * (aSubIdx == 0 ? 0 : (aNodeIdx + aSubIdx)) + 3),
aNorm.X(),
aNorm.Y(),
aNorm.Z());
}
else
{
theArray->AddVertex (aPolyNodes.Value (3 * (aSubIdx == 0 ? 0 : (aNodeIdx + aSubIdx)) + 1),
aPolyNodes.Value (3 * (aSubIdx == 0 ? 0 : (aNodeIdx + aSubIdx)) + 2),
aPolyNodes.Value (3 * (aSubIdx == 0 ? 0 : (aNodeIdx + aSubIdx)) + 3));
}
}
}
}
ProcessFace (theTopo, theNodes, aCenter, theShrinkCoef, theIsShrinked, theIsShaded, theArray);
}
else if (theIsSelected)
{

View File

@@ -79,7 +79,8 @@ public:
static inline Standard_Integer getNearestPow2( Standard_Integer theValue )
{
// Precaution against overflow
Standard_Integer aHalfMax = IntegerLast() >> 1, aRes = 1;
constexpr Standard_Integer aHalfMax = IntegerLast() >> 1;
Standard_Integer aRes = 1;
if ( theValue > aHalfMax ) theValue = aHalfMax;
while ( aRes < theValue ) aRes <<= 1;
return aRes;

View File

@@ -240,7 +240,7 @@ public: //! @name public methods
}
//! Assignment operator
NCollection_DynamicArray& operator= (NCollection_DynamicArray&& theOther)
NCollection_DynamicArray& operator= (NCollection_DynamicArray&& theOther) noexcept
{
return Assign(std::forward<NCollection_DynamicArray>(theOther));
}

View File

@@ -81,7 +81,7 @@ public:
NCollection_UtfString (const NCollection_UtfString& theCopy);
//! Move constructor
NCollection_UtfString (NCollection_UtfString&& theOther);
NCollection_UtfString (NCollection_UtfString&& theOther) noexcept;
//! Copy constructor from UTF-8 string.
//! @param theCopyUtf8 UTF-8 string to copy

View File

@@ -95,7 +95,7 @@ NCollection_UtfString<Type>::NCollection_UtfString (const NCollection_UtfString&
// purpose :
// =======================================================================
template<typename Type> inline
NCollection_UtfString<Type>::NCollection_UtfString (NCollection_UtfString&& theOther)
NCollection_UtfString<Type>::NCollection_UtfString (NCollection_UtfString&& theOther) noexcept
: myString(theOther.myString),
mySize (theOther.mySize),
myLength(theOther.myLength)

View File

@@ -118,7 +118,7 @@ public:
//! you can use :
//! If ( Abs( D1.D2 ) < Precision::Angular() ) ...
//! (although the function IsNormal does exist).
static Standard_Real Angular() { return 1.e-12; }
static constexpr Standard_Real Angular() { return 1.e-12; }
//! Returns the recommended precision value when
//! checking coincidence of two points in real space.
@@ -160,11 +160,11 @@ public:
//! distance (1 / 10 millimeter). This distance
//! becomes easily measurable, but only within a restricted
//! space which contains some small objects of the complete scene.
static Standard_Real Confusion() { return 1.e-7; }
static constexpr Standard_Real Confusion() { return 1.e-7; }
//! Returns square of Confusion.
//! Created for speed and convenience.
static Standard_Real SquareConfusion() { return Confusion() * Confusion(); }
static constexpr Standard_Real SquareConfusion() { return Confusion() * Confusion(); }
//! Returns the precision value in real space, frequently
//! used by intersection algorithms to decide that a solution is reached.
@@ -188,7 +188,7 @@ public:
//! The tolerance of intersection is equal to :
//! Precision::Confusion() / 100.
//! (that is, 1.e-9).
static Standard_Real Intersection() { return Confusion() * 0.01; }
static constexpr Standard_Real Intersection() { return Confusion() * 0.01; }
//! Returns the precision value in real space, frequently used
//! by approximation algorithms.
@@ -203,14 +203,14 @@ public:
//! (that is, 1.e-6).
//! You may use a smaller tolerance in an approximation
//! algorithm, but this option might be costly.
static Standard_Real Approximation() { return Confusion() * 10.0; }
static constexpr Standard_Real Approximation() { return Confusion() * 10.0; }
//! Convert a real space precision to a parametric
//! space precision. <T> is the mean value of the
//! length of the tangent of the curve or the surface.
//!
//! Value is P / T
static Standard_Real Parametric (const Standard_Real P, const Standard_Real T) { return P / T; }
static inline Standard_Real Parametric (const Standard_Real P, const Standard_Real T) { return P / T; }
//! Returns a precision value in parametric space, which may be used :
//! - to test the coincidence of two points in the real space,
@@ -256,11 +256,11 @@ public:
//! 2.Pi without impacting on the resulting point.
//! Therefore, take great care when adjusting a parametric
//! tolerance to your own algorithm.
static Standard_Real PConfusion (const Standard_Real T) { return Parametric (Confusion(), T); }
static inline Standard_Real PConfusion (const Standard_Real T) { return Parametric (Confusion(), T); }
//! Returns square of PConfusion.
//! Created for speed and convenience.
static Standard_Real SquarePConfusion() { return PConfusion() * PConfusion(); }
static constexpr Standard_Real SquarePConfusion() { return PConfusion() * PConfusion(); }
//! Returns a precision value in parametric space, which
//! may be used by intersection algorithms, to decide that
@@ -275,7 +275,7 @@ public:
//! segment whose length is equal to 100. (default value), or T.
//! The parametric tolerance of intersection is equal to :
//! - Precision::Intersection() / 100., or Precision::Intersection() / T.
static Standard_Real PIntersection (const Standard_Real T) { return Parametric(Intersection(),T); }
static inline Standard_Real PIntersection (const Standard_Real T) { return Parametric(Intersection(),T); }
//! Returns a precision value in parametric space, which may
//! be used by approximation algorithms. The purpose of this
@@ -290,47 +290,47 @@ public:
//! segment whose length is equal to 100. (default value), or T.
//! The parametric tolerance of intersection is equal to :
//! - Precision::Approximation() / 100., or Precision::Approximation() / T.
static Standard_Real PApproximation (const Standard_Real T) { return Parametric(Approximation(),T); }
static inline Standard_Real PApproximation (const Standard_Real T) { return Parametric(Approximation(),T); }
//! Convert a real space precision to a parametric
//! space precision on a default curve.
//!
//! Value is Parametric(P,1.e+2)
static Standard_Real Parametric (const Standard_Real P) { return Parametric (P, 100.0); }
static inline Standard_Real Parametric (const Standard_Real P) { return P * 0.01; }
//! Used to test distances in parametric space on a
//! default curve.
//!
//! This is Precision::Parametric(Precision::Confusion())
static Standard_Real PConfusion() { return Parametric (Confusion()); }
static constexpr Standard_Real PConfusion() { return Confusion() * 0.01; }
//! Used for Intersections in parametric space on a
//! default curve.
//!
//! This is Precision::Parametric(Precision::Intersection())
static Standard_Real PIntersection() { return Parametric (Intersection()); }
static constexpr Standard_Real PIntersection() { return Intersection() * 0.01; }
//! Used for Approximations in parametric space on a
//! default curve.
//!
//! This is Precision::Parametric(Precision::Approximation())
static Standard_Real PApproximation() { return Parametric (Approximation()); }
static constexpr Standard_Real PApproximation() { return Approximation() * 0.01; }
//! Returns True if R may be considered as an infinite
//! number. Currently Abs(R) > 1e100
static Standard_Boolean IsInfinite (const Standard_Real R) { return Abs (R) >= (0.5 * Precision::Infinite()); }
static inline Standard_Boolean IsInfinite (const Standard_Real R) { return Abs (R) >= (0.5 * Precision::Infinite()); }
//! Returns True if R may be considered as a positive
//! infinite number. Currently R > 1e100
static Standard_Boolean IsPositiveInfinite (const Standard_Real R) { return R >= (0.5 * Precision::Infinite()); }
static inline Standard_Boolean IsPositiveInfinite (const Standard_Real R) { return R >= (0.5 * Precision::Infinite()); }
//! Returns True if R may be considered as a negative
//! infinite number. Currently R < -1e100
static Standard_Boolean IsNegativeInfinite (const Standard_Real R) { return R <= -(0.5 * Precision::Infinite()); }
static inline Standard_Boolean IsNegativeInfinite (const Standard_Real R) { return R <= -(0.5 * Precision::Infinite()); }
//! Returns a big number that can be considered as
//! infinite. Use -Infinite() for a negative big number.
static Standard_Real Infinite() { return 2.e+100; }
static constexpr Standard_Real Infinite() { return 2.e+100; }
};

View File

@@ -2187,10 +2187,20 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co
di << "(Integer) Overflow...";
//std::cout.flush();
di << "\n";
Standard_Integer res, i=IntegerLast();
res = i + 1;
//++++ std::cout << " -- "<<res<<"="<<i<<"+1 Does not Caught... KO"<< std::endl;
//++++ Succes = Standard_False;
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winteger-overflow"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Woverflow"
#endif
constexpr Standard_Integer i=IntegerLast();
Standard_Integer res = i + 1;
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
di << "Not caught: " << i << " + 1 = " << res << ", still OK\n";
}
catch(Standard_Overflow const&) {
@@ -2212,8 +2222,8 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co
di << "(Real) Overflow...";
//std::cout.flush();
di << "\n";
Standard_Real res, r=RealLast();
res = r * r;
constexpr Standard_Real r = RealLast();
Standard_Real res = r * r;
(void)sin(1.); //this function tests FPU flags and raises signal (tested on LINUX).
@@ -2244,8 +2254,8 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co
di << "(Real) Underflow";
//std::cout.flush();
di << "\n";
Standard_Real res, r = RealSmall();
res = r * r;
constexpr Standard_Real r = RealSmall();
Standard_Real res = r * r;
//res = res + 1.;
//++++ std::cout<<"-- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... KO"<<std::endl;
//++++ Succes = Standard_False;
@@ -4540,7 +4550,7 @@ Standard_Integer OCC17424 (Draw_Interpretor& di, Standard_Integer argc, const ch
gp_Dir dir(X_Dir, Y_Dir, Z_Dir);
gp_Lin ray(origin, dir);
Standard_Real PSup = RealLast();
constexpr Standard_Real PSup = RealLast();
intersector.PerformNearest(ray, PInf, PSup);
if (intersector.NbPnt() != 0)
{

View File

@@ -140,9 +140,20 @@ bool RWGltf_Provider::Write(const TCollection_AsciiString& thePath,
Handle(RWGltf_ConfigurationNode) aNode = Handle(RWGltf_ConfigurationNode)::DownCast(GetNode());
RWMesh_CoordinateSystemConverter aConverter;
aConverter.SetInputLengthUnit(aNode->GlobalParameters.LengthUnit / 1000);
Standard_Real aScaleFactorM = 1.;
if (!XCAFDoc_DocumentTool::GetLengthUnit(theDocument, aScaleFactorM))
{
aConverter.SetInputLengthUnit(aNode->GlobalParameters.SystemUnit / 1000.);
Message::SendWarning() << "Warning in the RWGltf_Provider during writing the file " <<
thePath << "\t: The document has no information on Units. Using global parameter as initial Unit.";
}
aConverter.SetInputCoordinateSystem(aNode->InternalParameters.SystemCS);
aConverter.SetOutputLengthUnit(aNode->InternalParameters.FileLengthUnit);
if (aNode->GlobalParameters.LengthUnit != 1000.)
{
Message::SendWarning() << "Warning in the RWGltf_Provider during writing the file " <<
thePath << "\t: Target format doesn't support custom units. Model will be scaled to Meters";
}
aConverter.SetOutputLengthUnit(1.); // gltf units always Meters
aConverter.SetOutputCoordinateSystem(aNode->InternalParameters.FileCS);
TColStd_IndexedDataMapOfStringString aFileInfo;

View File

@@ -131,9 +131,19 @@ bool RWObj_Provider::Write(const TCollection_AsciiString& thePath,
}
RWMesh_CoordinateSystemConverter aConverter;
aConverter.SetInputLengthUnit(aNode->GlobalParameters.LengthUnit / 1000);
Standard_Real aScaleFactorMM = 1.;
if (XCAFDoc_DocumentTool::GetLengthUnit(theDocument, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter))
{
aConverter.SetInputLengthUnit(aScaleFactorMM / 1000.);
}
else
{
aConverter.SetInputLengthUnit(aNode->GlobalParameters.SystemUnit / 1000.);
Message::SendWarning() << "Warning in the RWObj_Provider during writing the file " <<
thePath << "\t: The document has no information on Units. Using global parameter as initial Unit.";
}
aConverter.SetInputCoordinateSystem(aNode->InternalParameters.SystemCS);
aConverter.SetOutputLengthUnit(aNode->InternalParameters.FileLengthUnit);
aConverter.SetOutputLengthUnit(aNode->GlobalParameters.LengthUnit / 1000.);
aConverter.SetOutputCoordinateSystem(aNode->InternalParameters.FileCS);
RWObj_CafWriter aWriter(thePath);

View File

@@ -89,9 +89,19 @@ bool RWPly_Provider::Write(const TCollection_AsciiString& thePath,
aFileInfo.Add("Comments", aNode->InternalParameters.WriteComment);
}
RWMesh_CoordinateSystemConverter aConverter;
aConverter.SetInputLengthUnit(aNode->GlobalParameters.LengthUnit / 1000);
Standard_Real aScaleFactorM = 1.;
if (XCAFDoc_DocumentTool::GetLengthUnit(theDocument, aScaleFactorM))
{
aConverter.SetInputLengthUnit(aScaleFactorM);
}
else
{
aConverter.SetInputLengthUnit(aNode->GlobalParameters.SystemUnit / 1000.);
Message::SendWarning() << "Warning in the RWPly_Provider during writing the file " <<
thePath << "\t: The document has no information on Units. Using global parameter as initial Unit.";
}
aConverter.SetInputCoordinateSystem(aNode->InternalParameters.SystemCS);
aConverter.SetOutputLengthUnit(aNode->InternalParameters.FileLengthUnit);
aConverter.SetOutputLengthUnit(aNode->GlobalParameters.LengthUnit / 1000.);
aConverter.SetOutputCoordinateSystem(aNode->InternalParameters.FileCS);
RWPly_CafWriter aPlyCtx(thePath);

View File

@@ -110,6 +110,13 @@ bool RWStl_Provider::Write(const TCollection_AsciiString& thePath,
return false;
}
Handle(RWStl_ConfigurationNode) aNode = Handle(RWStl_ConfigurationNode)::DownCast(GetNode());
if (aNode->GlobalParameters.LengthUnit != 1.0)
{
Message::SendWarning() << "Warning in the RWStl_Provider during writing the file " <<
thePath << "\t: Target Units for writing were changed, but current format doesn't support scaling";
}
if (aLabels.Length() == 1)
{
aShape = aSTool->GetShape(aLabels.Value(1));
@@ -220,6 +227,11 @@ bool RWStl_Provider::Write(const TCollection_AsciiString& thePath,
return false;
}
Handle(RWStl_ConfigurationNode) aNode = Handle(RWStl_ConfigurationNode)::DownCast(GetNode());
if (aNode->GlobalParameters.LengthUnit != 1.0)
{
Message::SendWarning() << "Warning in the RWStl_Provider during writing the file " <<
thePath << "\t: Target Units for writing were changed, but current format doesn't support scaling";
}
StlAPI_Writer aWriter;
aWriter.ASCIIMode() = aNode->InternalParameters.WriteAscii;

View File

@@ -110,10 +110,6 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
return false;
}
Handle(STEPCAFControl_ConfigurationNode) aNode = Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
XCAFDoc_DocumentTool::SetLengthUnit(theDocument,
UnitsMethods::GetLengthUnitScale(aNode->InternalParameters.WriteUnit,
UnitsMethods_LengthUnit_Millimeter), UnitsMethods_LengthUnit_Millimeter);
personizeWS(theWS);
STEPCAFControl_Writer aWriter;
aWriter.Init(theWS);
@@ -124,9 +120,22 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
aWriter.SetNameMode(aNode->InternalParameters.WriteName);
aWriter.SetLayerMode(aNode->InternalParameters.WriteLayer);
aWriter.SetPropsMode(aNode->InternalParameters.WriteProps);
TDF_Label aLabel;
StepData_ConfParameters aParams;
Standard_Real aScaleFactorMM = 1.;
if (XCAFDoc_DocumentTool::GetLengthUnit(theDocument, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter))
{
aModel->SetLocalLengthUnit(aScaleFactorMM);
}
else
{
aModel->SetLocalLengthUnit(aNode->GlobalParameters.SystemUnit);
Message::SendWarning() << "Warning in the STEPCAFControl_Provider during writing the file " <<
thePath << "\t: The document has no information on Units. Using global parameter as initial Unit.";
}
UnitsMethods_LengthUnit aTargetUnit = UnitsMethods::GetLengthUnitByFactorValue(aNode->GlobalParameters.LengthUnit, UnitsMethods_LengthUnit_Millimeter);
aParams.WriteUnit = aTargetUnit;
aModel->SetWriteLengthUnit(aNode->GlobalParameters.LengthUnit);
TDF_Label aLabel;
if (!aWriter.Transfer(theDocument, aParams, aMode, 0, theProgress))
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
@@ -242,9 +251,20 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
STEPControl_Writer aWriter;
aWriter.SetWS(theWS);
IFSelect_ReturnStatus aWritestat = IFSelect_RetVoid;
Handle(StepData_StepModel) aModel = aWriter.Model();
aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(aNode->InternalParameters.WriteUnit, UnitsMethods_LengthUnit_Millimeter));
Handle(StepData_StepModel) aModel = aWriter.Model();;
StepData_ConfParameters aParams;
aModel->SetLocalLengthUnit(aNode->GlobalParameters.SystemUnit);
UnitsMethods_LengthUnit aTargetUnit = UnitsMethods::GetLengthUnitByFactorValue(aNode->GlobalParameters.LengthUnit, UnitsMethods_LengthUnit_Millimeter);
aParams.WriteUnit = aTargetUnit;
if (aTargetUnit == UnitsMethods_LengthUnit_Undefined)
{
aModel->SetWriteLengthUnit(1.0);
Message::SendWarning() << "Custom units are not supported by STEP format, but LengthUnit global parameter doesn't fit any predefined unit. Units will be scaled to Millimeters";
}
else
{
aModel->SetWriteLengthUnit(aNode->GlobalParameters.LengthUnit);
}
aWritestat = aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, aParams, true, theProgress);
if (aWritestat != IFSelect_RetDone)
{

View File

@@ -142,11 +142,7 @@ TopoDS_Shape ShapeCustom::ApplyModifier (const TopoDS_Shape &S,
res = ApplyModifier (shape, M, context, MD, aRange, aReShape);
}
if ( !res.IsSame (shape) )
{
context.Bind (aShapeNoLoc, res.Located (TopLoc_Location()));
locModified = Standard_True;
}
locModified |= !res.IsSame (shape);
B.Add (C, res);
}
@@ -162,10 +158,18 @@ TopoDS_Shape ShapeCustom::ApplyModifier (const TopoDS_Shape &S,
return S;
}
context.Bind ( SF, C );
SF.Orientation (S.Orientation());
C .Orientation (S.Orientation());
context.Bind (SF, C);
C.Location (S.Location(), Standard_False);
if (!aReShape.IsNull())
{
aReShape->Replace (S, C);
}
C.Orientation (S.Orientation());
C.Location (S.Location(), Standard_False);
return C;
}
@@ -175,12 +179,21 @@ TopoDS_Shape ShapeCustom::ApplyModifier (const TopoDS_Shape &S,
MD.Perform(M, aPS.Next());
if ( !aPS.More() || !MD.IsDone() ) return S;
TopoDS_Shape aResult = MD.ModifiedShape (SF);
aResult.Orientation (S.Orientation());
if (!SF.IsSame (aResult))
{
context.Bind (S.Located (TopLoc_Location()), aResult.Located (TopLoc_Location()));
}
if ( !aReShape.IsNull() )
{
UpdateShapeBuild ( SF, MD, aReShape );
}
return MD.ModifiedShape(SF).Oriented(S.Orientation());
return aResult;
}

View File

@@ -60,9 +60,8 @@ constexpr Standard_ShortReal ShortRealEpsilon()
//-------------------------------------------------------------------
// ShortRealFirst : Returns the minimum negative value of a ShortReal
//-------------------------------------------------------------------
inline Standard_ShortReal ShortRealFirst()
{ Standard_ShortReal MaxFloatTmp = -FLT_MAX;
return MaxFloatTmp; }
constexpr Standard_ShortReal ShortRealFirst()
{ return -FLT_MAX; }
//-------------------------------------------------------------------
// ShortRealFirst10Exp : Returns the minimum value of exponent(base 10) of

View File

@@ -562,40 +562,54 @@ void StdSelect_BRepSelectionTool::GetEdgeSensitive (const TopoDS_Shape& theShape
}
//=======================================================================
//function : getCylinderCircles
//function : getCylinderHeight
//purpose :
//=======================================================================
static NCollection_Array1<gp_Circ> getCylinderCircles (const TopoDS_Face& theHollowCylinder, Standard_Size& theNumCircles)
static Standard_Real getCylinderHeight (const Handle(Poly_Triangulation)& theTriangulation,
const TopLoc_Location& theLoc)
{
NCollection_Array1<gp_Circ> aCircles (1, 2);
theNumCircles = 0;
Standard_Integer aLinesNb = 0;
Bnd_Box aBox;
gp_Trsf aScaleTrsf;
aScaleTrsf.SetScaleFactor (theLoc.Transformation().ScaleFactor());
theTriangulation->MinMax (aBox, aScaleTrsf);
return aBox.CornerMax().Z() - aBox.CornerMin().Z();
}
//=======================================================================
//function : isCylinderOrCone
//purpose :
//=======================================================================
static Standard_Boolean isCylinderOrCone (const TopoDS_Face& theHollowCylinder, const gp_Pnt& theLocation, gp_Dir& theDirection)
{
Standard_Integer aCirclesNb = 0;
Standard_Boolean isCylinder = Standard_False;
gp_Pnt aPos;
TopExp_Explorer anEdgeExp;
for (anEdgeExp.Init (theHollowCylinder, TopAbs_EDGE); anEdgeExp.More(); anEdgeExp.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge (anEdgeExp.Current());
BRepAdaptor_Curve anAdaptor (anEdge);
aLinesNb++;
if (anAdaptor.GetType() == GeomAbs_Circle
&& BRep_Tool::IsClosed (anEdge))
{
theNumCircles++;
aCircles[theNumCircles] = anAdaptor.Circle();
}
else if (anAdaptor.GetType() != GeomAbs_Line || aLinesNb > 4)
{
theNumCircles = 0;
return NCollection_Array1<gp_Circ>();
}
if (theNumCircles == 2)
{
break;
aCirclesNb++;
isCylinder = Standard_True;
if (aCirclesNb == 2)
{
// Reverse the direction of the cylinder, relevant if the cylinder was created as a prism
if (aPos.IsEqual (theLocation, Precision::Confusion()))
{
theDirection.Reverse();
}
return Standard_True;
}
aPos = anAdaptor.Circle().Location().XYZ();
}
}
return aCircles;
return isCylinder;
}
//=======================================================================
@@ -644,33 +658,29 @@ Standard_Boolean StdSelect_BRepSelectionTool::GetSensitiveForFace (const TopoDS_
}
else if (Handle(Geom_ConicalSurface) aGeomCone = Handle(Geom_ConicalSurface)::DownCast (aSurf))
{
Standard_Size aNumCircles;
NCollection_Array1<gp_Circ> aCircles = getCylinderCircles (theFace, aNumCircles);
if (aNumCircles > 0 && aNumCircles < 3)
gp_Dir aDummyDir;
if (isCylinderOrCone (theFace, gp_Pnt(), aDummyDir))
{
const gp_Cone aCone = BRepAdaptor_Surface (theFace).Cone();
const Standard_Real aRad1 = aCone.RefRadius();
const Standard_Real aHeight = getCylinderHeight (aTriangulation, aLoc);
gp_Trsf aTrsf;
Standard_Real aRad1;
aTrsf.SetTransformation (aCone.Position(), gp::XOY());
Standard_Real aRad2;
Standard_Real aHeight;
if (aNumCircles == 1)
if (aRad1 == 0.0)
{
aRad1 = 0.0;
aRad2 = aCircles.First().Radius();
aHeight = aRad2 * Tan (aCone.SemiAngle());
aTrsf.SetTransformation (aCone.Position(), gp::XOY());
aRad2 = Tan (aCone.SemiAngle()) * aHeight;
}
else
{
aRad1 = aCircles.First().Radius();
aRad2 = aCircles.Last().Radius();
aHeight = aCircles.First().Location().Distance (aCircles.Last().Location());
const gp_Pnt aPos = aCircles.First().Location();
const gp_Dir aDirection (aCircles.Last().Location().XYZ() - aPos.XYZ());
aTrsf.SetTransformation (gp_Ax3(aPos, aDirection), gp::XOY());
const Standard_Real aTriangleHeight = (aCone.SemiAngle() > 0.0)
? aRad1 / Tan (aCone.SemiAngle())
: aRad1 / Tan (Abs (aCone.SemiAngle())) - aHeight;
aRad2 = (aCone.SemiAngle() > 0.0)
? aRad1 * (aTriangleHeight + aHeight) / aTriangleHeight
: aRad1 * aTriangleHeight / (aTriangleHeight + aHeight);
}
Handle(Select3D_SensitiveCylinder) aSensSCyl = new Select3D_SensitiveCylinder (theOwner, aRad1, aRad2, aHeight, aTrsf, true);
@@ -680,19 +690,18 @@ Standard_Boolean StdSelect_BRepSelectionTool::GetSensitiveForFace (const TopoDS_
}
else if (Handle(Geom_CylindricalSurface) aGeomCyl = Handle(Geom_CylindricalSurface)::DownCast (aSurf))
{
Standard_Size aNumCircles;
NCollection_Array1<gp_Circ> aCircles = getCylinderCircles (theFace, aNumCircles);
if (aNumCircles == 2)
{
const gp_Cylinder aCyl = BRepAdaptor_Surface (theFace).Cylinder();
const gp_Cylinder aCyl = BRepAdaptor_Surface (theFace).Cylinder();
gp_Ax3 aPos = aCyl.Position();
gp_Dir aDirection = aPos.Direction();
if (isCylinderOrCone (theFace, aPos.Location(), aDirection))
{
const Standard_Real aRad = aCyl.Radius();
const gp_Pnt aPos = aCircles.First().Location();
const gp_Dir aDirection (aCircles.Last().Location().XYZ() - aPos.XYZ());
const Standard_Real aHeight = aPos.Distance (aCircles.Last().Location());
const Standard_Real aHeight = getCylinderHeight (aTriangulation, aLoc);
gp_Trsf aTrsf;
aTrsf.SetTransformation (gp_Ax3 (aPos, aDirection), gp::XOY());
aPos.SetDirection (aDirection);
aTrsf.SetTransformation (aPos, gp::XOY());
Handle(Select3D_SensitiveCylinder) aSensSCyl = new Select3D_SensitiveCylinder (theOwner, aRad, aRad, aHeight, aTrsf, true);
theSensitiveList.Append (aSensSCyl);

View File

@@ -312,7 +312,7 @@ void TopOpeBRep_FacesFiller::ProcessSectionEdges()
// ajout des aretes de section dans la DS de shape,connaissant leur rank
for (itLES.Initialize(LES),itLOI.Initialize(LOI);
itLES.More(),itLOI.More();
itLES.More() && itLOI.More();
itLES.Next(),itLOI.Next()) {
const TopoDS_Shape& E1 = itLES.Value();
Standard_Integer rE1 = itLOI.Value();

View File

@@ -566,7 +566,8 @@ Standard_Real TopOpeBRepTool_ShapeTool::EdgeData
C = BL.Curvature();
// xpu150399 cto900R4
Standard_Real tol1 = Epsilon(0.), tol2 = RealLast();
const Standard_Real tol1 = Epsilon(0.);
constexpr Standard_Real tol2 = RealLast();
Standard_Real tolm = Max(tol,Max(tol1,tol2));
if ( Abs(C) > tolm ) BL.Normal(N);

View File

@@ -134,9 +134,6 @@ void TopoDSToStep_MakeStepEdge::Init(const TopoDS_Edge& aEdge,
if ( count < 2 ) isSeam = Standard_False;
}
BRepAdaptor_Curve CA = BRepAdaptor_Curve(aEdge);
BRepAdaptor_Surface SA = BRepAdaptor_Surface(aTool.CurrentFace());
if (aEdge.Orientation() == TopAbs_INTERNAL ||
aEdge.Orientation() == TopAbs_EXTERNAL ) {
Handle(TransferBRep_ShapeMapper) errShape =
@@ -184,7 +181,7 @@ void TopoDSToStep_MakeStepEdge::Init(const TopoDS_Edge& aEdge,
// ---------------------------------------
// Translate 3D representation of the Edge
// ---------------------------------------
BRepAdaptor_Curve CA = BRepAdaptor_Curve(aEdge);
Handle(StepGeom_Curve) Gpms;
Handle(Geom_Curve) C = CA.Curve().Curve();
@@ -262,6 +259,8 @@ void TopoDSToStep_MakeStepEdge::Init(const TopoDS_Edge& aEdge,
#ifdef OCCT_DEBUG
std::cout << "Warning: TopoDSToStep_MakeStepEdge: edge without 3d curve; creating..." << std::endl;
#endif
BRepAdaptor_Surface SA = BRepAdaptor_Surface(aTool.CurrentFace());
if ((SA.GetType() == GeomAbs_Plane) &&
(CA.GetType() == GeomAbs_Line)) {
U1 = CA.FirstParameter();

View File

@@ -12619,8 +12619,7 @@ static int VManipulator (Draw_Interpretor& theDi,
{
anAttachOptions.SetAdjustSize (Draw::ParseOnOffNoIterator (theArgsNb, theArgVec, anArgIter) ? 1 : 0);
}
else if (anArg == "-enablemodes"
|| anArg == "-enablemodes")
else if (anArg == "-enablemodes")
{
anAttachOptions.SetEnableModes (Draw::ParseOnOffNoIterator (theArgsNb, theArgVec, anArgIter) ? 1 : 0);
}

View File

@@ -131,8 +131,19 @@ bool Vrml_Provider::Write(const TCollection_AsciiString& thePath,
VrmlAPI_Writer aWriter;
aWriter.SetRepresentation(static_cast<VrmlAPI_RepresentationOfShape>(aNode->InternalParameters.WriteRepresentationType));
Standard_Real aScaleFactorM = aNode->GlobalParameters.LengthUnit;
if (!aWriter.WriteDoc(theDocument, thePath.ToCString(), aScaleFactorM))
Standard_Real aScaling = 1.;
Standard_Real aScaleFactorMM = 1.;
if (XCAFDoc_DocumentTool::GetLengthUnit(theDocument, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter))
{
aScaling = aScaleFactorMM / aNode->GlobalParameters.LengthUnit;
}
else
{
aScaling = aNode->GlobalParameters.SystemUnit / aNode->GlobalParameters.LengthUnit;
Message::SendWarning() << "Warning in the Vrml_Provider during writing the file " <<
thePath << "\t: The document has no information on Units. Using global parameter as initial Unit.";
}
if (!aWriter.WriteDoc(theDocument, thePath.ToCString(), aScaling))
{
Message::SendFail() << "Error in the Vrml_Provider during wtiting the file " <<
thePath << "\t: File was not written";

View File

@@ -67,7 +67,7 @@ void math_BissecNewton::Perform(math_FunctionWithDerivative& F,
return;
}
// Modified by Sergey KHROMOV - Wed Jan 22 12:06:45 2003 Begin
Standard_Real aFTol = RealEpsilon();
constexpr Standard_Real aFTol = RealEpsilon();
// if(fl * fh >= 0.0) {
if(fl * fh > aFTol*aFTol) {

View File

@@ -15,6 +15,7 @@ global.priority.XCAF : OCC
global.priority.IGES : OCC
global.priority.PLY : OCC
global.general.length.unit : 1
global.general.system.unit : 1
provider.STEP.OCC.read.iges.bspline.continuity : 1
provider.STEP.OCC.read.precision.mode : 0
provider.STEP.OCC.read.precision.val : 0.0001

View File

@@ -15,6 +15,7 @@ global.priority.XCAF : OCC
global.priority.IGES : OCC
global.priority.PLY : OCC
global.general.length.unit : 1
global.general.system.unit : 1
provider.STEP.OCC.read.iges.bspline.continuity : 1
provider.STEP.OCC.read.precision.mode : 0
provider.STEP.OCC.read.precision.val : 0.0001

View File

@@ -20,15 +20,7 @@ if [catch {ReadGltf D0 $filename} catch_result] {
}
XGetOneShape S0 D0
param xstep.cascade.unit M
if [catch {ReadGltf D1 $filename} catch_result] {
puts "Error : Problem with reading file"
} else {
puts "OK : Reading is correct"
}
XGetOneShape S1 D1
if [catch {WriteFile D0 $write_path -conf "provider.GLTF.OCC.file.length.unit : 0.001 "} catch_result] {
if [catch {WriteFile D0 $write_path -conf "global.general.length.unit : 1 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
@@ -50,29 +42,7 @@ if [catch {readfile S3 $write_path} catch_result] {
puts "OK : Reading is correct"
}
if [catch {WriteFile D1 $write_path -conf "provider.GLTF.OCC.file.length.unit : 1 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
}
if [catch {readfile S4 $write_path -conf "global.general.length.unit : 1000 "} catch_result] {
puts "Error : Problem with reading file"
} else {
puts "OK : Reading is correct"
}
if [catch {writefile S1 $write_path} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
}
if [catch {readfile S5 $write_path} catch_result] {
puts "Error : Problem with reading file"
} else {
puts "OK : Reading is correct"
}
if [catch {WriteFile D0 $write_path -conf "provider.GLTF.OCC.file.length.unit : 0.001 "} catch_result] {
if [catch {WriteFile D0 $write_path -conf "global.general.length.unit : 1 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
@@ -84,7 +54,37 @@ if [catch {ReadFile D6 $write_path -conf "global.general.length.unit : 1 "} catc
}
XGetOneShape S6 D6
if [catch {writefile S1 $write_path -conf "provider.GLTF.OCC.file.length.unit : 1 "} catch_result] {
param xstep.cascade.unit M
if [catch {ReadGltf D1 $filename} catch_result] {
puts "Error : Problem with reading file"
} else {
puts "OK : Reading is correct"
}
XGetOneShape S1 D1
if [catch {WriteFile D1 $write_path -conf "global.general.length.unit : 1000 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
}
if [catch {readfile S4 $write_path -conf "global.general.length.unit : 1000 "} catch_result] {
puts "Error : Problem with reading file"
} else {
puts "OK : Reading is correct"
}
if [catch {writefile S1 $write_path -conf "global.general.system.unit : 1000 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
}
if [catch {readfile S5 $write_path} catch_result] {
puts "Error : Problem with reading file"
} else {
puts "OK : Reading is correct"
}
if [catch {writefile S1 $write_path -conf "global.general.length.unit : 1000 \n global.general.system.unit : 1000 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
@@ -96,7 +96,7 @@ if [catch {ReadFile D7 $write_path -conf "global.general.length.unit : 1000 "} c
}
XGetOneShape S7 D7
array set areas {0 3.18785e+06 1 3.18785 2 3.18785e+06 3 3.18785e+06 4 3.18785 5 3.18785 6 3.18785e+06 7 3.18785e-06}
array set areas {0 3.18785e+06 1 3.18785 2 3.18785e+06 3 3.18785e+06 4 3.18785 5 3.18785e+06 6 3.18785e+06 7 3.18785}
array set results {0 S0 1 S1 2 S2 3 S3 4 S4 5 S5 6 S6 7 S7}
for { set anind 0} { $anind < 8 } { incr anind } {
checkprops $results($anind) -s $areas($anind) -eps 1e-2

View File

@@ -28,7 +28,7 @@ if [catch {ReadIges D1 $filename } catch_result] {
}
XGetOneShape S1 D1
if [catch {WriteFile D0 $write_path -conf "provider.IGES.write.iges.unit : 1 "} catch_result] {
if [catch {WriteFile D0 $write_path -conf "global.general.length.unit : 25.4 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
@@ -50,7 +50,7 @@ if [catch {readfile S3 $write_path} catch_result] {
puts "OK : Reading is correct"
}
if [catch {WriteFile D1 $write_path -conf "provider.IGES.write.iges.unit : 6 "} catch_result] {
if [catch {WriteFile D1 $write_path -conf "global.general.length.unit : 1000 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
@@ -72,7 +72,7 @@ if [catch {readfile S5 $write_path} catch_result] {
puts "OK : Reading is correct"
}
if [catch {WriteFile D0 $write_path -conf "provider.IGES.write.iges.unit : 2 "} catch_result] {
if [catch {WriteFile D0 $write_path -conf "global.general.length.unit : 1 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
@@ -84,7 +84,7 @@ if [catch {ReadFile D6 $write_path -conf "global.general.length.unit : 1 "} catc
}
XGetOneShape S6 D6
if [catch {writefile S1 $write_path -conf "provider.IGES.write.iges.unit : 1 "} catch_result] {
if [catch {writefile S1 $write_path -conf "global.general.length.unit : 25.4 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
@@ -96,7 +96,7 @@ if [catch {ReadFile D7 $write_path -conf "global.general.length.unit : 0.0254 "}
}
XGetOneShape S7 D7
array set areas {0 11995.4 1 0.0119954 2 47916.8 3 11979.2 4 0.0479168 5 0.0119792 6 47916.8 7 18.5678}
array set areas {0 11995.4 1 0.0119954 2 11979.2 3 11979.2 4 11979.2 5 0.0119792 6 11979.2 7 18.5678}
array set results {0 S0 1 S1 2 S2 3 S3 4 S4 5 S5 6 S6 7 S7}
for { set anind 0} { $anind < 8 } { incr anind } {
checkprops $results($anind) -s $areas($anind) -eps 1e-2

View File

@@ -28,12 +28,12 @@ if [catch {ReadObj D1 $filename -fileUnit mm } catch_result] {
}
XGetOneShape S1 D1
if [catch {WriteFile D0 $write_path -conf "provider.OBJ.OCC.file.length.unit : 0.001 "} catch_result] {
if [catch {WriteFile D0 $write_path -conf "global.general.length.unit : 1 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
}
if [catch {readfile S2 $write_path} catch_result] {
if [catch {readfile S2 $write_path -conf "provider.OBJ.OCC.file.length.unit : 0.001 "} catch_result] {
puts "Error : Problem with reading file"
} else {
puts "OK : Reading is correct"
@@ -44,18 +44,18 @@ if [catch {writefile S0 $write_path} catch_result] {
} else {
puts "OK : Writing is correct"
}
if [catch {readfile S3 $write_path} catch_result] {
if [catch {readfile S3 $write_path -conf "provider.OBJ.OCC.file.length.unit : 0.001 "} catch_result] {
puts "Error : Problem with reading file"
} else {
puts "OK : Reading is correct"
}
if [catch {WriteFile D1 $write_path -conf "provider.OBJ.OCC.file.length.unit : 1 "} catch_result] {
if [catch {WriteFile D1 $write_path -conf "global.general.length.unit : 1000 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
}
if [catch {readfile S4 $write_path -conf "global.general.length.unit : 1000 "} catch_result] {
if [catch {readfile S4 $write_path -conf "global.general.length.unit : 1000 \n provider.OBJ.OCC.file.length.unit : 1"} catch_result] {
puts "Error : Problem with reading file"
} else {
puts "OK : Reading is correct"
@@ -66,13 +66,13 @@ if [catch {writefile S1 $write_path} catch_result] {
} else {
puts "OK : Writing is correct"
}
if [catch {readfile S5 $write_path} catch_result] {
if [catch {readfile S5 $write_path -conf "provider.OBJ.OCC.file.length.unit : 0.001 "} catch_result] {
puts "Error : Problem with reading file"
} else {
puts "OK : Reading is correct"
}
if [catch {WriteFile D0 $write_path -conf "provider.GLTF.OCC.file.length.unit : 0.001 "} catch_result] {
if [catch {WriteFile D0 $write_path -conf "global.general.length.unit : 1 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
@@ -84,12 +84,12 @@ if [catch {ReadFile D6 $write_path -conf "global.general.length.unit : 1 "} catc
}
XGetOneShape S6 D6
if [catch {writefile S1 $write_path -conf "provider.GLTF.OCC.file.length.unit : 1 "} catch_result] {
if [catch {writefile S1 $write_path -conf "global.general.length.unit : 1000 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
}
if [catch {ReadFile D7 $write_path -conf "global.general.length.unit : 1000 "} catch_result] {
if [catch {ReadFile D7 $write_path -conf "global.general.length.unit : 1000 \n provider.OBJ.OCC.file.length.unit : 1"} catch_result] {
puts "Error : Problem with reading file"
} else {
puts "OK : Reading is correct"

View File

@@ -30,7 +30,7 @@ XGetOneShape S1 D1
param xstep.cascade.unit MM
if [catch {WriteFile D0 $write_path -conf "provider.STEP.write.step.unit : 1 "} catch_result] {
if [catch {WriteFile D0 $write_path -conf "global.general.length.unit : 25.4 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
@@ -41,7 +41,7 @@ if [catch {readfile S2 $write_path } catch_result] {
puts "OK : Reading is correct"
}
if [catch {writefile S0 $write_path } catch_result] {
if [catch {writefile S0 $write_path -conf "global.general.system.unit : 1 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
@@ -52,7 +52,7 @@ if [catch {readfile S3 $write_path} catch_result] {
puts "OK : Reading is correct"
}
if [catch {WriteFile D1 $write_path -conf "provider.STEP.write.step.unit : 6 "} catch_result] {
if [catch {WriteFile D1 $write_path -conf "global.general.length.unit : 1000 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
@@ -74,7 +74,7 @@ if [catch {readfile S5 $write_path} catch_result] {
puts "OK : Reading is correct"
}
if [catch {WriteFile D0 $write_path -conf "provider.STEP.write.step.unit : 2 "} catch_result] {
if [catch {WriteFile D0 $write_path -conf "global.general.length.unit : 1 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
@@ -86,7 +86,7 @@ if [catch {ReadFile D6 $write_path -conf "global.general.length.unit : 1 "} catc
}
XGetOneShape S6 D6
if [catch {writefile S1 $write_path -conf "provider.STEP.write.step.unit : 1 "} catch_result] {
if [catch {writefile S1 $write_path -conf "global.general.length.unit : 25.4 "} catch_result] {
puts "Error : Problem with writing file"
} else {
puts "OK : Writing is correct"
@@ -98,7 +98,7 @@ if [catch {ReadFile D7 $write_path -conf "global.general.length.unit : 0.0254"}
}
XGetOneShape S7 D7
array set areas {0 2.52381e+06 1 2.52381 2 2.52381e+06 3 2.52381e+06 4 2.52381 5 2.52381 6 2.52381e+06 7 3911.92}
array set areas {0 2.52381e+06 1 2.52381 2 2.52381e+06 3 2.52381e+06 4 2.52381e+06 5 2.52381 6 2.52381e+06 7 3911.92}
array set results {0 S0 1 S1 2 S2 3 S3 4 S4 5 S5 6 S6 7 S7}
for { set anind 0} { $anind < 8 } { incr anind } {
checkprops $results($anind) -s $areas($anind) -eps 1e-2

View File

@@ -98,7 +98,7 @@ if [catch {ReadFile D7 $write_path -conf "provider.VRML.OCC.read.file.unit : 0.0
}
XGetOneShape S7 D7
array set areas {0 5.3415e+06 1 5.3415 2 5.3415e+06 3 5.3415e+06 4 5.3415 5 5.3415 6 5.3415e+06 7 5.3415e-06}
array set areas {0 5.3415e+06 1 5.3415 2 5.3415e+06 3 5.3415e+06 4 5.3415e+06 5 5.3415 6 5.3415e+06 7 5.3415e-06}
array set results {0 S0 1 S1 2 S2 3 S3 4 S4 5 S5 6 S6 7 S7}
for { set anind 0} { $anind < 8 } { incr anind } {
checkprops $results($anind) -s $areas($anind) -eps 1e-2

View File

@@ -1,21 +0,0 @@
puts "============"
puts "0033664: Visualization - Selection does not work for simple shape"
puts "============"
puts ""
pload MODELING VISUALIZATION
vclear
vinit View1
restore [locate_data_file cylinder_surface.brep] b
vdisplay -dispMode 1 b
vfit
vsensdis
vselect 200 200
if {[vnbselected] != "1"} {
puts "ERROR: wrong sensitive area"
}
vselect 0 0
vdump $::imagedir/${::casename}_cylinder.png

View File

@@ -1,36 +0,0 @@
puts "============"
puts "0033664: Visualization - Selection does not work for simple shape"
puts "============"
puts ""
pload MODELING VISUALIZATION
vclear
vinit View1
pcone c1 50 100 100
ttranslate c1 100 0 100
explode c1
explode c1_1
pcone c2 100 50 100
ttranslate c2 -100 0 100
explode c2
explode c2_1
pcone c3 0 100 100
ttranslate c3 100 0 -100
explode c3
explode c3_1
pcone c4 100 0 100
ttranslate c4 -100 0 -100
explode c4
explode c4_1
vdisplay c1_1_1 c2_1_1 c3_1_1 c4_1_1 -dispmode 1
vsensdis
vfront
vfit
vdump $::imagedir/${::casename}_cone.png