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
ichesnok
e13c6a27b8 0033811: CAD Import - Update DE Readers with ShapeHealing logic 2024-09-19 13:10:59 +01:00
ichesnok
2afe8d66cb 0033799: Data Exchange - Shape Healing interface update
ProcessShape() function contents were moved to XSAlgo_AlgoProcessShape class.
2024-09-19 12:45:23 +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
65 changed files with 831 additions and 411 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

@@ -490,3 +490,11 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const
return aResult;
}
//=======================================================================
// function : ChangeHealingParams
// purpose :
//=======================================================================
void DE_ShapeFixConfigurationNode::ChangeHealingParams()
{
}

View File

@@ -42,6 +42,9 @@ public:
//! @return result resource string
Standard_EXPORT virtual TCollection_AsciiString Save() const Standard_OVERRIDE;
//! Redefined some healing parameters, depending on format
Standard_EXPORT virtual void ChangeHealingParams();
public:
DE_ShapeFixParameters HealingParameters; //!< Shape healing parameters

View File

@@ -0,0 +1,74 @@
// Copyright (c) 2024 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.
#include <DE_ShapeFixParameters.hxx>
#include <NCollection_DataMap.hxx>
#include <NCollection_Shared.hxx>
#include <TCollection_AsciiString.hxx>
//! Fill healing parameters map
void DE_ShapeFixParameters::FillParamsMap(DE_ShapeFixParameters::HealingParamMap& theMap)
{
theMap.Bind("Tolerance3d", TCollection_AsciiString(Tolerance3d));
theMap.Bind("MinTolerance3d", TCollection_AsciiString(MinTolerance3d));
theMap.Bind("MaxTolerance3d", TCollection_AsciiString(MaxTolerance3d));
theMap.Bind("FixFreeShellMode", TCollection_AsciiString(static_cast<int>(FixFreeShellMode)));
theMap.Bind("FixFreeFaceMode", TCollection_AsciiString(static_cast<int>(FixFreeFaceMode)));
theMap.Bind("FixFreeFaceMode", TCollection_AsciiString(static_cast<int>(FixFreeFaceMode)));
theMap.Bind("FixFreeWireMode", TCollection_AsciiString(static_cast<int>(FixFreeWireMode)));
theMap.Bind("FixSameParameterMode", TCollection_AsciiString(static_cast<int>(FixSameParameterMode)));
theMap.Bind("FixSolidMode", TCollection_AsciiString(static_cast<int>(FixSolidMode)));
theMap.Bind("FixShellOrientationMode", TCollection_AsciiString(static_cast<int>(FixShellOrientationMode)));
theMap.Bind("CreateOpenSolidMode", TCollection_AsciiString(static_cast<int>(CreateOpenSolidMode)));
theMap.Bind("FixShellMode", TCollection_AsciiString(static_cast<int>(FixShellMode)));
theMap.Bind("FixFaceOrientationMode", TCollection_AsciiString(static_cast<int>(FixFaceOrientationMode)));
theMap.Bind("FixFaceMode", TCollection_AsciiString(static_cast<int>(FixFaceMode)));
theMap.Bind("FixWireMode", TCollection_AsciiString(static_cast<int>(FixWireMode)));
theMap.Bind("FixOrientationMode", TCollection_AsciiString(static_cast<int>(FixOrientationMode)));
theMap.Bind("FixAddNaturalBoundMode", TCollection_AsciiString(static_cast<int>(FixAddNaturalBoundMode)));
theMap.Bind("FixMissingSeamMode", TCollection_AsciiString(static_cast<int>(FixMissingSeamMode)));
theMap.Bind("FixSmallAreaWireMode", TCollection_AsciiString(static_cast<int>(FixSmallAreaWireMode)));
theMap.Bind("RemoveSmallAreaFaceMode", TCollection_AsciiString(static_cast<int>(RemoveSmallAreaFaceMode)));
theMap.Bind("FixIntersectingWiresMode", TCollection_AsciiString(static_cast<int>(FixIntersectingWiresMode)));
theMap.Bind("FixLoopWiresMode", TCollection_AsciiString(static_cast<int>(FixLoopWiresMode)));
theMap.Bind("FixSplitFaceMode", TCollection_AsciiString(static_cast<int>(FixSplitFaceMode)));
theMap.Bind("AutoCorrectPrecisionMode", TCollection_AsciiString(static_cast<int>(AutoCorrectPrecisionMode)));
theMap.Bind("ModifyTopologyMode", TCollection_AsciiString(static_cast<int>(ModifyTopologyMode)));
theMap.Bind("ClosedWireMode", TCollection_AsciiString(static_cast<int>(ClosedWireMode)));
theMap.Bind("PreferencePCurveMode", TCollection_AsciiString(static_cast<int>(PreferencePCurveMode)));
theMap.Bind("FixReorderMode", TCollection_AsciiString(static_cast<int>(FixReorderMode)));
theMap.Bind("FixSmallMode", TCollection_AsciiString(static_cast<int>(FixSmallMode)));
theMap.Bind("FixConnectedMode", TCollection_AsciiString(static_cast<int>(FixConnectedMode)));
theMap.Bind("FixEdgeCurvesMode", TCollection_AsciiString(static_cast<int>(FixEdgeCurvesMode)));
theMap.Bind("FixDegeneratedMode", TCollection_AsciiString(static_cast<int>(FixDegeneratedMode)));
theMap.Bind("FixLackingMode", TCollection_AsciiString(static_cast<int>(FixLackingMode)));
theMap.Bind("FixSelfIntersectionMode", TCollection_AsciiString(static_cast<int>(FixSelfIntersectionMode)));
theMap.Bind("RemoveLoopMode", TCollection_AsciiString(static_cast<int>(RemoveLoopMode)));
theMap.Bind("FixReversed2dMode", TCollection_AsciiString(static_cast<int>(FixReversed2dMode)));
theMap.Bind("FixRemovePCurveMode", TCollection_AsciiString(static_cast<int>(FixRemovePCurveMode)));
theMap.Bind("FixRemoveCurve3dMode", TCollection_AsciiString(static_cast<int>(FixRemoveCurve3dMode)));
theMap.Bind("FixAddPCurveMode", TCollection_AsciiString(static_cast<int>(FixAddPCurveMode)));
theMap.Bind("FixAddCurve3dMode", TCollection_AsciiString(static_cast<int>(FixAddCurve3dMode)));
theMap.Bind("FixSeamMode", TCollection_AsciiString(static_cast<int>(FixSeamMode)));
theMap.Bind("FixShiftedMode", TCollection_AsciiString(static_cast<int>(FixShiftedMode)));
theMap.Bind("FixEdgeSameParameterMode", TCollection_AsciiString(static_cast<int>(FixEdgeSameParameterMode)));
theMap.Bind("FixNotchedEdgesMode", TCollection_AsciiString(static_cast<int>(FixNotchedEdgesMode)));
theMap.Bind("FixTailMode", TCollection_AsciiString(static_cast<int>(FixTailMode)));
theMap.Bind("MaxTailAngle", TCollection_AsciiString(static_cast<int>(MaxTailAngle)));
theMap.Bind("MaxTailWidth", TCollection_AsciiString(static_cast<int>(MaxTailWidth)));
theMap.Bind("FixSelfIntersectingEdgeMode", TCollection_AsciiString(static_cast<int>(FixSelfIntersectingEdgeMode)));
theMap.Bind("FixIntersectingEdgesMode", TCollection_AsciiString(static_cast<int>(FixIntersectingEdgesMode)));
theMap.Bind("FixNonAdjacentIntersectingEdgesMode", TCollection_AsciiString(static_cast<int>(FixNonAdjacentIntersectingEdgesMode)));
theMap.Bind("FixVertexPositionMode", TCollection_AsciiString(static_cast<int>(FixVertexPositionMode)));
theMap.Bind("FixVertexToleranceMode", TCollection_AsciiString(static_cast<int>(FixVertexToleranceMode)));
}

View File

@@ -14,18 +14,24 @@
#ifndef _DE_ShapeFixParameters_HeaderFile
#define _DE_ShapeFixParameters_HeaderFile
#include <NCollection_DataMap.hxx>
#include <NCollection_Shared.hxx>
#include <TCollection_AsciiString.hxx>
//! Struct for shape healing parameters storage
struct DE_ShapeFixParameters
{
typedef NCollection_Shared<NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>> HealingParamMap;
//! Enum, classifying a type of value for parameters
enum class FixMode : char
{
FixOrNot = -1, //!< Procedure will be executed or not (depending on the situation)
NotFix = 0, //!< Procedure will be executed
Fix = 1 //!< Procedure will be executed anyway
NotFix = 0, //!< Procedure will be executed
Fix = 1 //!< Procedure will be executed anyway
};
double Tolerance3d = 1.e-6;
double Tolerance3d = 1.e-3;
double MaxTolerance3d = 1.0;
double MinTolerance3d = 1.e-7;
FixMode FixFreeShellMode = FixMode::FixOrNot;
@@ -47,7 +53,7 @@ struct DE_ShapeFixParameters
FixMode FixIntersectingWiresMode = FixMode::FixOrNot;
FixMode FixLoopWiresMode = FixMode::FixOrNot;
FixMode FixSplitFaceMode = FixMode::FixOrNot;
FixMode AutoCorrectPrecisionMode = FixMode::FixOrNot;
FixMode AutoCorrectPrecisionMode = FixMode::Fix;
FixMode ModifyTopologyMode = FixMode::NotFix;
FixMode ModifyGeometryMode = FixMode::Fix;
FixMode ClosedWireMode = FixMode::Fix;
@@ -77,6 +83,10 @@ struct DE_ShapeFixParameters
FixMode FixNonAdjacentIntersectingEdgesMode = FixMode::FixOrNot;
FixMode FixVertexPositionMode = FixMode::NotFix;
FixMode FixVertexToleranceMode = FixMode::FixOrNot;
//! Fill healing parameters map
Standard_EXPORT void DE_ShapeFixParameters::FillParamsMap(DE_ShapeFixParameters::HealingParamMap& theMap);
};
#endif // _DE_ShapeFixParameters_HeaderFile

View File

@@ -7,6 +7,7 @@ DE_Provider.cxx
DE_Provider.hxx
DE_ShapeFixConfigurationNode.cxx
DE_ShapeFixConfigurationNode.hxx
DE_ShapeFixParameters.cxx
DE_ShapeFixParameters.hxx
DE_Wrapper.cxx
DE_Wrapper.hxx

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

@@ -18,7 +18,7 @@
#include <IGESCAFControl_Provider.hxx>
#include <NCollection_Buffer.hxx>
IMPLEMENT_STANDARD_RTTIEXT(IGESCAFControl_ConfigurationNode, DE_ConfigurationNode)
IMPLEMENT_STANDARD_RTTIEXT(IGESCAFControl_ConfigurationNode, DE_ShapeFixConfigurationNode)
namespace
{
@@ -37,17 +37,20 @@ namespace
// purpose :
//=======================================================================
IGESCAFControl_ConfigurationNode::IGESCAFControl_ConfigurationNode() :
DE_ConfigurationNode()
{}
DE_ShapeFixConfigurationNode()
{
ChangeHealingParams();
}
//=======================================================================
// function : IGESCAFControl_ConfigurationNode
// purpose :
//=======================================================================
IGESCAFControl_ConfigurationNode::IGESCAFControl_ConfigurationNode(const Handle(IGESCAFControl_ConfigurationNode)& theNode)
:DE_ConfigurationNode(theNode)
:DE_ShapeFixConfigurationNode(theNode)
{
InternalParameters = theNode->InternalParameters;
ChangeHealingParams();
}
//=======================================================================
@@ -456,3 +459,12 @@ bool IGESCAFControl_ConfigurationNode::CheckContent(const Handle(NCollection_Buf
}
return false;
}
//=======================================================================
// function : ChangeHealingParams
// purpose :
//=======================================================================
void IGESCAFControl_ConfigurationNode::ChangeHealingParams()
{
HealingParameters.CreateOpenSolidMode = DE_ShapeFixParameters::FixMode::Fix;
}

View File

@@ -14,7 +14,7 @@
#ifndef _IGESCAFControl_ConfigurationNode_HeaderFile
#define _IGESCAFControl_ConfigurationNode_HeaderFile
#include <DE_ConfigurationNode.hxx>
#include <DE_ShapeFixConfigurationNode.hxx>
#include <UnitsMethods_LengthUnit.hxx>
//! The purpose of this class is to configure the transfer process for IGES format
@@ -27,9 +27,9 @@
//! The supported CAD extensions are ".igs", ".iges"
//! The import process is supported.
//! The export process is supported.
class IGESCAFControl_ConfigurationNode : public DE_ConfigurationNode
class IGESCAFControl_ConfigurationNode : public DE_ShapeFixConfigurationNode
{
DEFINE_STANDARD_RTTIEXT(IGESCAFControl_ConfigurationNode, DE_ConfigurationNode)
DEFINE_STANDARD_RTTIEXT(IGESCAFControl_ConfigurationNode, DE_ShapeFixConfigurationNode)
public:
//! Initializes all fields by default
@@ -84,6 +84,9 @@ public:
//! @return Standard_True if file is supported by a current provider
Standard_EXPORT virtual bool CheckContent(const Handle(NCollection_Buffer)& theBuffer) const Standard_OVERRIDE;
//! Redefined some healing parameters, depending on format
Standard_EXPORT virtual void ChangeHealingParams() Standard_OVERRIDE;
public:
enum ReadMode_BSplineContinuity

View File

@@ -20,9 +20,12 @@
#include <IGESControl_Controller.hxx>
#include <IGESData.hxx>
#include <IGESData_IGESModel.hxx>
#include <IGESToBRep_Actor.hxx>
#include <Interface_Static.hxx>
#include <Message.hxx>
#include <MoniTool_Macros.hxx>
#include <XCAFDoc_DocumentTool.hxx>
#include <XSControl_TransferReader.hxx>
#include <XSControl_WorkSession.hxx>
#include <UnitsMethods.hxx>
@@ -187,14 +190,19 @@ bool IGESCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
IGESCAFControl_Reader aReader;
aReader.SetWS(theWS);
aReader.SetReadVisible(aNode->InternalParameters.ReadOnlyVisible);
DE_ShapeFixParameters::HealingParamMap aMap = aReader.DEHealingParameters();
aNode->HealingParameters.FillParamsMap(aMap);
aReader.SetDEHealingParameters(aMap);
aReader.SetReadVisible(aNode->InternalParameters.ReadOnlyVisible);
aReader.SetColorMode(aNode->InternalParameters.ReadColor);
aReader.SetNameMode(aNode->InternalParameters.ReadName);
aReader.SetLayerMode(aNode->InternalParameters.ReadLayer);
IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
aReadStat = aReader.ReadFile(thePath.ToCString());
DeclareAndCast(IGESToBRep_Actor, anActor, aReader.WS()->TransferReader()->Actor());
anActor->SetDEHealingParameters(aMap);
if (aReadStat != IFSelect_RetDone)
{
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
@@ -302,8 +310,15 @@ bool IGESCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
IGESControl_Reader aReader;
aReader.SetWS(theWS);
aReader.SetReadVisible(aNode->InternalParameters.ReadOnlyVisible);
DE_ShapeFixParameters::HealingParamMap aMap = aReader.DEHealingParameters();
aNode->HealingParameters.FillParamsMap(aMap);
aReader.SetDEHealingParameters(aMap);
IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
aReadStat = aReader.ReadFile(thePath.ToCString());
DeclareAndCast(IGESToBRep_Actor, anActor, aReader.WS()->TransferReader()->Actor());
anActor->SetDEHealingParameters(aMap);
if (aReadStat != IFSelect_RetDone)
{
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<

View File

@@ -33,6 +33,7 @@
#include <TransferBRep_ShapeBinder.hxx>
#include <XSAlgo.hxx>
#include <XSAlgo_AlgoContainer.hxx>
#include <XSAlgo_AlgoProcessShape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(IGESToBRep_Actor,Transfer_ActorOfTransientProcess)
@@ -194,11 +195,17 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
// fixing shape
Handle(Standard_Transient) info;
shape = XSAlgo::AlgoContainer()->ProcessShape(shape, theeps, CAS.GetMaxTol(),
"read.iges.resource.name",
"read.iges.sequence",
info, mymodel->ReShape(),
aPS.Next(), false, TopAbs_EDGE);
XSAlgo_AlgoProcessShape aProcessShape;
aProcessShape.SetShape(shape);
aProcessShape.SetPrscfile("read.iges.resource.name");
aProcessShape.SetPseq("read.iges.sequence");
aProcessShape.SetInfo(info);
aProcessShape.SetDetalisationLevel(TopAbs_EDGE);
aProcessShape.SetProgressRange(aPS.Next());
aProcessShape.SetPrecision(theeps);
aProcessShape.SetMaxTol(CAS.GetMaxTol());
aProcessShape.SetReShape(mymodel->ReShape());
shape = aProcessShape.ProcessShape();
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
}

View File

@@ -20,6 +20,7 @@
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <DE_ShapeFixParameters.hxx>
#include <Standard_Integer.hxx>
#include <Transfer_ActorOfTransientProcess.hxx>
#include <Message_ProgressRange.hxx>
@@ -66,7 +67,11 @@ public:
//! the file or from statics
Standard_EXPORT Standard_Real UsedTolerance() const;
//! Returns healing parameters map
Standard_EXPORT DE_ShapeFixParameters::HealingParamMap DEHealingParameters() const { return myDEHealingParameters; }
//! Sets healing parameters map
Standard_EXPORT void SetDEHealingParameters(DE_ShapeFixParameters::HealingParamMap theDEHealingParams) { myDEHealingParameters = theDEHealingParams; }
DEFINE_STANDARD_RTTIEXT(IGESToBRep_Actor,Transfer_ActorOfTransientProcess)
@@ -82,7 +87,7 @@ private:
Handle(Interface_InterfaceModel) themodel;
Standard_Integer thecontinuity;
Standard_Real theeps;
DE_ShapeFixParameters::HealingParamMap myDEHealingParameters;
};

View File

@@ -46,6 +46,7 @@
#include <TransferBRep.hxx>
#include <XSAlgo.hxx>
#include <XSAlgo_AlgoContainer.hxx>
#include <XSAlgo_AlgoProcessShape.hxx>
#include <stdio.h>
//#include <ShapeCustom.hxx>
@@ -549,10 +550,17 @@ Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num,
// shape = XSAlgo::AlgoContainer()->PerformFixShape ( shape, theProc, eps*CAS.GetUnitFactor(), CAS.GetMaxTol() );
Handle(Standard_Transient) info;
shape = XSAlgo::AlgoContainer()->ProcessShape( shape, eps*CAS.GetUnitFactor(), CAS.GetMaxTol(),
"read.iges.resource.name",
"read.iges.sequence", info,
aPS.Next(), false, TopAbs_EDGE);
XSAlgo_AlgoProcessShape aProcessShape;
aProcessShape.SetShape(shape);
aProcessShape.SetPrscfile("read.iges.resource.name");
aProcessShape.SetPseq("read.iges.sequence");
aProcessShape.SetInfo(info);
aProcessShape.SetDetalisationLevel(TopAbs_EDGE);
aProcessShape.SetProgressRange(theProgress);
aProcessShape.SetPrecision(eps * CAS.GetUnitFactor());
aProcessShape.SetMaxTol(CAS.GetMaxTol());
shape = aProcessShape.ProcessShape();
if (aPS.UserBreak())
return Standard_False;

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

@@ -14,11 +14,12 @@
#include <STEPCAFControl_ConfigurationNode.hxx>
#include <DE_ConfigurationContext.hxx>
#include <DE_ShapeFixConfigurationNode.hxx>
#include <DE_PluginHolder.hxx>
#include <NCollection_Buffer.hxx>
#include <STEPCAFControl_Provider.hxx>
IMPLEMENT_STANDARD_RTTIEXT(STEPCAFControl_ConfigurationNode, DE_ConfigurationNode)
IMPLEMENT_STANDARD_RTTIEXT(STEPCAFControl_ConfigurationNode, DE_ShapeFixConfigurationNode)
namespace
{
@@ -37,17 +38,19 @@ namespace
// purpose :
//=======================================================================
STEPCAFControl_ConfigurationNode::STEPCAFControl_ConfigurationNode() :
DE_ConfigurationNode()
{}
DE_ShapeFixConfigurationNode()
{
}
//=======================================================================
// function : STEPCAFControl_ConfigurationNode
// purpose :
//=======================================================================
STEPCAFControl_ConfigurationNode::STEPCAFControl_ConfigurationNode(const Handle(STEPCAFControl_ConfigurationNode)& theNode)
:DE_ConfigurationNode(theNode),
:DE_ShapeFixConfigurationNode(theNode),
InternalParameters(theNode->InternalParameters)
{}
{
}
//=======================================================================
// function : Load

View File

@@ -14,7 +14,7 @@
#ifndef _STEPCAFControl_ConfigurationNode_HeaderFile
#define _STEPCAFControl_ConfigurationNode_HeaderFile
#include <DE_ConfigurationNode.hxx>
#include <DE_ShapeFixConfigurationNode.hxx>
#include <STEPControl_StepModelType.hxx>
#include <StepData_ConfParameters.hxx>
#include <Resource_FormatType.hxx>
@@ -30,9 +30,9 @@
//! The supported CAD extensions are ".stp", ".step", ".stpz"
//! The import process is supported.
//! The export process is supported.
class STEPCAFControl_ConfigurationNode : public DE_ConfigurationNode
class STEPCAFControl_ConfigurationNode : public DE_ShapeFixConfigurationNode
{
DEFINE_STANDARD_RTTIEXT(STEPCAFControl_ConfigurationNode, DE_ConfigurationNode)
DEFINE_STANDARD_RTTIEXT(STEPCAFControl_ConfigurationNode, DE_ShapeFixConfigurationNode)
public:
//! Initializes all field by default

View File

@@ -14,6 +14,7 @@
#include <STEPCAFControl_Provider.hxx>
#include <BinXCAFDrivers.hxx>
#include <DE_ShapeFixParameters.hxx>
#include <Interface_Static.hxx>
#include <Message.hxx>
#include <StepData_StepModel.hxx>
@@ -23,6 +24,8 @@
#include <STEPCAFControl_Reader.hxx>
#include <STEPCAFControl_Writer.hxx>
#include <XCAFDoc_DocumentTool.hxx>
#include <XSAlgo.hxx>
#include <XSAlgo_AlgoContainer.hxx>
#include <XSControl_WorkSession.hxx>
#include <UnitsMethods.hxx>
@@ -68,12 +71,17 @@ bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
personizeWS(theWS);
XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->GlobalParameters.LengthUnit, UnitsMethods_LengthUnit_Millimeter);
STEPCAFControl_Reader aReader;
DE_ShapeFixParameters aParameters;
DE_ShapeFixParameters::HealingParamMap aDEHealingParams = aReader.ChangeReader().DEHealingParameters();
aNode->HealingParameters.FillParamsMap(aDEHealingParams);
aReader.ChangeReader().SetDEHealingParameters(aDEHealingParams);
aReader.Init(theWS);
aReader.SetColorMode(aNode->InternalParameters.ReadColor);
aReader.SetNameMode(aNode->InternalParameters.ReadName);
aReader.SetLayerMode(aNode->InternalParameters.ReadLayer);
aReader.SetPropsMode(aNode->InternalParameters.ReadProps);
aReader.SetMetaMode(aNode->InternalParameters.ReadMetadata);
aReader.SetDEHealingParameters(aReader.ChangeReader().DEHealingParameters());
IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
StepData_ConfParameters aParams;
@@ -200,6 +208,9 @@ bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
personizeWS(theWS);
STEPControl_Reader aReader;
aReader.SetWS(theWS);
DE_ShapeFixParameters::HealingParamMap aDEHealingParams = aReader.DEHealingParameters();
aNode->HealingParameters.FillParamsMap(aDEHealingParams);
aReader.SetDEHealingParameters(aDEHealingParams);
IFSelect_ReturnStatus aReadstat = IFSelect_RetVoid;
StepData_ConfParameters aParams;
aReadstat = aReader.ReadFile(thePath.ToCString(), aParams);

View File

@@ -24,6 +24,7 @@
#include <HeaderSection_FileSchema.hxx>
#include <Interface_Static.hxx>
#include <Message_ProgressScope.hxx>
#include <MoniTool_Macros.hxx>
#include <NCollection_DataMap.hxx>
#include <OSD_Path.hxx>
#include <Quantity_ColorRGBA.hxx>
@@ -2341,7 +2342,8 @@ Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane)& t
void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
const Handle(Standard_Transient)& theGDT,
const Handle(Standard_Transient)& theDimObject,
const StepData_Factors& theLocalFactors)
const StepData_Factors& theLocalFactors,
DE_ShapeFixParameters::HealingParamMap theDEParams)
{
if (theGDT.IsNull() || theDimObject.IsNull())
return;
@@ -2370,6 +2372,7 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
Handle(StepVisual_DraughtingModel)::DownCast(aDMIA->UsedRepresentation());
XSAlgo::AlgoContainer()->PrepareForTransfer();
STEPControl_ActorRead anActor(aTP->Model());
anActor.SetDEHealingParameters(theDEParams);
StepData_Factors aLocalFactors = theLocalFactors;
anActor.PrepareUnits(aDModel, aTP, aLocalFactors);
Standard_Real aFact = aLocalFactors.LengthFactor();
@@ -2457,7 +2460,8 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR,
const Handle(Standard_Transient)& theGDT,
const Handle(XCAFDimTolObjects_DimensionObject)& theDimObject,
const StepData_Factors& theLocalFactors)
const StepData_Factors& theLocalFactors,
DE_ShapeFixParameters::HealingParamMap theDEParams)
{
if (theGDT.IsNull() || theDimObject.IsNull())
return;
@@ -2479,6 +2483,7 @@ void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR,
{
XSAlgo::AlgoContainer()->PrepareForTransfer();
STEPControl_ActorRead anActor(theTR->Model());
anActor.SetDEHealingParameters(theDEParams);
StepData_Factors aLocalFactors = theLocalFactors;
anActor.PrepareUnits(aSDR, aTP, aLocalFactors);
aFact = aLocalFactors.LengthFactor();
@@ -2783,7 +2788,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
collectShapeAspect(aSAR->RelatingShapeAspect(), theWS, aSAs);
Handle(StepDimTol_DatumFeature) aDF = Handle(StepDimTol_DatumFeature)::DownCast(aSAR->RelatingShapeAspect());
if (!aSAR->RelatingShapeAspect()->IsKind(STANDARD_TYPE(StepDimTol_DatumTarget)))
readAnnotation(aTR, aSAR->RelatingShapeAspect(), aDatObj, theLocalFactors);
readAnnotation(aTR, aSAR->RelatingShapeAspect(), aDatObj, theLocalFactors, myDEParameters);
}
// Collect shape labels
@@ -2917,6 +2922,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
= Handle(StepGeom_Axis2Placement3d)::DownCast(aSRWP->ItemsValue(j));
XSAlgo::AlgoContainer()->PrepareForTransfer();
STEPControl_ActorRead anActor(aTP->Model());
anActor.SetDEHealingParameters(myDEParameters);
StepData_Factors aLocalFactors = theLocalFactors;
anActor.PrepareUnits(aSRWP, aTP, aLocalFactors);
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(anAx, aLocalFactors);
@@ -2964,7 +2970,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
aDGTTool->SetDatumToGeomTol(aDatL, theGDTL);
aDatTargetObj->IsDatumTarget(Standard_True);
aDatTargetObj->SetDatumTargetNumber(aDT->TargetId()->IntegerValue());
readAnnotation(aTR, aDT, aDatTargetObj, theLocalFactors);
readAnnotation(aTR, aDT, aDatTargetObj, theLocalFactors, myDEParameters);
aDat->SetObject(aDatTargetObj);
isExistDatumTarget = Standard_True;
}
@@ -2993,7 +2999,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
aDGTTool->SetDatumToGeomTol(aDatL, theGDTL);
if (aDatObj->GetPresentation().IsNull()) {
// Try find annotation connected to datum entity (not right case, according recommended practices)
readAnnotation(aTR, theDat, aDatObj, theLocalFactors);
readAnnotation(aTR, theDat, aDatObj, theLocalFactors, myDEParameters);
}
aDat->SetObject(aDatObj);
}
@@ -3638,7 +3644,8 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
const TDF_Label& aDimL,
const Handle(TDocStd_Document)& theDoc,
const Handle(XSControl_WorkSession)& theWS,
const StepData_Factors& theLocalFactors)
const StepData_Factors& theLocalFactors,
DE_ShapeFixParameters::HealingParamMap theUseDEHealingParams)
{
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());
Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool(theDoc->Main());
@@ -4057,8 +4064,8 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
if (aDimL.FindAttribute(XCAFDoc_Dimension::GetID(), aDim))
{
readAnnotation(aTR, theEnt, aDimObj, theLocalFactors);
readConnectionPoints(aTR, theEnt, aDimObj, theLocalFactors);
readAnnotation(aTR, theEnt, aDimObj, theLocalFactors, theUseDEHealingParams);
readConnectionPoints(aTR, theEnt, aDimObj, theLocalFactors, theUseDEHealingParams);
aDim->SetObject(aDimObj);
}
}
@@ -4180,7 +4187,8 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
const TDF_Label& theTolL,
const Handle(TDocStd_Document)& theDoc,
const Handle(XSControl_WorkSession)& theWS,
const StepData_Factors& theLocalFactors)
const StepData_Factors& theLocalFactors,
DE_ShapeFixParameters::HealingParamMap theUseDEHealingParams)
{
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());
Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool(theDoc->Main());
@@ -4327,7 +4335,7 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
aTolObj->SetMaxValueModifier(aVal);
}
readAnnotation(aTR, theEnt, aTolObj, theLocalFactors);
readAnnotation(aTR, theEnt, aTolObj, theLocalFactors, theUseDEHealingParams);
aGTol->SetObject(aTolObj);
}
@@ -4361,10 +4369,10 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess
TDF_Label aGDTL = createGDTObjectInXCAF(anEnt, theDoc, theWS, theLocalFactors);
if (!aGDTL.IsNull()) {
if (anEnt->IsKind(STANDARD_TYPE(StepDimTol_GeometricTolerance))) {
setGeomTolObjectToXCAF(anEnt, aGDTL, theDoc, theWS, theLocalFactors);
setGeomTolObjectToXCAF(anEnt, aGDTL, theDoc, theWS, theLocalFactors, myDEParameters);
}
else {
setDimObjectToXCAF(anEnt, aGDTL, theDoc, theWS, theLocalFactors);
setDimObjectToXCAF(anEnt, aGDTL, theDoc, theWS, theLocalFactors, myDEParameters);
}
}
}
@@ -4457,6 +4465,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess
{
XSAlgo::AlgoContainer()->PrepareForTransfer();
STEPControl_ActorRead anActor(aModel);
anActor.SetDEHealingParameters(myDEParameters);
Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess();
anActor.PrepareUnits(aDMIA->UsedRepresentation(), aTP, aLocalFactors);
aFact = aLocalFactors.LengthFactor();
@@ -4813,6 +4822,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSes
{
XSAlgo::AlgoContainer()->PrepareForTransfer();
STEPControl_ActorRead anActor(aTP->Model());
anActor.SetDEHealingParameters(myDEParameters);
anActor.PrepareUnits(aDModel, aTP, aLocalFactors);
}

View File

@@ -16,6 +16,7 @@
#ifndef _STEPCAFControl_Reader_HeaderFile
#define _STEPCAFControl_Reader_HeaderFile
#include <DE_ShapeFixParameters.hxx>
#include <STEPControl_Reader.hxx>
#include <StepData_Factors.hxx>
#include <IFSelect_ReturnStatus.hxx>
@@ -207,6 +208,13 @@ public:
//! Get View mode
Standard_EXPORT Standard_Boolean GetViewMode() const;
//! Returns healing parameters map
Standard_EXPORT DE_ShapeFixParameters::HealingParamMap DEHealingParameters() const { return myDEParameters; }
//! Sets healing parameters map
Standard_EXPORT void SetDEHealingParameters(DE_ShapeFixParameters::HealingParamMap theDEHealingParams) { myDEParameters = theDEHealingParams; }
const XCAFDoc_DataMapOfShapeLabel& GetShapeLabelMap() const { return myMap; }
protected:
@@ -375,6 +383,7 @@ private:
Standard_Boolean myMatMode;
Standard_Boolean myViewMode;
NCollection_DataMap<Handle(Standard_Transient), TDF_Label> myGDTMap;
DE_ShapeFixParameters::HealingParamMap myDEParameters;
};

View File

@@ -120,6 +120,7 @@
#include <UnitsMethods.hxx>
#include <XSAlgo.hxx>
#include <XSAlgo_AlgoContainer.hxx>
#include <XSAlgo_AlgoProcessShape.hxx>
#include <StepRepr_ConstructiveGeometryRepresentationRelationship.hxx>
#include <StepRepr_ConstructiveGeometryRepresentation.hxx>
#include <StepRepr_MechanicalDesignAndDraughtingRelationship.hxx>
@@ -935,11 +936,16 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
Handle(Standard_Transient) info;
// IMPORTANT: any fixing on non-manifold topology must be done after the shape is transferred from STEP
TopoDS_Shape fixedResult =
XSAlgo::AlgoContainer()->ProcessShape( comp, myPrecision, myMaxTol,
"read.step.resource.name",
"read.step.sequence", info,
aPS1.Next(), Standard_True);
XSAlgo_AlgoProcessShape aProcessShape;
aProcessShape.SetShape(comp);
aProcessShape.SetPrscfile("read.step.resource.name");
aProcessShape.SetPseq("read.step.sequence");
aProcessShape.SetInfo(info);
aProcessShape.SetNonManifold(Standard_True);
aProcessShape.SetProgressRange(theProgress);
aProcessShape.SetPrecision(myPrecision);
aProcessShape.SetMaxTol(myMaxTol);
TopoDS_Shape fixedResult = aProcessShape.ProcessShape();
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
if (fixedResult.ShapeType() == TopAbs_COMPOUND)
@@ -1555,11 +1561,15 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
if (isManifold && aHasGeom)
{
Handle(Standard_Transient) info;
mappedShape =
XSAlgo::AlgoContainer()->ProcessShape( mappedShape, myPrecision, myMaxTol,
"read.step.resource.name",
"read.step.sequence", info,
aPS.Next());
XSAlgo_AlgoProcessShape aProcessShape;
aProcessShape.SetShape(mappedShape);
aProcessShape.SetPrscfile("read.step.resource.name");
aProcessShape.SetPseq("read.step.sequence");
aProcessShape.SetInfo(info);
aProcessShape.SetProgressRange(aPS.Next());
aProcessShape.SetPrecision(myPrecision);
aProcessShape.SetMaxTol(myMaxTol);
mappedShape = aProcessShape.ProcessShape();
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
}
}
@@ -1727,10 +1737,15 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
TopoDS_Shape S = sb->Result();
Handle(Standard_Transient) info;
TopoDS_Shape shape = XSAlgo::AlgoContainer()->ProcessShape(S, myPrecision, myMaxTol,
"read.step.resource.name",
"read.step.sequence", info,
theProgress);
XSAlgo_AlgoProcessShape aProcessShape;
aProcessShape.SetShape(S);
aProcessShape.SetPrscfile("read.step.resource.name");
aProcessShape.SetPseq("read.step.sequence");
aProcessShape.SetInfo(info);
aProcessShape.SetProgressRange(theProgress);
aProcessShape.SetPrecision(myPrecision);
aProcessShape.SetMaxTol(myMaxTol);
TopoDS_Shape shape = aProcessShape.ProcessShape();
// TopoDS_Shape shape = XSAlgo::AlgoContainer()->PerformFixShape( S, TP, myPrecision, myMaxTol );
if (shape != S)
sb->SetResult(shape);

View File

@@ -28,6 +28,7 @@
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <Message_ProgressRange.hxx>
#include <Interface_InterfaceModel.hxx>
#include <DE_ShapeFixParameters.hxx>
class StepRepr_Representation;
class Standard_Transient;
@@ -115,7 +116,11 @@ public:
gp_Trsf& Trsf,
const StepData_Factors& theLocalFactors = StepData_Factors());
//! Returns healing parameters map
Standard_EXPORT DE_ShapeFixParameters::HealingParamMap DEHealingParameters() const { return myDEParameters; }
//! Sets healing parameters map
Standard_EXPORT void SetDEHealingParameters(DE_ShapeFixParameters::HealingParamMap theDEHealingParams) { myDEParameters = theDEHealingParams; }
DEFINE_STANDARD_RTTIEXT(STEPControl_ActorRead,Transfer_ActorOfTransientProcess)
@@ -226,6 +231,7 @@ private:
Standard_Real myMaxTol;
Handle(StepRepr_Representation) mySRContext;
Handle(Interface_InterfaceModel) myModel;
DE_ShapeFixParameters::HealingParamMap myDEParameters;
};

View File

@@ -1003,7 +1003,6 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
if (hasGeometry(aShape))
{
Standard_Real maxTol = aStepModel->InternalParameters.ReadMaxPrecisionVal;
aShape = XSAlgo::AlgoContainer()->ProcessShape(xShape, Tol, maxTol,
"write.step.resource.name",
"write.step.sequence", info,

View File

@@ -130,7 +130,8 @@ IFSelect_ReturnStatus STEPControl_Reader::ReadFile(const Standard_CString filena
WS()->InitTransferReader(4);
return status;
}
#include <STEPControl_ActorRead.hxx>
#include <MoniTool_Macros.hxx>
//=======================================================================
//function : ReadFile
//purpose :
@@ -164,6 +165,8 @@ IFSelect_ReturnStatus STEPControl_Reader::ReadFile(const Standard_CString filena
WS()->SetModel(aStepModel);
WS()->SetLoadedFile(filename);
WS()->InitTransferReader(4);
//DeclareAndCast(STEPControl_ActorRead, anActor, WS()->TransferReader()->Actor());
//anActor->SetDEHealingParameters(DEHealingParameters());
return status;
}

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

@@ -1,3 +1,4 @@
TKDE
TKBRep
TKernel
TKMath

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

@@ -3,6 +3,8 @@ XSAlgo.hxx
XSAlgo_AlgoContainer.cxx
XSAlgo_AlgoContainer.hxx
XSAlgo_AlgoContainer.lxx
XSAlgo_AlgoProcessShape.cxx
XSAlgo_AlgoProcessShape.hxx
XSAlgo_Caller.hxx
XSAlgo_ToolContainer.cxx
XSAlgo_ToolContainer.hxx

View File

@@ -56,6 +56,7 @@
#include <TransferBRep_ShapeMapper.hxx>
#include <UnitsMethods.hxx>
#include <XSAlgo_AlgoContainer.hxx>
#include <XSAlgo_AlgoProcessShape.hxx>
#include <XSAlgo_ToolContainer.hxx>
#include <TopExp_Explorer.hxx>
@@ -100,88 +101,19 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape(const TopoDS_Shape& theShape,
return theShape;
}
Handle(ShapeProcess_ShapeContext) aContext = Handle(ShapeProcess_ShapeContext)::DownCast(theInfo);
if (aContext.IsNull())
{
Standard_CString aRscfile = Interface_Static::CVal(thePrscfile);
aContext = new ShapeProcess_ShapeContext(theShape, aRscfile);
if (!aContext->ResourceManager()->IsInitialized())
{
// If resource file wasn't found, use static values instead
Interface_Static::FillMap(aContext->ResourceManager()->GetMap());
}
aContext->SetDetalisation(theDetalisationLevel);
}
aContext->SetNonManifold(theNonManifold);
theInfo = aContext;
XSAlgo_AlgoProcessShape aProcessShape;
aProcessShape.SetShape(theShape);
aProcessShape.SetPrscfile(thePrscfile);
aProcessShape.SetPseq(thePseq);
aProcessShape.SetInfo(theInfo);
aProcessShape.SetDetalisationLevel(theDetalisationLevel);
aProcessShape.SetNonManifold(theNonManifold);
aProcessShape.SetProgressRange(theProgress);
aProcessShape.SetPrecision(thePrec);
aProcessShape.SetMaxTol(theMaxTol);
aProcessShape.SetReShape(theReShape);
Standard_CString aSeq = Interface_Static::CVal(thePseq);
if (!aSeq) aSeq = thePseq;
// if resource file is not loaded or does not define <seq>.exec.op,
// do default fixes
Handle(Resource_Manager) aRsc = aContext->ResourceManager();
TCollection_AsciiString aStr(aSeq);
aStr += ".exec.op";
if (!aRsc->Find(aStr.ToCString()))
{
#ifdef OCCT_DEBUG
{
static Standard_Integer aTime = 0;
if (!aTime)
std::cout << "Warning: XSAlgo_AlgoContainer::ProcessShape(): Sequence " << aStr.ToCString() <<
" is not defined in " << thePrscfile << " resource; do default processing" << std::endl;
aTime++;
}
#endif
// if reading, do default ShapeFix
if (!strncmp(thePseq, "read.", 5))
{
try {
OCC_CATCH_SIGNALS
Handle(ShapeExtend_MsgRegistrator) aMsg = new ShapeExtend_MsgRegistrator;
Handle(ShapeFix_Shape) aSfs = ShapeAlgo::AlgoContainer()->ToolContainer()->FixShape();
aSfs->Init(theShape);
aSfs->SetMsgRegistrator(aMsg);
aSfs->SetPrecision(thePrec);
aSfs->SetMaxTolerance(theMaxTol);
aSfs->FixFaceTool()->FixWireTool()->FixSameParameterMode() = Standard_False;
aSfs->FixSolidTool()->CreateOpenSolidMode() = Standard_False;
aSfs->SetContext(theReShape);
aSfs->Perform(theProgress);
TopoDS_Shape aShape = aSfs->Shape();
if (!aShape.IsNull() && aShape != theShape)
{
aContext->RecordModification(aSfs->Context(), aMsg);
aContext->SetResult(aShape);
}
}
catch (Standard_Failure const& anException)
{
#ifdef OCCT_DEBUG
std::cout << "Error: XSAlgo_AlgoContainer::ProcessShape(): Exception in ShapeFix::Shape" << std::endl;
anException.Print(std::cout); std::cout << std::endl;
#endif
(void)anException;
}
return aContext->Result();
}
// for writing, define default sequence of DirectFaces
else if (!strncmp(thePseq, "write.", 6))
{
aRsc->SetResource(aStr.ToCString(), "DirectFaces");
}
}
// Define runtime tolerances and do Shape Processing
aRsc->SetResource("Runtime.Tolerance", thePrec);
aRsc->SetResource("Runtime.MaxTolerance", theMaxTol);
if (!ShapeProcess::Perform(aContext, aSeq, theProgress))
return theShape; // return original shape
return aContext->Result();
return aProcessShape.ProcessShape();
}
//=======================================================================

View File

@@ -19,6 +19,7 @@
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <DE_ShapeFixParameters.hxx>
#include <Message_ProgressRange.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Transient.hxx>
@@ -46,10 +47,10 @@ public:
Standard_EXPORT XSAlgo_AlgoContainer();
//! Sets ToolContainer
void SetToolContainer (const Handle(XSAlgo_ToolContainer)& TC);
void SetToolContainer (const Handle(XSAlgo_ToolContainer)& TC);
//! Returns ToolContainer
Handle(XSAlgo_ToolContainer) ToolContainer() const;
Handle(XSAlgo_ToolContainer) ToolContainer() const;
//! Performs actions necessary for preparing environment
//! for transfer. Empty in Open version.
@@ -111,8 +112,6 @@ public:
Standard_EXPORT virtual void MergeTransferInfo (const Handle(Transfer_FinderProcess)& FP, const Handle(Standard_Transient)& info) const;
DEFINE_STANDARD_RTTIEXT(XSAlgo_AlgoContainer,Standard_Transient)
protected:
@@ -122,10 +121,8 @@ protected:
private:
Handle(XSAlgo_ToolContainer) myTC;
};

View File

@@ -0,0 +1,149 @@
// Created on: 2000-01-19
// Created by: data exchange team
// Copyright (c) 2000-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.
#include <XSAlgo_AlgoProcessShape.hxx>
#include <Interface_Static.hxx>
#include <Resource_Manager.hxx>
#include <ShapeAlgo.hxx>
#include <ShapeAlgo_AlgoContainer.hxx>
#include <ShapeAlgo_ToolContainer.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeExtend_MsgRegistrator.hxx>
#include <ShapeFix_Shape.hxx>
#include <ShapeProcess.hxx>
#include <ShapeProcess_ShapeContext.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XSAlgo_AlgoProcessShape, Standard_Transient)
//=======================================================================
//function : XSAlgo_AlgoProcessShape
//purpose :
//=======================================================================
XSAlgo_AlgoProcessShape::XSAlgo_AlgoProcessShape()
: myPrscfile(""),
myPseq(""),
myPrecision(0.001),
myMaxTol(1.),
myNonManifold(false),
myDetalisationLevel(TopAbs_VERTEX),
myProgressRange(Message_ProgressRange())
{
}
//=======================================================================
//function : ProcessShape
//purpose :
//=======================================================================
TopoDS_Shape XSAlgo_AlgoProcessShape::ProcessShape()
{
if (myShape.IsNull())
{
return myShape;
}
if (myReShape.IsNull())
{
myReShape = new ShapeBuild_ReShape();
}
Standard_CString aRscfile = "";
Handle(ShapeProcess_ShapeContext) aContext = Handle(ShapeProcess_ShapeContext)::DownCast(myInfo);
if (aContext.IsNull())
{
aRscfile = Interface_Static::CVal(myPrscfile);
aContext = new ShapeProcess_ShapeContext(myShape, aRscfile);
}
if (myDEParameters.IsEmpty())
{
if (!aContext->ResourceManager()->IsInitialized())
{
// If resource file wasn't found, use static values instead
Interface_Static::FillMap(aContext->ResourceManager()->GetMap());
}
}
aContext->SetDetalisation(myDetalisationLevel);
aContext->SetNonManifold(myNonManifold);
myInfo = aContext;
Standard_CString aSeq = Interface_Static::CVal(myPseq);
if (!aSeq) aSeq = myPseq;
// if resource file is not loaded or does not define <seq>.exec.op,
// do default fixes
Handle(Resource_Manager) aRsc = aContext->ResourceManager();
TCollection_AsciiString aStr(aSeq);
aStr += ".exec.op";
if (strncmp(myPseq, "read.", 5) == 0)
{
aRsc->SetResource(aStr.ToCString(), "FixShape");
try {
OCC_CATCH_SIGNALS
Handle(ShapeExtend_MsgRegistrator) aMsg = new ShapeExtend_MsgRegistrator;
Handle(ShapeFix_Shape) aSfs = ShapeAlgo::AlgoContainer()->ToolContainer()->FixShape();
aSfs->Init(myShape);
aSfs->SetMsgRegistrator(aMsg);
aSfs->SetPrecision(myPrecision);
aSfs->SetMaxTolerance(myMaxTol);
aSfs->FixFaceTool()->FixWireTool()->FixSameParameterMode() = Standard_False;
if (strcmp(aRscfile, "IGES") == 0 || strcmp(aRscfile, "XT") == 0)
{
aSfs->FixSolidTool()->CreateOpenSolidMode() = Standard_True;
}
else
{
aSfs->FixSolidTool()->CreateOpenSolidMode() = Standard_False;
}
aSfs->SetContext(myReShape);
aSfs->Perform(myProgressRange);
TopoDS_Shape aShape = aSfs->Shape();
if (!aShape.IsNull() && aShape != myShape)
{
aContext->RecordModification(aSfs->Context(), aMsg);
aContext->SetResult(aShape);
}
}
catch (Standard_Failure const& anException)
{
#ifdef OCCT_DEBUG
std::cout << "Error: XSAlgo_AlgoContainer::ProcessShape(): Exception in ShapeFix::Shape" << std::endl;
anException.Print(std::cout); std::cout << std::endl;
#endif
(void)anException;
}
return aContext->Result();
}
else if (strncmp(myPseq, "write.", 6) == 0)
{
if (strcmp(aRscfile, "STEP") == 0)
{
aRsc->SetResource(aStr.ToCString(), "SplitCommonVertex,DirectFaces");
}
else
{
aRsc->SetResource(aStr.ToCString(), "DirectFaces");
}
}
// Define runtime tolerances and do Shape Processing
aRsc->SetResource("Runtime.Tolerance", myPrecision);
aRsc->SetResource("Runtime.MaxTolerance", myMaxTol);
if (!ShapeProcess::Perform(aContext, aSeq, myProgressRange))
return myShape; // return original shape
return aContext->Result();
}

View File

@@ -0,0 +1,134 @@
// Copyright (c) 2024 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 _XSAlgo_AlgoProcessShape_HeaderFile
#define _XSAlgo_AlgoProcessShape_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <DE_ShapeFixParameters.hxx>
#include <Message_ProgressRange.hxx>
#include <NCollection_DataMap.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Transient.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS_Shape.hxx>
class ShapeBuild_ReShape;
class XSAlgo_ToolContainer;
class TopoDS_Edge;
class TopoDS_Face;
class Transfer_TransientProcess;
class Transfer_FinderProcess;
class XSAlgo_AlgoProcessShape;
DEFINE_STANDARD_HANDLE(XSAlgo_AlgoProcessShape, Standard_Transient)
//! Class for shape processing
class XSAlgo_AlgoProcessShape : public Standard_Transient
{
public:
//! Empty constructor
Standard_EXPORT XSAlgo_AlgoProcessShape();
//! Shape processing with specified tolerances
Standard_EXPORT TopoDS_Shape ProcessShape();
//! Get shape for processing
const TopoDS_Shape& GetShape() { return myShape; }
//! Set shape for processing
void SetShape(const TopoDS_Shape& theShape) { myShape = theShape; }
//! Get name of the resource file
const Standard_CString& GetPrscfile() { return myPrscfile; }
//! Set name of the resource file
void SetPrscfile(const Standard_CString& thePrscfile) { myPrscfile = thePrscfile; }
//! Get name of the sequence of operators defined in the resource file for Shape Processing
const Standard_CString& GetPseq() { return myPseq; }
//! Set name of the sequence of operators defined in the resource file for Shape Processing
void SetPseq(const Standard_CString& thePseq) { myPseq = thePseq; }
//! Get information to be recorded in the translation map
const Handle(Standard_Transient)& GetInfo() { return myInfo; }
//! Set information to be recorded in the translation map
void SetInfo(const Handle(Standard_Transient)& theInfo) { myInfo = theInfo; }
//! Get flag to proceed with non-manifold topology
const bool GetNonManifold() { return myNonManifold; }
//! Set flag to proceed with non-manifold topology
void SetNonManifold(const bool theNonManifold) { myNonManifold = theNonManifold; }
//! Get detalisation level
const TopAbs_ShapeEnum GetDetalisationLevel() { return myDetalisationLevel; }
//! Set detalisation level
void SetDetalisationLevel(const TopAbs_ShapeEnum theDetalisationLevel) { myDetalisationLevel = theDetalisationLevel; }
//! Get progress indicator
const Message_ProgressRange& GetProgressRange() { return myProgressRange; }
//! Set progress indicator
void SetProgressRange(const Message_ProgressRange& theProgressRange) { myProgressRange = theProgressRange; }
//! Get maximum allowed tolerance
const double GetMaxTol() { return myMaxTol; }
//! Set maximum allowed tolerance
void SetMaxTol(const double theMaxTol) { myMaxTol = theMaxTol; }
//! Get basic precision
const double GetPrecision() { return myPrecision; }
//! Set basic precision
void SetPrecision(const double thePrecision) { myPrecision = thePrecision; }
//! Get tool to record the modifications of input shape
const Handle(ShapeBuild_ReShape)& GetReShape() { return myReShape; }
//! Set tool to record the modifications of input shape
void SetReShape(const Handle(ShapeBuild_ReShape)& theReShape) { myReShape = theReShape; }
//! Returns healing parameters map
DE_ShapeFixParameters::HealingParamMap DEHealingParameters() const { return myDEParameters; }
//! Sets healing parameters map
void SetDEHealingParameters(DE_ShapeFixParameters::HealingParamMap theDEHealingParams) { myDEParameters = theDEHealingParams; }
DEFINE_STANDARD_RTTIEXT(XSAlgo_AlgoProcessShape, Standard_Transient)
private:
TopoDS_Shape myShape;
Standard_CString myPrscfile;
Standard_CString myPseq;
double myPrecision;
double myMaxTol;
bool myNonManifold;
TopAbs_ShapeEnum myDetalisationLevel;
Message_ProgressRange myProgressRange;
Handle(Standard_Transient) myInfo;
Handle(ShapeBuild_ReShape) myReShape;
DE_ShapeFixParameters::HealingParamMap myDEParameters;
};
#endif // _XSAlgo_AlgoProcessShape_HeaderFile

View File

@@ -21,6 +21,7 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <DE_ShapeFixParameters.hxx>
#include <TColStd_SequenceOfTransient.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <Standard_CString.hxx>
@@ -260,7 +261,11 @@ public:
//! Gives statistics about Transfer
Standard_EXPORT void GetStatsTransfer (const Handle(TColStd_HSequenceOfTransient)& list, Standard_Integer& nbMapped, Standard_Integer& nbWithResult, Standard_Integer& nbWithFail) const;
//! Returns healing parameters map
Standard_EXPORT DE_ShapeFixParameters::HealingParamMap DEHealingParameters() const { return myDEParameters; }
//! Sets healing parameters map
Standard_EXPORT void SetDEHealingParameters(DE_ShapeFixParameters::HealingParamMap theDEHealingParams) { myDEParameters = theDEHealingParams; }
protected:
@@ -280,6 +285,7 @@ private:
Handle(XSControl_WorkSession) thesession;
TopTools_SequenceOfShape theshapes;
DE_ShapeFixParameters::HealingParamMap myDEParameters;
};

View File

@@ -835,6 +835,11 @@ static Standard_Integer ReadIges(Draw_Interpretor& theDI,
Standard_Integer onlyVisible = Interface_Static::IVal("read.iges.onlyvisible");
aReader.SetReadVisible(onlyVisible == 1);
DE_ShapeFixParameters aParameters;
DE_ShapeFixParameters::HealingParamMap aDEHealingParams = aReader.DEHealingParameters();
aParameters.FillParamsMap(aDEHealingParams);
aReader.SetDEHealingParameters(aDEHealingParams);
if (theNbArgs == 4)
{
Standard_Boolean mode = Standard_True;

View File

@@ -17,6 +17,7 @@
#include <DDF.hxx>
#include <DDocStd.hxx>
#include <DDocStd_DrawDocument.hxx>
#include <DE_ShapeFixParameters.hxx>
#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
#include <Draw_PluginMacro.hxx>
@@ -693,6 +694,11 @@ static Standard_Integer ReadStep(Draw_Interpretor& theDI,
}
STEPCAFControl_Reader aReader(XSDRAW::Session(), isFileMode);
DE_ShapeFixParameters aParameters;
DE_ShapeFixParameters::HealingParamMap aDEHealingParams = aReader.ChangeReader().DEHealingParameters();
aParameters.FillParamsMap(aDEHealingParams);
aReader.ChangeReader().SetDEHealingParameters(aDEHealingParams);
if (!aModeStr.IsEmpty())
{
Standard_Boolean aMode = Standard_True;

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

@@ -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