mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
c969b0c891 | ||
|
cefc95b3c2 | ||
|
a35ded3135 | ||
|
b8b31f6b36 | ||
|
5485309a4a | ||
|
706b94cc6d | ||
|
3e1adab2d9 | ||
|
fcdfd45836 | ||
|
3bd2f8ebbe | ||
|
49c3828bcf | ||
|
19f77300a8 |
@@ -15,6 +15,10 @@ macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# set using memory manager option for TKernel
|
||||
set (USE_MMGR_TYPE "JEMALLOC" CACHE STRING "Select using memory manager tool.")
|
||||
set_property(CACHE USE_MMGR_TYPE PROPERTY STRINGS "NATIVE" "TBB" "JEMALLOC")
|
||||
|
||||
# include variable description
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vardescr")
|
||||
|
||||
@@ -728,6 +732,14 @@ else()
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_FLEX_EXECUTABLE")
|
||||
endif()
|
||||
|
||||
# Jemalloc
|
||||
if ("${USE_MMGR_TYPE}" STREQUAL "JEMALLOC")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/jemalloc")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_JEMALLOC")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_JEMALLOC")
|
||||
endif()
|
||||
|
||||
# qt for inspector and samples
|
||||
if (BUILD_Inspector OR BUILD_SAMPLES_QT)
|
||||
# check qt 3rdparty path
|
||||
|
143
adm/cmake/jemalloc.cmake
Normal file
143
adm/cmake/jemalloc.cmake
Normal file
@@ -0,0 +1,143 @@
|
||||
# JeMalloc
|
||||
|
||||
if (NOT DEFINED INSTALL_JEMALLOC)
|
||||
set (INSTALL_JEMALLOC OFF CACHE BOOL "${INSTALL_INSTALL_JEMALLOC_DESCR}")
|
||||
endif()
|
||||
|
||||
# include occt macros. compiler_bitness, os_with_bit, compiler
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
||||
|
||||
# specify JEMALLOC folder in connection with 3RDPARTY_DIR
|
||||
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
|
||||
if (NOT 3RDPARTY_JEMALLOC_DIR OR NOT EXISTS "${3RDPARTY_JEMALLOC_DIR}")
|
||||
FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" jemalloc JEMALLOC_DIR_NAME)
|
||||
if (JEMALLOC_DIR_NAME)
|
||||
set (3RDPARTY_JEMALLOC_DIR "${3RDPARTY_DIR}/${JEMALLOC_DIR_NAME}" CACHE PATH "The directory containing JEMALLOC" FORCE)
|
||||
set (3RDPARTY_JEMALLOC_DIR "${3RDPARTY_DIR}/${JEMALLOC_DIR_NAME}")
|
||||
message(STATUS "Info: JEMALLOC detected in ${3RDPARTY_JEMALLOC_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
endif()
|
||||
|
||||
# define required JEMALLOC variables
|
||||
if (NOT DEFINED 3RDPARTY_JEMALLOC_INCLUDE_DIR)
|
||||
set (3RDPARTY_JEMALLOC_INCLUDE_DIR "" CACHE PATH "the path of headers directory")
|
||||
endif()
|
||||
|
||||
# check 3RDPARTY_${PRODUCT_NAME}_ paths for consistency with specified 3RDPARTY_${PRODUCT_NAME}_DIR
|
||||
if (3RDPARTY_JEMALLOC_DIR AND EXISTS "${3RDPARTY_JEMALLOC_DIR}")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_JEMALLOC_DIR 3RDPARTY_JEMALLOC_INCLUDE_DIR PATH "the path to JEMALLOC")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_JEMALLOC_DIR 3RDPARTY_JEMALLOC_LIBRARY_DIR FILEPATH "The directory containing JEMALLOC libraries")
|
||||
endif()
|
||||
|
||||
# header
|
||||
if (NOT 3RDPARTY_JEMALLOC_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_JEMALLOC_INCLUDE_DIR}")
|
||||
set (HEADER_NAMES jemalloc.h)
|
||||
|
||||
# set 3RDPARTY_JEMALLOC_INCLUDE_DIR as notfound, otherwise find_library can't assign a new value to 3RDPARTY_JEMALLOC_INCLUDE_DIR
|
||||
set (3RDPARTY_JEMALLOC_INCLUDE_DIR "3RDPARTY_JEMALLOC_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "the path to header directory" FORCE)
|
||||
|
||||
if (3RDPARTY_JEMALLOC_DIR AND EXISTS "${3RDPARTY_JEMALLOC_DIR}")
|
||||
find_path (3RDPARTY_JEMALLOC_INCLUDE_DIR NAMES ${HEADER_NAMES}
|
||||
PATHS ${3RDPARTY_JEMALLOC_DIR}
|
||||
PATH_SUFFIXES include/jemalloc
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_JEMALLOC_INCLUDE_DIR AND EXISTS "${3RDPARTY_JEMALLOC_INCLUDE_DIR}")
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_JEMALLOC_INCLUDE_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_JEMALLOC_INCLUDE_DIR)
|
||||
set (3RDPARTY_JEMALLOC_INCLUDE_DIR "" CACHE FILEPATH "the path to jemalloc.h" FORCE)
|
||||
endif()
|
||||
|
||||
# Installing destination path
|
||||
if (WIN32)
|
||||
set (JEMALLOC_INSTALL_DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
else()
|
||||
set (JEMALLOC_INSTALL_DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
|
||||
endif()
|
||||
|
||||
macro (JEMALLOC_LIB_SEARCH MMGR_LIB PREFIX)
|
||||
if (NOT 3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB})
|
||||
set (JEMALLOC_PATH_SUFFIXES "lib" "bin")
|
||||
set (3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB} "3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB}-NOTFOUND")
|
||||
if (3RDPARTY_JEMALLOC_DIR AND EXISTS "${3RDPARTY_JEMALLOC_DIR}")
|
||||
find_library (3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB} NAMES ${MMGR_LIB}
|
||||
PATHS "${3RDPARTY_JEMALLOC_LIBRARY_DIR}" "${3RDPARTY_JEMALLOC_DIR}"
|
||||
PATH_SUFFIXES ${JEMALLOC_PATH_SUFFIXES}
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library (3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB} NAMES ${MMGR_LIB}
|
||||
PATH_SUFFIXES ${JEMALLOC_PATH_SUFFIXES}
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
endif()
|
||||
if (3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB})
|
||||
get_filename_component (3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB} "${3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB}}" PATH)
|
||||
set (3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB} "${3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB}}")
|
||||
else()
|
||||
set (3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB} "")
|
||||
endif()
|
||||
endif()
|
||||
if (3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB})
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB}}")
|
||||
set (3RDPARTY_JEMALLOC_LIBRARY_DIR "${3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB}}" CACHE PATH "The directory containing JEMALLOC libraries" FORCE)
|
||||
else()
|
||||
message("Cannot find ${MMGR_LIB} library in jemalloc 3rdparty")
|
||||
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB})
|
||||
set (3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB} "")
|
||||
endif()
|
||||
set (JEMALLOC_IS_STATIC_LIB FALSE)
|
||||
if (((${3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB}} MATCHES "lib$")) OR ((${3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB}} MATCHES "a$")))
|
||||
get_filename_component(STATIC_LIB_NAME ${3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB}} NAME)
|
||||
list(APPEND CSF_MMGR "${STATIC_LIB_NAME}")
|
||||
set (JEMALLOC_IS_STATIC_LIB TRUE)
|
||||
endif()
|
||||
# install instructions
|
||||
if (INSTALL_JEMALLOC AND NOT JEMALLOC_IS_STATIC_LIB)
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
get_filename_component(3RDPARTY_JEMALLOC_LIBRARY ${3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB}} REALPATH)
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES "${3RDPARTY_JEMALLOC_LIBRARY}"
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
|
||||
else()
|
||||
install (FILES "${3RDPARTY_JEMALLOC_LIBRARY}"
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${JEMALLOC_INSTALL_DESTINATION}d")
|
||||
install (FILES "${3RDPARTY_JEMALLOC_LIBRARY}"
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${JEMALLOC_INSTALL_DESTINATION}")
|
||||
install (FILES "${3RDPARTY_JEMALLOC_LIBRARY}"
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${JEMALLOC_INSTALL_DESTINATION}i")
|
||||
endif()
|
||||
set (USED_3RDPARTY_JEMALLOC_DIR "")
|
||||
elseif(NOT JEMALLOC_IS_STATIC_LIB)
|
||||
# the library directory for using by the executable
|
||||
set (USED_3RDPARTY_JEMALLOC_DIR ${3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB}})
|
||||
endif()
|
||||
unset(3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB} CACHE)
|
||||
unset(3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB} CACHE)
|
||||
endmacro()
|
||||
|
||||
# Reset CSF variable
|
||||
set (CSF_MMGR "")
|
||||
|
||||
# find static jemalloc lib
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a")
|
||||
if (WIN32)
|
||||
JEMALLOC_LIB_SEARCH ("jemalloc" "STATIC")
|
||||
elseif(NOT WIN32)
|
||||
JEMALLOC_LIB_SEARCH ("jemalloc_pic" "STATIC")
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES "" "so")
|
||||
JEMALLOC_LIB_SEARCH ("jemalloc.so.2" "SHARED")
|
||||
endif()
|
||||
|
||||
# find shared jemalloc lib
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".so")
|
||||
JEMALLOC_LIB_SEARCH ("jemalloc" "SHARED")
|
@@ -11,9 +11,12 @@ set(FLAGS_ALREADY_INCLUDED 1)
|
||||
# project can be switched later to use Intel Compiler (ICC).
|
||||
# Enforcing -fp:precise ensures that in such case ICC will use correct
|
||||
# option instead of its default -fp:fast which is harmful for OCCT.
|
||||
# Enforcing OMP only for internal test env
|
||||
if (MSVC)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fp:precise")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /openmp")
|
||||
endif()
|
||||
|
||||
# add SSE2 option for old MSVC compilers (VS 2005 - 2010, 32 bit only)
|
||||
|
@@ -14,6 +14,7 @@ if /I "%VCVER%" == "@COMPILER@" (
|
||||
set "TBB_DIR=@3RDPARTY_TBB_DLL_DIR@"
|
||||
set "VTK_DIR=@3RDPARTY_VTK_DLL_DIR@"
|
||||
set "FFMPEG_DIR=@3RDPARTY_FFMPEG_DLL_DIR@"
|
||||
set "JEMALLOC_DIR=@3RDPARTY_JEMALLOC_LIBRARY_DIR@"
|
||||
set "OPENVR_DIR=@3RDPARTY_OPENVR_DLL_DIRS@"
|
||||
|
||||
if not "@3RDPARTY_QT_DIR@" == "" (
|
||||
@@ -40,7 +41,7 @@ if /I "%VCVER%" == "@COMPILER@" (
|
||||
set "CSF_OCCTTestsPath=@CMAKE_SOURCE_DIR@/tests"
|
||||
set "CSF_OCCTDocPath=@CMAKE_SOURCE_DIR@/doc"
|
||||
|
||||
rem for compatability with external application using CASROOT
|
||||
rem for compatibility with external application using CASROOT
|
||||
set "CASROOT=@CMAKE_SOURCE_DIR@"
|
||||
)
|
||||
)
|
||||
|
@@ -12,6 +12,7 @@ if [ "$1" == "@BIN_LETTER@" ]; then
|
||||
export TBB_DIR="@3RDPARTY_TBB_LIBRARY_DIR@"
|
||||
export VTK_DIR="@3RDPARTY_VTK_LIBRARY_DIR@"
|
||||
export FFMPEG_DIR="@3RDPARTY_FFMPEG_LIBRARY_DIR@"
|
||||
export JEMALLOC_DIR="@3RDPARTY_JEMALLOC_LIBRARY_DIR@"
|
||||
|
||||
if [ "x@3RDPARTY_QT_DIR" != "x" ]; then
|
||||
export QTDIR="@3RDPARTY_QT_DIR@"
|
||||
@@ -29,7 +30,7 @@ if [ "$1" == "@BIN_LETTER@" ]; then
|
||||
export CSF_OCCTTestsPath="@CMAKE_SOURCE_DIR@/tests"
|
||||
export CSF_OCCTDocPath="@CMAKE_SOURCE_DIR@/doc"
|
||||
|
||||
# for compatability with external application using CASROOT
|
||||
# for compatibility with external application using CASROOT
|
||||
export CASROOT="@CMAKE_SOURCE_DIR@"
|
||||
fi
|
||||
fi
|
||||
|
@@ -16,6 +16,7 @@ if /I "%VCVER%" == "@COMPILER@" (
|
||||
set "TBB_DIR=@USED_3RDPARTY_TBB_DIR@"
|
||||
set "VTK_DIR=@USED_3RDPARTY_VTK_DIR@"
|
||||
set "FFMPEG_DIR=@USED_3RDPARTY_FFMPEG_DIR@"
|
||||
set "JEMALLOC_DIR=@USED_3RDPARTY_JEMALLOC_DIR@"
|
||||
set "OPENVR_DIR=@USED_3RDPARTY_OPENVR_DIR@"
|
||||
|
||||
if not "@USED_3RDPARTY_QT_DIR@" == "" (
|
||||
|
@@ -12,6 +12,7 @@ if [ "$1" == "@BIN_LETTER@" ]; then
|
||||
export TBB_DIR="@USED_3RDPARTY_TBB_DIR@"
|
||||
export VTK_DIR="@USED_3RDPARTY_VTK_DIR@"
|
||||
export FFMPEG_DIR="@USED_3RDPARTY_FFMPEG_DIR@"
|
||||
export JEMALLOC_DIR="@USED_3RDPARTY_JEMALLOC_DIR@"
|
||||
|
||||
if [ "x@USED_3RDPARTY_QT_DIR@" != "x" ]; then
|
||||
export QTDIR="@USED_3RDPARTY_QT_DIR@"
|
||||
|
@@ -74,6 +74,10 @@ if not "%DevEnvDir%" == "" (
|
||||
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
|
||||
set "DevEnvDir=%%i\Common7\IDE\"
|
||||
)
|
||||
) else if /I "%VCFMT%" == "vc143" (
|
||||
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[17.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
|
||||
set "DevEnvDir=%%i\Common7\IDE\"
|
||||
)
|
||||
) else if /I "%VCFMT%" == "gcc" (
|
||||
rem MinGW
|
||||
) else (
|
||||
@@ -107,6 +111,11 @@ if /I "%VCFMT%" == "vc9" (
|
||||
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
|
||||
)
|
||||
set "VCPlatformToolSet=v142"
|
||||
) else if /I "%VCFMT%" == "vc143" (
|
||||
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[17.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
|
||||
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
|
||||
)
|
||||
set "VCPlatformToolSet=v142"
|
||||
) else if /I "%VCFMT%" == "gcc" (
|
||||
rem MinGW
|
||||
) else (
|
||||
@@ -115,7 +124,7 @@ if /I "%VCFMT%" == "vc9" (
|
||||
exit
|
||||
)
|
||||
|
||||
rem ----- For compatability with external application using CASROOT -----
|
||||
rem ----- For compatibility with external application using CASROOT -----
|
||||
if ["%CASROOT%"] == [""] set "CASROOT=%SCRIPTROOT%"
|
||||
|
||||
rem ----- Define path to 3rdparty products -----
|
||||
@@ -126,11 +135,16 @@ if ["%ARCH%"] == ["64"] set VCARCH=amd64
|
||||
|
||||
if /I ["%1"] == ["vc141"] set "VCVER=vc14"
|
||||
if /I ["%1"] == ["vc142"] set "VCVER=vc14"
|
||||
if /I ["%1"] == ["vc143"] set "VCVER=vc14"
|
||||
|
||||
if exist "%CASROOT%\custom.bat" (
|
||||
call "%CASROOT%\custom.bat" %VCVER% %ARCH% %CASDEB%
|
||||
)
|
||||
|
||||
if not ["%QTDIR%"] == [""] (
|
||||
set "PATH=%QTDIR%/bin;%PATH%"
|
||||
set "QT_PLUGIN_PATH=%QTDIR%/plugins"
|
||||
)
|
||||
if not ["%TCL_DIR%"] == [""] set "PATH=%TCL_DIR%;%PATH%"
|
||||
if not ["%TK_DIR%"] == [""] set "PATH=%TK_DIR%;%PATH%"
|
||||
if not ["%FREETYPE_DIR%"] == [""] set "PATH=%FREETYPE_DIR%;%PATH%"
|
||||
@@ -140,11 +154,8 @@ if not ["%GLES2_DIR%"] == [""] set "PATH=%GLES2_DIR%;%PATH%"
|
||||
if not ["%TBB_DIR%"] == [""] set "PATH=%TBB_DIR%;%PATH%"
|
||||
if not ["%VTK_DIR%"] == [""] set "PATH=%VTK_DIR%;%PATH%"
|
||||
if not ["%FFMPEG_DIR%"] == [""] set "PATH=%FFMPEG_DIR%;%PATH%"
|
||||
if not ["%JEMALLOC_DIR%"] == [""] set "PATH=%JEMALLOC_DIR%;%PATH%"
|
||||
if not ["%OPENVR_DIR%"] == [""] set "PATH=%OPENVR_DIR%;%PATH%"
|
||||
if not ["%QTDIR%"] == [""] (
|
||||
set "PATH=%QTDIR%/bin;%PATH%"
|
||||
set "QT_PLUGIN_PATH=%QTDIR%/plugins"
|
||||
)
|
||||
|
||||
rem ----- Set path to 3rd party and OCCT libraries -----
|
||||
if not "%CSF_OCCTBinPath%" == "" (
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";
|
||||
|
||||
# ----- For compatability with external application using CASROOT -----
|
||||
# ----- For compatibility with external application using CASROOT -----
|
||||
if [ "${CASROOT}" == "" ]; then
|
||||
export CASROOT="${aScriptPath}"
|
||||
fi
|
||||
@@ -69,6 +69,10 @@ if [ "$FFMPEG_DIR" != "" ]; then
|
||||
THRDPARTY_PATH="${FFMPEG_DIR}:${THRDPARTY_PATH}"
|
||||
fi
|
||||
|
||||
if [ "$JEMALLOC_DIR" != "" ]; then
|
||||
THRDPARTY_PATH="${JEMALLOC_DIR}:${THRDPARTY_PATH}"
|
||||
fi
|
||||
|
||||
if [ "$QTDIR" != "" ]; then
|
||||
THRDPARTY_PATH="${QTDIR}/lib:${THRDPARTY_PATH}"
|
||||
fi
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";
|
||||
|
||||
# ----- For compatability with external application using CASROOT -----
|
||||
# ----- For compatibility with external application using CASROOT -----
|
||||
if [ "${CASROOT}" == "" ]; then
|
||||
export CASROOT="@INSTALL_DIR@"
|
||||
fi
|
||||
@@ -71,6 +71,10 @@ if [ "$FFMPEG_DIR" != "" ]; then
|
||||
THRDPARTY_PATH="${FFMPEG_DIR}:${THRDPARTY_PATH}"
|
||||
fi
|
||||
|
||||
if [ "$JEMALLOC_DIR" != "" ]; then
|
||||
THRDPARTY_PATH="${JEMALLOC_DIR}:${THRDPARTY_PATH}"
|
||||
fi
|
||||
|
||||
if [ "$QTDIR" != "" ]; then
|
||||
THRDPARTY_PATH="${QTDIR}/lib:${THRDPARTY_PATH}"
|
||||
fi
|
||||
|
@@ -2440,7 +2440,7 @@ void AIS_InteractiveContext::setObjectStatus (const Handle(AIS_InteractiveObject
|
||||
{
|
||||
if (theStatus != AIS_DS_None)
|
||||
{
|
||||
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
|
||||
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (theStatus, theDispMode, theSelectionMode);
|
||||
myObjects.Bind (theIObj, aStatus);
|
||||
}
|
||||
else
|
||||
|
@@ -101,38 +101,44 @@ Standard_Boolean BRepMesh_BaseMeshAlgo::initDataStructure()
|
||||
|
||||
for (Standard_Integer aEdgeIt = 0; aEdgeIt < aDWire->EdgesNb(); ++aEdgeIt)
|
||||
{
|
||||
const IMeshData::IEdgeHandle aDEdge = aDWire->GetEdge(aEdgeIt);
|
||||
const IMeshData::IEdgeHandle aDEdge = aDWire->GetEdge (aEdgeIt);
|
||||
const IMeshData::ICurveHandle& aCurve = aDEdge->GetCurve();
|
||||
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve(
|
||||
myDFace.get(), aDWire->GetEdgeOrientation(aEdgeIt));
|
||||
const IMeshData::ListOfInteger& aListOfPCurves = aDEdge->GetPCurves (myDFace.get());
|
||||
|
||||
const TopAbs_Orientation aOri = fixSeamEdgeOrientation(aDEdge, aPCurve);
|
||||
|
||||
Standard_Integer aPrevNodeIndex = -1;
|
||||
const Standard_Integer aLastPoint = aPCurve->ParametersNb() - 1;
|
||||
for (Standard_Integer aPointIt = 0; aPointIt <= aLastPoint; ++aPointIt)
|
||||
for (IMeshData::ListOfInteger::Iterator aPCurveIt(aListOfPCurves); aPCurveIt.More(); aPCurveIt.Next())
|
||||
{
|
||||
const Standard_Integer aNodeIndex = registerNode(
|
||||
aCurve ->GetPoint(aPointIt),
|
||||
aPCurve->GetPoint(aPointIt),
|
||||
BRepMesh_Frontier, Standard_False/*aPointIt > 0 && aPointIt < aLastPoint*/);
|
||||
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve (aPCurveIt.Value());
|
||||
|
||||
aPCurve->GetIndex(aPointIt) = aNodeIndex;
|
||||
myUsedNodes->Bind(aNodeIndex, aNodeIndex);
|
||||
const TopAbs_Orientation aOri = fixSeamEdgeOrientation(aDEdge, aPCurve);
|
||||
|
||||
if (aPrevNodeIndex != -1 && aPrevNodeIndex != aNodeIndex)
|
||||
Standard_Integer aPrevNodeIndex = -1;
|
||||
const Standard_Integer aLastPoint = aPCurve->ParametersNb() - 1;
|
||||
|
||||
Standard_Integer aPointIt = 0;
|
||||
for (; aPointIt <= aLastPoint; ++aPointIt)
|
||||
{
|
||||
const Standard_Integer aLinksNb = myStructure->NbLinks();
|
||||
const Standard_Integer aLinkIndex = addLinkToMesh(aPrevNodeIndex, aNodeIndex, aOri);
|
||||
if (aWireIt != 0 && aLinkIndex <= aLinksNb)
|
||||
{
|
||||
// Prevent holes around wire of zero area.
|
||||
BRepMesh_Edge& aLink = const_cast<BRepMesh_Edge&>(myStructure->GetLink(aLinkIndex));
|
||||
aLink.SetMovability(BRepMesh_Fixed);
|
||||
}
|
||||
}
|
||||
const Standard_Integer aNodeIndex = registerNode(
|
||||
aCurve->GetPoint(aPointIt),
|
||||
aPCurve->GetPoint(aPointIt),
|
||||
BRepMesh_Frontier, Standard_False/*aPointIt > 0 && aPointIt < aLastPoint*/);
|
||||
|
||||
aPrevNodeIndex = aNodeIndex;
|
||||
aPCurve->GetIndex (aPointIt) = aNodeIndex;
|
||||
myUsedNodes->Bind (aNodeIndex, aNodeIndex);
|
||||
|
||||
if (aPrevNodeIndex != -1 && aPrevNodeIndex != aNodeIndex)
|
||||
{
|
||||
const Standard_Integer aLinksNb = myStructure->NbLinks();
|
||||
const Standard_Integer aLinkIndex = addLinkToMesh(aPrevNodeIndex, aNodeIndex, aOri);
|
||||
if (aWireIt != 0 && aLinkIndex <= aLinksNb)
|
||||
{
|
||||
// Prevent holes around wire of zero area.
|
||||
BRepMesh_Edge& aLink = const_cast<BRepMesh_Edge&>(myStructure->GetLink(aLinkIndex));
|
||||
aLink.SetMovability(BRepMesh_Fixed);
|
||||
}
|
||||
}
|
||||
|
||||
aPrevNodeIndex = aNodeIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -93,6 +93,15 @@ const IMeshData::IPCurveHandle& BRepMeshData_Edge::GetPCurve (
|
||||
myPCurves (aListOfPCurves.Last ());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: GetPCurves
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
const IMeshData::ListOfInteger& BRepMeshData_Edge::GetPCurves (const IMeshData::IFacePtr& theDFace) const
|
||||
{
|
||||
return myPCurvesMap.Find (theDFace);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: GetPCurve
|
||||
// Purpose :
|
||||
|
@@ -49,6 +49,10 @@ public:
|
||||
const IMeshData::IFacePtr& theDFace,
|
||||
const TopAbs_Orientation theOrientation) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns an array of pcurves indices for the specified discrete face.
|
||||
Standard_EXPORT virtual const IMeshData::ListOfInteger& GetPCurves(
|
||||
const IMeshData::IFacePtr& theDFace) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns pcurve with the given index.
|
||||
Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve (
|
||||
const Standard_Integer theIndex) const Standard_OVERRIDE;
|
||||
|
@@ -3115,12 +3115,23 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real FaceDU = UF2 - UF1;
|
||||
Standard_Real FaceDV = VF2 - VF1;
|
||||
UU1 = UF1 - 10*FaceDU;
|
||||
UU2 = UF2 + 10*FaceDU;
|
||||
VV1 = VF1 - 10*FaceDV;
|
||||
VV2 = VF2 + 10*FaceDV;
|
||||
if (theExtensionMode == 2)
|
||||
{
|
||||
Standard_Real FaceDU = UF2 - UF1;
|
||||
Standard_Real FaceDV = VF2 - VF1;
|
||||
UU1 = UF1 - 10*FaceDU;
|
||||
UU2 = UF2 + 10*FaceDU;
|
||||
VV1 = VF1 - 10*FaceDV;
|
||||
VV2 = VF2 + 10*FaceDV;
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real aSize = theLenBeforeUfirst;
|
||||
UU1 = UF1 - aSize;
|
||||
UU2 = UF2 + aSize;
|
||||
VV1 = VF1 - aSize;
|
||||
VV2 = VF2 + aSize;
|
||||
}
|
||||
coeff = 1.;
|
||||
}
|
||||
|
||||
|
@@ -57,6 +57,10 @@ public:
|
||||
const IMeshData::IFacePtr& theDFace,
|
||||
const TopAbs_Orientation theOrientation) const = 0;
|
||||
|
||||
//! Returns an array of pcurves indices for the specified discrete face.
|
||||
Standard_EXPORT virtual const IMeshData::ListOfInteger& GetPCurves (
|
||||
const IMeshData::IFacePtr& theDFace) const = 0;
|
||||
|
||||
//! Returns pcurve with the given index.
|
||||
Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve (
|
||||
const Standard_Integer theIndex) const = 0;
|
||||
|
@@ -526,6 +526,8 @@
|
||||
#include <RWStepVisual_RWPresentationStyleByContext.hxx>
|
||||
#include <RWStepVisual_RWPresentationView.hxx>
|
||||
#include <RWStepVisual_RWPresentedItemRepresentation.hxx>
|
||||
#include <RWStepVisual_RWRepositionedTessellatedGeometricSet.hxx>
|
||||
#include <RWStepVisual_RWRepositionedTessellatedItem.hxx>
|
||||
#include <RWStepVisual_RWStyledItem.hxx>
|
||||
#include <RWStepVisual_RWSurfaceSideStyle.hxx>
|
||||
#include <RWStepVisual_RWSurfaceStyleBoundary.hxx>
|
||||
@@ -1082,6 +1084,8 @@
|
||||
#include <StepVisual_PresentationStyleByContext.hxx>
|
||||
#include <StepVisual_PresentationView.hxx>
|
||||
#include <StepVisual_PresentedItemRepresentation.hxx>
|
||||
#include <StepVisual_RepositionedTessellatedGeometricSet.hxx>
|
||||
#include <StepVisual_RepositionedTessellatedItem.hxx>
|
||||
#include <StepVisual_StyledItem.hxx>
|
||||
#include <StepVisual_SurfaceSideStyle.hxx>
|
||||
#include <StepVisual_SurfaceStyleBoundary.hxx>
|
||||
@@ -5193,6 +5197,13 @@ void RWStepAP214_GeneralModule::FillSharedCase(const Standard_Integer CN,
|
||||
tool.Share(anent, iter);
|
||||
}
|
||||
break;
|
||||
case 802:
|
||||
{
|
||||
DeclareAndCast(StepVisual_RepositionedTessellatedGeometricSet, anEnt, ent);
|
||||
RWStepVisual_RWRepositionedTessellatedGeometricSet aTool;
|
||||
aTool.Share(anEnt, iter);
|
||||
break;
|
||||
}
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
@@ -7217,6 +7228,12 @@ Standard_Boolean RWStepAP214_GeneralModule::NewVoid
|
||||
case 723:
|
||||
ent = new StepVisual_SurfaceStyleRenderingWithProperties;
|
||||
break;
|
||||
case 802:
|
||||
ent = new StepVisual_RepositionedTessellatedGeometricSet;
|
||||
break;
|
||||
case 803:
|
||||
ent = new StepVisual_RepositionedTessellatedItem;
|
||||
break;
|
||||
default:
|
||||
return Standard_False;
|
||||
}
|
||||
@@ -7819,7 +7836,8 @@ Standard_Integer RWStepAP214_GeneralModule::CategoryNumber
|
||||
case 721:
|
||||
case 722:
|
||||
case 723: return catdr;
|
||||
|
||||
case 802: return cataux;
|
||||
case 803: return cataux;
|
||||
default : break;
|
||||
}
|
||||
return 0;
|
||||
|
@@ -258,6 +258,8 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_ReadWriteModule,StepData_ReadWriteModule)
|
||||
#include <StepVisual_PresentationStyleAssignment.hxx>
|
||||
#include <StepVisual_PresentationStyleByContext.hxx>
|
||||
#include <StepVisual_PresentationView.hxx>
|
||||
#include <StepVisual_RepositionedTessellatedGeometricSet.hxx>
|
||||
#include <StepVisual_RepositionedTessellatedItem.hxx>
|
||||
#include <StepBasic_Product.hxx>
|
||||
#include <StepBasic_ProductCategory.hxx>
|
||||
#include <StepBasic_ProductContext.hxx>
|
||||
@@ -654,6 +656,8 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_ReadWriteModule,StepData_ReadWriteModule)
|
||||
#include <RWStepVisual_RWPresentationStyleAssignment.hxx>
|
||||
#include <RWStepVisual_RWPresentationStyleByContext.hxx>
|
||||
#include <RWStepVisual_RWPresentationView.hxx>
|
||||
#include <RWStepVisual_RWRepositionedTessellatedGeometricSet.hxx>
|
||||
#include <RWStepVisual_RWRepositionedTessellatedItem.hxx>
|
||||
#include <RWStepBasic_RWProduct.hxx>
|
||||
#include <RWStepBasic_RWProductCategory.hxx>
|
||||
#include <RWStepBasic_RWProductContext.hxx>
|
||||
@@ -2047,6 +2051,8 @@ static TCollection_AsciiString Reco_AnnotationPlane("ANNOTATION_PLANE");
|
||||
static TCollection_AsciiString Reco_TessellatedAnnotationOccurrence("TESSELLATED_ANNOTATION_OCCURRENCE");
|
||||
static TCollection_AsciiString Reco_TessellatedGeometricSet("TESSELLATED_GEOMETRIC_SET");
|
||||
static TCollection_AsciiString Reco_TessellatedCurveSet("TESSELLATED_CURVE_SET");
|
||||
static TCollection_AsciiString Reco_TessellatedItem("TESSELLATED_ITEM");
|
||||
static TCollection_AsciiString Reco_RepositionedTessellatedItem("REPOSITIONED_TESSELLATED_ITEM");
|
||||
static TCollection_AsciiString Reco_CoordinatesList("COORDINATES_LIST");
|
||||
static TCollection_AsciiString Reco_ConstructiveGeometryRepresentation("CONSTRUCTIVE_GEOMETRY_REPRESENTATION");
|
||||
static TCollection_AsciiString Reco_ConstructiveGeometryRepresentationRelationship("CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP");
|
||||
@@ -2721,6 +2727,7 @@ RWStepAP214_ReadWriteModule::RWStepAP214_ReadWriteModule ()
|
||||
typenums.Bind (Reco_SurfaceStyleReflectanceAmbient, 721);
|
||||
typenums.Bind (Reco_SurfaceStyleRendering, 722);
|
||||
typenums.Bind (Reco_SurfaceStyleRenderingWithProperties, 723);
|
||||
typenums.Bind (Reco_RepositionedTessellatedItem, 803);
|
||||
|
||||
// SHORT NAMES
|
||||
// NB : la liste est celle de AP203
|
||||
@@ -3489,13 +3496,22 @@ Standard_Integer RWStepAP214_ReadWriteModule::CaseStep
|
||||
types(5).IsEqual(StepType(624))))) {
|
||||
return 705;
|
||||
}
|
||||
if ((types(1).IsEqual(StepType(4))) &&
|
||||
else if ((types(1).IsEqual(StepType(4))) &&
|
||||
(types(2).IsEqual(StepType(7))) &&
|
||||
(types(3).IsEqual(StepType(144))) &&
|
||||
(types(4).IsEqual(StepType(247))) &&
|
||||
(types(5).IsEqual(StepType(270)))) {
|
||||
(types(5).IsEqual(StepType(270))))
|
||||
{
|
||||
return 719;
|
||||
}
|
||||
else if ((types(1).IsEqual(StepType(144))) &&
|
||||
(types(2).IsEqual(StepType(803))) &&
|
||||
(types(3).IsEqual(StepType(247))) &&
|
||||
(types(4).IsEqual(StepType(709))) &&
|
||||
(types(5).IsEqual(StepType(708))))
|
||||
{
|
||||
return 802;
|
||||
}
|
||||
}
|
||||
else if (NbComp == 4) {
|
||||
if ((types(1).IsEqual(StepType(161))) &&
|
||||
@@ -4565,6 +4581,7 @@ const TCollection_AsciiString& RWStepAP214_ReadWriteModule::StepType
|
||||
case 704: return Reco_AnnotationPlane;
|
||||
|
||||
case 707 : return Reco_TessellatedAnnotationOccurrence;
|
||||
case 708 : return Reco_TessellatedItem;
|
||||
case 709 : return Reco_TessellatedGeometricSet;
|
||||
|
||||
case 710 : return Reco_TessellatedCurveSet;
|
||||
@@ -4581,6 +4598,7 @@ const TCollection_AsciiString& RWStepAP214_ReadWriteModule::StepType
|
||||
case 722 : return Reco_SurfaceStyleRendering;
|
||||
case 723 : return Reco_SurfaceStyleRenderingWithProperties;
|
||||
|
||||
case 803: return Reco_RepositionedTessellatedItem;
|
||||
default : return PasReco;
|
||||
}
|
||||
}
|
||||
@@ -4864,7 +4882,6 @@ Standard_Boolean RWStepAP214_ReadWriteModule::ComplexType(const Standard_Integer
|
||||
types.Append (StepType(625));
|
||||
types.Append (StepType(677));
|
||||
break;
|
||||
default : return Standard_False;
|
||||
case 698:
|
||||
types.Append (StepType(671));
|
||||
types.Append (StepType(470));
|
||||
@@ -4902,6 +4919,14 @@ Standard_Boolean RWStepAP214_ReadWriteModule::ComplexType(const Standard_Integer
|
||||
types.Append(StepType(247));
|
||||
types.Append(StepType(270));
|
||||
break;
|
||||
case 802:
|
||||
types.Append(StepType(144));
|
||||
types.Append(StepType(803));
|
||||
types.Append(StepType(247));
|
||||
types.Append(StepType(709));
|
||||
types.Append(StepType(708));
|
||||
break;
|
||||
default: return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -9508,6 +9533,20 @@ void RWStepAP214_ReadWriteModule::ReadStep(const Standard_Integer CN,
|
||||
tool.ReadStep(data, num, ach, anent);
|
||||
}
|
||||
break;
|
||||
case 802:
|
||||
{
|
||||
DeclareAndCast(StepVisual_RepositionedTessellatedGeometricSet, anEnt, ent);
|
||||
RWStepVisual_RWRepositionedTessellatedGeometricSet aTool;
|
||||
aTool.ReadStep(data, num, ach, anEnt);
|
||||
break;
|
||||
}
|
||||
case 803:
|
||||
{
|
||||
DeclareAndCast(StepVisual_RepositionedTessellatedItem, anEnt, ent);
|
||||
RWStepVisual_RWRepositionedTessellatedItem aTool;
|
||||
aTool.ReadStep(data, num, ach, anEnt);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
ach->AddFail("Type Mismatch when reading - Entity");
|
||||
@@ -14392,6 +14431,21 @@ void RWStepAP214_ReadWriteModule::WriteStep(const Standard_Integer CN,
|
||||
tool.WriteStep(SW, anent);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 802:
|
||||
{
|
||||
DeclareAndCast(StepVisual_RepositionedTessellatedGeometricSet, anEnt, ent);
|
||||
RWStepVisual_RWRepositionedTessellatedGeometricSet aTool;
|
||||
aTool.WriteStep(SW, anEnt);
|
||||
break;
|
||||
}
|
||||
case 803:
|
||||
{
|
||||
DeclareAndCast(StepVisual_RepositionedTessellatedItem, anEnt, ent);
|
||||
RWStepVisual_RWRepositionedTessellatedItem aTool;
|
||||
aTool.WriteStep(SW, anEnt);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@@ -106,6 +106,10 @@ RWStepVisual_RWPresentationView.cxx
|
||||
RWStepVisual_RWPresentationView.hxx
|
||||
RWStepVisual_RWPresentedItemRepresentation.cxx
|
||||
RWStepVisual_RWPresentedItemRepresentation.hxx
|
||||
RWStepVisual_RWRepositionedTessellatedGeometricSet.cxx
|
||||
RWStepVisual_RWRepositionedTessellatedGeometricSet.hxx
|
||||
RWStepVisual_RWRepositionedTessellatedItem.cxx
|
||||
RWStepVisual_RWRepositionedTessellatedItem.hxx
|
||||
RWStepVisual_RWStyledItem.cxx
|
||||
RWStepVisual_RWStyledItem.hxx
|
||||
RWStepVisual_RWSurfaceSideStyle.cxx
|
||||
|
@@ -0,0 +1,99 @@
|
||||
// Copyright (c) 2022 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 <RWStepVisual_RWRepositionedTessellatedGeometricSet.hxx>
|
||||
|
||||
#include <Interface_Check.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <StepData_StepReaderData.hxx>
|
||||
#include <StepData_StepWriter.hxx>
|
||||
#include <StepRepr_RepresentationItem.hxx>
|
||||
#include <StepVisual_HArray1OfPresentationStyleAssignment.hxx>
|
||||
#include <StepVisual_PresentationStyleAssignment.hxx>
|
||||
#include <StepVisual_RepositionedTessellatedGeometricSet.hxx>
|
||||
#include <StepGeom_Axis2Placement3d.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWRepositionedTessellatedGeometricSet::ReadStep
|
||||
(const Handle(StepData_StepReaderData)& theData,
|
||||
const Standard_Integer theNum,
|
||||
Handle(Interface_Check)& theAch,
|
||||
const Handle(StepVisual_RepositionedTessellatedGeometricSet)& theEnt) const
|
||||
{
|
||||
Standard_Integer aNum = 0;
|
||||
theData->NamedForComplex("REPOSITIONED_TESSELLATED_ITEM", theNum, aNum, theAch);
|
||||
if (!theData->CheckNbParams(aNum, 1, theAch, "location"))
|
||||
return;
|
||||
Handle(StepGeom_Axis2Placement3d) aLocation;
|
||||
theData->ReadEntity(aNum,1,"location",theAch,STANDARD_TYPE(StepGeom_Axis2Placement3d), aLocation);
|
||||
|
||||
theData->NamedForComplex("REPRESENTATION_ITEM", theNum, aNum, theAch);
|
||||
if (!theData->CheckNbParams(aNum, 1, theAch, "name"))
|
||||
return;
|
||||
Handle(TCollection_HAsciiString) aName;
|
||||
theData->ReadString (aNum, 1, "name", theAch, aName);
|
||||
|
||||
theData->NamedForComplex("TESSELLATED_GEOMETRIC_SET", theNum, aNum, theAch);
|
||||
NCollection_Handle<StepVisual_Array1OfTessellatedItem> anItems;
|
||||
Standard_Integer aNSub2;
|
||||
if (theData->ReadSubList (aNum,1,"items",theAch,aNSub2)) {
|
||||
Standard_Integer aNb2 = theData->NbParams(aNSub2);
|
||||
anItems = new StepVisual_Array1OfTessellatedItem(1, aNb2);
|
||||
for (Standard_Integer i2 = 1; i2 <= aNb2; i2 ++) {
|
||||
Handle(StepVisual_TessellatedItem) anItem;
|
||||
if (theData->ReadEntity (aNSub2,i2,"item",theAch,STANDARD_TYPE(StepVisual_TessellatedItem), anItem))
|
||||
anItems->SetValue(i2,anItem);
|
||||
}
|
||||
}
|
||||
theEnt->Init(aName, anItems, aLocation);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWRepositionedTessellatedGeometricSet::WriteStep
|
||||
(StepData_StepWriter& theSW,
|
||||
const Handle(StepVisual_RepositionedTessellatedGeometricSet)& theEnt) const
|
||||
{
|
||||
theSW.StartEntity("GEOMETRIC_REPRESENTATION_ITEM");
|
||||
theSW.StartEntity("REPOSITIONED_TESSELLATED_ITEM");
|
||||
theSW.Send(theEnt->Location());
|
||||
theSW.StartEntity("REPRESENTATION_ITEM");
|
||||
theSW.Send(theEnt->Name());
|
||||
theSW.StartEntity("TESSELLATED_GEOMETRIC_SET");
|
||||
theSW.OpenSub();
|
||||
for(StepVisual_Array1OfTessellatedItem::Iterator anIter(*theEnt->Items());
|
||||
anIter.More(); anIter.Next())
|
||||
{
|
||||
theSW.Send(anIter.Value());
|
||||
}
|
||||
theSW.CloseSub();
|
||||
theSW.StartEntity("TESSELLATED_ITEM");
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Share
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWRepositionedTessellatedGeometricSet::Share(const Handle(StepVisual_RepositionedTessellatedGeometricSet)& theEnt,
|
||||
Interface_EntityIterator& theIter) const
|
||||
{
|
||||
// Own field : children
|
||||
for (Standard_Integer i = 1; i <= theEnt->Items()->Length(); i++)
|
||||
theIter.AddItem(theEnt->Items()->Value(i));
|
||||
theIter.AddItem(theEnt->Location());
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
// Copyright (c) 2022 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 _RWStepVisual_RWRepositionedTessellatedGeometricSet_HeaderFile
|
||||
#define _RWStepVisual_RWRepositionedTessellatedGeometricSet_HeaderFile
|
||||
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
class StepData_StepReaderData;
|
||||
class Interface_Check;
|
||||
class StepVisual_RepositionedTessellatedGeometricSet;
|
||||
class StepData_StepWriter;
|
||||
class Interface_EntityIterator;
|
||||
|
||||
//! Read & Write tool for complex RepositionedTessellatedGeometricSet
|
||||
class RWStepVisual_RWRepositionedTessellatedGeometricSet
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Empty constructor
|
||||
RWStepVisual_RWRepositionedTessellatedGeometricSet() {};
|
||||
|
||||
//! Reads RepositionedTessellatedGeometricSet
|
||||
Standard_EXPORT void ReadStep (const Handle(StepData_StepReaderData)& theData,
|
||||
const Standard_Integer theNum,
|
||||
Handle(Interface_Check)& theAch,
|
||||
const Handle(StepVisual_RepositionedTessellatedGeometricSet)& theEnt) const;
|
||||
|
||||
//! Writes RepositionedTessellatedGeometricSet
|
||||
Standard_EXPORT void WriteStep (StepData_StepWriter& theSW,
|
||||
const Handle(StepVisual_RepositionedTessellatedGeometricSet)& theEnt) const;
|
||||
|
||||
//! Fills data for graph (shared items)
|
||||
Standard_EXPORT void Share (const Handle(StepVisual_RepositionedTessellatedGeometricSet)& theEnt,
|
||||
Interface_EntityIterator& theIter) const;
|
||||
};
|
||||
#endif // _RWStepVisual_RWRepositionedTessellatedGeometricSet_HeaderFile
|
@@ -0,0 +1,58 @@
|
||||
// Copyright (c) 2022 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 <RWStepVisual_RWRepositionedTessellatedItem.hxx>
|
||||
|
||||
#include <Interface_Check.hxx>
|
||||
#include <StepData_StepReaderData.hxx>
|
||||
#include <StepData_StepWriter.hxx>
|
||||
#include <StepVisual_RepositionedTessellatedItem.hxx>
|
||||
#include <StepGeom_Axis2Placement3d.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWRepositionedTessellatedItem::ReadStep
|
||||
(const Handle(StepData_StepReaderData)& theData,
|
||||
const Standard_Integer theNum,
|
||||
Handle(Interface_Check)& theAch,
|
||||
const Handle(StepVisual_RepositionedTessellatedItem)& theEnt) const
|
||||
{
|
||||
// --- Number of Parameter Control ---
|
||||
if (!theData->CheckNbParams(theNum,2,theAch,"tessellated_item"))
|
||||
return;
|
||||
|
||||
// --- inherited field : name ---
|
||||
Handle(TCollection_HAsciiString) aName;
|
||||
theData->ReadString (theNum,1,"name",theAch,aName);
|
||||
// --- inherited field : location ---
|
||||
Handle(StepGeom_Axis2Placement3d) aLocation;
|
||||
theData->ReadEntity(theNum,2,"location", theAch, STANDARD_TYPE(StepGeom_Axis2Placement3d),aLocation);
|
||||
|
||||
//--- Initialisation of the read entity ---
|
||||
theEnt->Init(aName, aLocation);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWRepositionedTessellatedItem::WriteStep
|
||||
(StepData_StepWriter& theSW,
|
||||
const Handle(StepVisual_RepositionedTessellatedItem)& theEnt) const
|
||||
{
|
||||
// --- inherited field name ---
|
||||
theSW.Send(theEnt->Name());
|
||||
theSW.Send(theEnt->Location());
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
// Copyright (c) 2022 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 _RWStepVisual_RWRepositionedTessellatedItem_HeaderFile
|
||||
#define _RWStepVisual_RWRepositionedTessellatedItem_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
class StepData_StepReaderData;
|
||||
class Interface_Check;
|
||||
class StepVisual_RepositionedTessellatedItem;
|
||||
class StepData_StepWriter;
|
||||
|
||||
//! Read & Write tool for RepositionedTessellatedItem
|
||||
class RWStepVisual_RWRepositionedTessellatedItem
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Empty constructor
|
||||
RWStepVisual_RWRepositionedTessellatedItem() {};
|
||||
|
||||
//! Reads RepositionedTessellatedItem
|
||||
Standard_EXPORT void ReadStep (const Handle(StepData_StepReaderData)& theData,
|
||||
const Standard_Integer theNum,
|
||||
Handle(Interface_Check)& theAch,
|
||||
const Handle(StepVisual_RepositionedTessellatedItem)& theEnt) const;
|
||||
|
||||
//! Writes RepositionedTessellatedItem
|
||||
Standard_EXPORT void WriteStep (StepData_StepWriter& theSW,
|
||||
const Handle(StepVisual_RepositionedTessellatedItem)& theEnt) const;
|
||||
};
|
||||
#endif // _RWStepVisual_RWRepositionedTessellatedItem_HeaderFile
|
@@ -16,8 +16,11 @@
|
||||
#include <STEPCAFControl_Reader.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <Geom_Axis2Placement.hxx>
|
||||
#include <Geom_CartesianPoint.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
@@ -64,6 +67,7 @@
|
||||
#include <STEPControl_Reader.hxx>
|
||||
#include <StepGeom_GeometricRepresentationItem.hxx>
|
||||
#include <StepGeom_Axis2Placement3d.hxx>
|
||||
#include <StepGeom_Curve.hxx>
|
||||
#include <StepGeom_Direction.hxx>
|
||||
#include <StepDimTol_AngularityTolerance.hxx>
|
||||
#include <StepDimTol_CircularRunoutTolerance.hxx>
|
||||
@@ -203,6 +207,7 @@
|
||||
#include <StepVisual_PlanarBox.hxx>
|
||||
#include <StepVisual_PresentationLayerAssignment.hxx>
|
||||
#include <StepVisual_PresentationStyleByContext.hxx>
|
||||
#include <StepVisual_RepositionedTessellatedGeometricSet.hxx>
|
||||
#include <StepVisual_StyleContextSelect.hxx>
|
||||
#include <StepVisual_StyledItem.hxx>
|
||||
#include <StepVisual_ViewVolume.hxx>
|
||||
@@ -752,7 +757,6 @@ Standard_Boolean STEPCAFControl_Reader::Transfer (STEPControl_Reader &reader,
|
||||
|
||||
// Update assembly compounds
|
||||
STool->UpdateAssemblies();
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -1850,6 +1854,25 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
|
||||
Handle(StepVisual_TessellatedGeometricSet) aTessSet = Handle(StepVisual_TessellatedGeometricSet)::DownCast(aTessItem);
|
||||
if (aTessSet.IsNull())
|
||||
continue;
|
||||
gp_Trsf aTransf;
|
||||
if (aTessSet->IsKind(STANDARD_TYPE(StepVisual_RepositionedTessellatedGeometricSet)))
|
||||
{
|
||||
Handle(StepVisual_RepositionedTessellatedGeometricSet) aRTGS =
|
||||
Handle(StepVisual_RepositionedTessellatedGeometricSet)::DownCast(aTessSet);
|
||||
Handle(Geom_Axis2Placement) aLocation = StepToGeom::MakeAxis2Placement(aRTGS->Location());
|
||||
if (!aLocation.IsNull())
|
||||
{
|
||||
const gp_Ax3 anAx3Orig = gp::XOY();
|
||||
const gp_Ax3 anAx3Targ(aLocation->Ax2());
|
||||
if (anAx3Targ.Location().SquareDistance(anAx3Orig.Location()) >= Precision::SquareConfusion() ||
|
||||
!anAx3Targ.Direction().IsEqual(anAx3Orig.Direction(), Precision::Angular()) ||
|
||||
!anAx3Targ.XDirection().IsEqual(anAx3Orig.XDirection(), Precision::Angular()) ||
|
||||
!anAx3Targ.YDirection().IsEqual(anAx3Orig.YDirection(), Precision::Angular()))
|
||||
{
|
||||
aTransf.SetTransformation(anAx3Targ, anAx3Orig);
|
||||
}
|
||||
}
|
||||
}
|
||||
NCollection_Handle<StepVisual_Array1OfTessellatedItem> aListItems = aTessSet->Items();
|
||||
Standard_Integer nb = aListItems.IsNull() ? 0 : aListItems->Length();
|
||||
Handle(StepVisual_TessellatedCurveSet) aTessCurve;
|
||||
@@ -1895,7 +1918,7 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
|
||||
}
|
||||
aB.Add(aComp, aCurW);
|
||||
}
|
||||
anAnnotationShape = aComp;
|
||||
anAnnotationShape = aComp.Moved(aTransf);
|
||||
}
|
||||
if (!anAnnotationShape.IsNull())
|
||||
{
|
||||
@@ -2023,12 +2046,7 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
|
||||
{
|
||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
|
||||
aBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
||||
if (isHasPlane && !aBox.IsOut(aPlaneAxes.Location())) {
|
||||
aPtext = aPlaneAxes.Location();
|
||||
}
|
||||
else {
|
||||
aPtext = gp_Pnt((aXmin + aXmax) * 0.5, (aYmin + aYmax) * 0.5, (aZmin + aZmax) * 0.5);
|
||||
}
|
||||
aPtext = gp_Pnt((aXmin + aXmax) * 0.5, (aYmin + aYmax) * 0.5, (aZmin + aZmax) * 0.5);
|
||||
}
|
||||
else {
|
||||
aPtext = aPlaneAxes.Location();
|
||||
@@ -2056,6 +2074,46 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
|
||||
return;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : computePMIReferensePosition
|
||||
//purpose : compute position of shape contains in the shapeAspect
|
||||
//=======================================================================
|
||||
Standard_Boolean computePMIReferensePosition(const Handle(StepRepr_ShapeAspect)& theReference,
|
||||
const Interface_Graph& theGraph,
|
||||
gp_Pnt& thePosition)
|
||||
{
|
||||
if (theReference.IsNull())
|
||||
return Standard_False;
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU = NULL;
|
||||
for (Interface_EntityIterator anIt = theGraph.Sharings(theReference); aGISU.IsNull() && anIt.More(); anIt.Next())
|
||||
{
|
||||
aGISU = Handle(StepAP242_GeometricItemSpecificUsage)::DownCast(anIt.Value());
|
||||
}
|
||||
if (aGISU.IsNull() || aGISU->NbIdentifiedItem() == 0)
|
||||
return Standard_False;
|
||||
const Handle(StepRepr_RepresentationItem)& anItem = aGISU->IdentifiedItem()->Value(1);
|
||||
if (anItem->IsKind(STANDARD_TYPE(StepGeom_CartesianPoint)))
|
||||
{
|
||||
Handle(StepGeom_CartesianPoint) aPoint = Handle(StepGeom_CartesianPoint)::DownCast(anItem);
|
||||
thePosition.SetX(aPoint->CoordinatesValue(1));
|
||||
thePosition.SetY(aPoint->CoordinatesValue(2));
|
||||
thePosition.SetZ(aPoint->CoordinatesValue(3));
|
||||
return Standard_True;
|
||||
}
|
||||
else if (anItem->IsKind(STANDARD_TYPE(StepGeom_Axis2Placement3d)))
|
||||
{
|
||||
Handle(StepGeom_Axis2Placement3d) anA2P3D = Handle(StepGeom_Axis2Placement3d)::DownCast(anItem);
|
||||
if (!anA2P3D->Location().IsNull())
|
||||
{
|
||||
thePosition.SetX(anA2P3D->Location()->CoordinatesValue(1));
|
||||
thePosition.SetY(anA2P3D->Location()->CoordinatesValue(2));
|
||||
thePosition.SetZ(anA2P3D->Location()->CoordinatesValue(3));
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : readConnectionPoints
|
||||
//purpose : read connection points for given dimension
|
||||
@@ -2088,82 +2146,32 @@ void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR,
|
||||
aFact = UnitsMethods::LengthFactor();
|
||||
}
|
||||
|
||||
if (theGDT->IsKind(STANDARD_TYPE(StepShape_DimensionalSize))) {
|
||||
// retrieve derived geometry
|
||||
if (theGDT->IsKind(STANDARD_TYPE(StepShape_DimensionalSize)))
|
||||
{
|
||||
Handle(StepShape_DimensionalSize) aDim = Handle(StepShape_DimensionalSize)::DownCast(theGDT);
|
||||
Handle(StepRepr_DerivedShapeAspect) aDSA = Handle(StepRepr_DerivedShapeAspect)::DownCast(aDim->AppliesTo());
|
||||
if (aDSA.IsNull())
|
||||
return;
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU = NULL;
|
||||
for (Interface_EntityIterator anIt = aGraph.Sharings(aDSA); aGISU.IsNull() && anIt.More(); anIt.Next()) {
|
||||
aGISU = Handle(StepAP242_GeometricItemSpecificUsage)::DownCast(anIt.Value());
|
||||
gp_Pnt aPnt;
|
||||
if (computePMIReferensePosition(aDim->AppliesTo(), aGraph, aPnt))
|
||||
{
|
||||
// set connection point to object
|
||||
aPnt.SetXYZ(aPnt.XYZ() * aFact);
|
||||
theDimObject->SetPoint(aPnt);
|
||||
}
|
||||
if (aGISU.IsNull() || aGISU->NbIdentifiedItem() == 0)
|
||||
return;
|
||||
Handle(StepGeom_CartesianPoint) aPoint = Handle(StepGeom_CartesianPoint)::DownCast(aGISU->IdentifiedItem()->Value(1));
|
||||
if (aPoint.IsNull()) {
|
||||
// try Axis2Placement3d.location instead of CartesianPoint
|
||||
Handle(StepGeom_Axis2Placement3d) anA2P3D =
|
||||
Handle(StepGeom_Axis2Placement3d)::DownCast(aGISU->IdentifiedItem()->Value(1));
|
||||
if (anA2P3D.IsNull())
|
||||
return;
|
||||
aPoint = anA2P3D->Location();
|
||||
}
|
||||
|
||||
// set connection point to object
|
||||
gp_Pnt aPnt(aPoint->CoordinatesValue(1) * aFact, aPoint->CoordinatesValue(2) * aFact, aPoint->CoordinatesValue(3) * aFact);
|
||||
theDimObject->SetPoint(aPnt);
|
||||
}
|
||||
else if (theGDT->IsKind(STANDARD_TYPE(StepShape_DimensionalLocation))) {
|
||||
// retrieve derived geometry
|
||||
else if (theGDT->IsKind(STANDARD_TYPE(StepShape_DimensionalLocation)))
|
||||
{
|
||||
Handle(StepShape_DimensionalLocation) aDim = Handle(StepShape_DimensionalLocation)::DownCast(theGDT);
|
||||
Handle(StepRepr_DerivedShapeAspect) aDSA1 = Handle(StepRepr_DerivedShapeAspect)::DownCast(aDim->RelatingShapeAspect());
|
||||
Handle(StepRepr_DerivedShapeAspect) aDSA2 = Handle(StepRepr_DerivedShapeAspect)::DownCast(aDim->RelatedShapeAspect());
|
||||
if (aDSA1.IsNull() && aDSA2.IsNull())
|
||||
return;
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU1 = NULL;
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU2 = NULL;
|
||||
if (!aDSA1.IsNull()) {
|
||||
for (Interface_EntityIterator anIt = aGraph.Sharings(aDSA1); aGISU1.IsNull() && anIt.More(); anIt.Next()) {
|
||||
aGISU1 = Handle(StepAP242_GeometricItemSpecificUsage)::DownCast(anIt.Value());
|
||||
}
|
||||
gp_Pnt aPnt;
|
||||
if (computePMIReferensePosition(aDim->RelatingShapeAspect(), aGraph, aPnt))
|
||||
{
|
||||
// set connection point to object
|
||||
aPnt.SetXYZ(aPnt.XYZ() * aFact);
|
||||
theDimObject->SetPoint(aPnt);
|
||||
}
|
||||
if (!aDSA2.IsNull()) {
|
||||
for (Interface_EntityIterator anIt = aGraph.Sharings(aDSA2); aGISU2.IsNull() && anIt.More(); anIt.Next()) {
|
||||
aGISU2 = Handle(StepAP242_GeometricItemSpecificUsage)::DownCast(anIt.Value());
|
||||
}
|
||||
}
|
||||
// first point
|
||||
if (!aGISU1.IsNull() && aGISU1->NbIdentifiedItem() > 0) {
|
||||
Handle(StepGeom_CartesianPoint) aPoint = Handle(StepGeom_CartesianPoint)::DownCast(aGISU1->IdentifiedItem()->Value(1));
|
||||
if (aPoint.IsNull()) {
|
||||
// try Axis2Placement3d.location instead of CartesianPoint
|
||||
Handle(StepGeom_Axis2Placement3d) anA2P3D =
|
||||
Handle(StepGeom_Axis2Placement3d)::DownCast(aGISU1->IdentifiedItem()->Value(1));
|
||||
if (!anA2P3D.IsNull())
|
||||
aPoint = anA2P3D->Location();
|
||||
}
|
||||
if (!aPoint.IsNull()) {
|
||||
// set connection point to object
|
||||
gp_Pnt aPnt(aPoint->CoordinatesValue(1) * aFact, aPoint->CoordinatesValue(2) * aFact, aPoint->CoordinatesValue(3) * aFact);
|
||||
theDimObject->SetPoint(aPnt);
|
||||
}
|
||||
}
|
||||
// second point
|
||||
if (!aGISU2.IsNull() && aGISU2->NbIdentifiedItem() > 0) {
|
||||
Handle(StepGeom_CartesianPoint) aPoint = Handle(StepGeom_CartesianPoint)::DownCast(aGISU2->IdentifiedItem()->Value(1));
|
||||
if (aPoint.IsNull()) {
|
||||
// try Axis2Placement3d.location instead of CartesianPoint
|
||||
Handle(StepGeom_Axis2Placement3d) anA2P3D =
|
||||
Handle(StepGeom_Axis2Placement3d)::DownCast(aGISU2->IdentifiedItem()->Value(1));
|
||||
if (!anA2P3D.IsNull())
|
||||
aPoint = anA2P3D->Location();
|
||||
}
|
||||
if (!aPoint.IsNull()) {
|
||||
// set connection point to object
|
||||
gp_Pnt aPnt(aPoint->CoordinatesValue(1) * aFact, aPoint->CoordinatesValue(2) * aFact, aPoint->CoordinatesValue(3) * aFact);
|
||||
theDimObject->SetPoint2(aPnt);
|
||||
}
|
||||
if (computePMIReferensePosition(aDim->RelatedShapeAspect(), aGraph, aPnt))
|
||||
{
|
||||
// set connection point to object
|
||||
aPnt.SetXYZ(aPnt.XYZ() * aFact);
|
||||
theDimObject->SetPoint2(aPnt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2777,8 +2785,9 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
|
||||
NCollection_Sequence<Handle(Standard_Transient)> aSeqRI1, aSeqRI2;
|
||||
|
||||
// Collect all Shape_Aspect entities
|
||||
Interface_EntityIterator anIter = aGraph.Shareds(theEnt);
|
||||
for (anIter.Start(); anIter.More(); anIter.Next()) {
|
||||
for (Interface_EntityIterator anIter = aGraph.Shareds(theEnt);
|
||||
anIter.More(); anIter.Next())
|
||||
{
|
||||
Handle(Standard_Transient) anAtr = anIter.Value();
|
||||
NCollection_Sequence<Handle(StepRepr_ShapeAspect)> aSAs;
|
||||
if (anAtr->IsKind(STANDARD_TYPE(StepRepr_ProductDefinitionShape)))
|
||||
@@ -3067,65 +3076,15 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
|
||||
TDF_LabelSequence aShLS1, aShLS2;
|
||||
|
||||
// Collect shapes
|
||||
for (Standard_Integer i = aSeqRI1.Lower(); i <= aSeqRI1.Upper();i++)
|
||||
for (NCollection_Sequence<Handle(Standard_Transient)>::Iterator anIter(aSeqRI1);
|
||||
anIter.More(); anIter.Next())
|
||||
{
|
||||
Standard_Integer anIndex = FindShapeIndexForDGT(aSeqRI1.Value(i), theWS);
|
||||
TopoDS_Shape aSh;
|
||||
if (anIndex > 0) {
|
||||
Handle(Transfer_Binder) aBinder = aTP->MapItem(anIndex);
|
||||
aSh = TransferBRep::ShapeResult(aBinder);
|
||||
}
|
||||
if (!aSh.IsNull())
|
||||
{
|
||||
TDF_Label aShL;
|
||||
aSTool->Search(aSh, aShL, Standard_True, Standard_True, Standard_True);
|
||||
if (aShL.IsNull() && aSh.ShapeType() == TopAbs_WIRE)
|
||||
{
|
||||
TopExp_Explorer ex(aSh, TopAbs_EDGE, TopAbs_SHAPE);
|
||||
while (ex.More())
|
||||
{
|
||||
TDF_Label edgeL;
|
||||
aSTool->Search(ex.Current(), edgeL, Standard_True, Standard_True, Standard_True);
|
||||
if (!edgeL.IsNull())
|
||||
aShLS1.Append(edgeL);
|
||||
ex.Next();
|
||||
}
|
||||
}
|
||||
if (!aShL.IsNull())
|
||||
aShLS1.Append(aShL);
|
||||
}
|
||||
findReferenceGeometry(anIter.Value(), aSTool, aShLS1);
|
||||
}
|
||||
if (!aSeqRI2.IsEmpty())
|
||||
for (NCollection_Sequence<Handle(Standard_Transient)>::Iterator anIter(aSeqRI2);
|
||||
anIter.More(); anIter.Next())
|
||||
{
|
||||
//for dimensional location
|
||||
for (Standard_Integer i = aSeqRI2.Lower(); i <= aSeqRI2.Upper();i++)
|
||||
{
|
||||
Standard_Integer anIndex = FindShapeIndexForDGT(aSeqRI2.Value(i), theWS);
|
||||
TopoDS_Shape aSh;
|
||||
if (anIndex > 0) {
|
||||
Handle(Transfer_Binder) aBinder = aTP->MapItem(anIndex);
|
||||
aSh = TransferBRep::ShapeResult(aBinder);
|
||||
}
|
||||
if (!aSh.IsNull())
|
||||
{
|
||||
TDF_Label aShL;
|
||||
aSTool->Search(aSh, aShL, Standard_True, Standard_True, Standard_True);
|
||||
if (aShL.IsNull() && aSh.ShapeType() == TopAbs_WIRE)
|
||||
{
|
||||
TopExp_Explorer ex(aSh, TopAbs_EDGE, TopAbs_SHAPE);
|
||||
while (ex.More())
|
||||
{
|
||||
TDF_Label edgeL;
|
||||
aSTool->Search(ex.Current(), edgeL, Standard_True, Standard_True, Standard_True);
|
||||
if (!edgeL.IsNull())
|
||||
aShLS2.Append(edgeL);
|
||||
ex.Next();
|
||||
}
|
||||
}
|
||||
if (!aShL.IsNull())
|
||||
aShLS2.Append(aShL);
|
||||
}
|
||||
}
|
||||
findReferenceGeometry(anIter.Value(), aSTool, aShLS2);
|
||||
}
|
||||
|
||||
if (!aShLS1.IsEmpty())
|
||||
@@ -3186,6 +3145,182 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
|
||||
return aGDTL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : findReferenceGeometry
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean STEPCAFControl_Reader::findReferenceGeometry(const Handle(Standard_Transient)& theShapeStart,
|
||||
const Handle(XCAFDoc_ShapeTool)& theShTool,
|
||||
TDF_LabelSequence& theShLabelSeq)
|
||||
{
|
||||
const Handle(XSControl_TransferReader)& aTR = myReader.WS()->TransferReader();
|
||||
const Handle(Transfer_TransientProcess)& aTP = aTR->TransientProcess();
|
||||
TopoDS_Shape aSh = TransferBRep::ShapeResult(aTP, theShapeStart);
|
||||
if (!aSh.IsNull())
|
||||
{
|
||||
TDF_Label aShL;
|
||||
theShTool->Search(aSh, aShL, Standard_True, Standard_True, Standard_True);
|
||||
if (aShL.IsNull() && aSh.ShapeType() == TopAbs_WIRE)
|
||||
{
|
||||
for (TopExp_Explorer anExp(aSh, TopAbs_EDGE, TopAbs_SHAPE);
|
||||
anExp.More(); anExp.Next())
|
||||
{
|
||||
TDF_Label anEdgeL;
|
||||
theShTool->Search(anExp.Current(), anEdgeL, Standard_True, Standard_True, Standard_True);
|
||||
if (!anEdgeL.IsNull())
|
||||
{
|
||||
theShLabelSeq.Append(anEdgeL);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!aShL.IsNull())
|
||||
{
|
||||
theShLabelSeq.Append(aShL);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
TDF_Label aFindResultL;
|
||||
if (myGDTMap.Find(theShapeStart, aFindResultL))
|
||||
{
|
||||
theShLabelSeq.Append(aFindResultL);
|
||||
return Standard_True;
|
||||
}
|
||||
const Handle(StepGeom_GeometricRepresentationItem)& aGeomItem =
|
||||
Handle(StepGeom_GeometricRepresentationItem)::DownCast(theShapeStart);
|
||||
if (aGeomItem.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
if (theShapeStart->IsKind(STANDARD_TYPE(StepGeom_Curve)))
|
||||
{
|
||||
const Handle(StepGeom_Curve)& aStepCurve = Handle(StepGeom_Curve)::DownCast(theShapeStart);
|
||||
Handle(Geom_Curve) aCurve = StepToGeom::MakeCurve(aStepCurve);
|
||||
if (aCurve.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
BRepBuilderAPI_MakeEdge aMaker;
|
||||
if (aCurve->IsKind(STANDARD_TYPE(Geom_Line)))
|
||||
{
|
||||
const Standard_Real aScale = UnitsMethods::LengthFactor();
|
||||
aMaker.Init(aCurve, 0, 1. * aScale);
|
||||
}
|
||||
else
|
||||
{
|
||||
aMaker.Init(aCurve);
|
||||
}
|
||||
if (aMaker.IsDone())
|
||||
{
|
||||
aSh = aMaker.Shape();
|
||||
}
|
||||
}
|
||||
else if (theShapeStart->IsKind(STANDARD_TYPE(StepGeom_Surface)))
|
||||
{
|
||||
const Handle(StepGeom_Surface)& aStepSurface = Handle(StepGeom_Surface)::DownCast(theShapeStart);
|
||||
Handle(Geom_Surface) aSurface = StepToGeom::MakeSurface(aStepSurface);
|
||||
if (aSurface.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
BRepBuilderAPI_MakeFace aMaker;
|
||||
if (aSurface->IsKind(STANDARD_TYPE(Geom_Plane)))
|
||||
{
|
||||
const Standard_Real aScale = UnitsMethods::LengthFactor();
|
||||
aMaker.Init(aSurface, 0., 1. * aScale, 0., 1. * aScale, Precision::Confusion());
|
||||
}
|
||||
else
|
||||
{
|
||||
aMaker.Init(aSurface, Standard_True, Precision::Confusion());
|
||||
}
|
||||
if (aMaker.IsDone())
|
||||
{
|
||||
aSh = aMaker.Shape();
|
||||
}
|
||||
}
|
||||
if (aSh.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
if (mySupplementalLabel.IsNull())
|
||||
{
|
||||
mySupplementalLabel = theShTool->NewShape();
|
||||
TDataStd_Name::Set(mySupplementalLabel, "Supplemental Geometry");
|
||||
TDataStd_UAttribute::Set(mySupplementalLabel, XCAFDoc::SupplementalContainerGUID());
|
||||
}
|
||||
TDF_Label aSupGeomLabel = theShTool->AddComponent(mySupplementalLabel, aSh);
|
||||
if (aSupGeomLabel.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
TDataStd_UAttribute::Set(aSupGeomLabel, XCAFDoc::SupplementalGeometryGUID());
|
||||
|
||||
if (!aGeomItem->Name().IsNull())
|
||||
{
|
||||
TDataStd_Name::Set(aSupGeomLabel, aGeomItem->Name()->String());
|
||||
TDF_Label aReferredShapeL;
|
||||
theShTool->GetReferredShape(aSupGeomLabel, aReferredShapeL);
|
||||
TDataStd_Name::Set(aReferredShapeL, aGeomItem->Name()->String());
|
||||
TDataStd_UAttribute::Set(aReferredShapeL, XCAFDoc::SupplementalGeometryGUID());
|
||||
}
|
||||
TDF_Label aRefL;
|
||||
const Interface_Graph& aGraph = aTP->Graph();
|
||||
for (Interface_EntityIterator anIter(aGraph.Sharings(theShapeStart));
|
||||
anIter.More() && aRefL.IsNull(); anIter.Next())
|
||||
{
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aPGISU =
|
||||
Handle(StepAP242_GeometricItemSpecificUsage)::DownCast(anIter.Value());
|
||||
if (aPGISU.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Handle(StepRepr_ShapeAspect) aShAspect = aPGISU->Definition().ShapeAspect();
|
||||
if (aShAspect.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Handle(StepRepr_ProductDefinitionShape) aRefPDS = aShAspect->OfShape();
|
||||
if (aRefPDS.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
TopoDS_Shape aRefSh = TransferBRep::ShapeResult(aTP, aRefPDS->Definition().Value());
|
||||
theShTool->Search(aRefSh, aRefL, Standard_True, Standard_True, Standard_False);
|
||||
}
|
||||
|
||||
if (aRefL.IsNull())
|
||||
{
|
||||
TDF_LabelSequence aFreeShapes;
|
||||
theShTool->GetFreeShapes(aFreeShapes);
|
||||
for(TDF_LabelSequence::Iterator anIter(aFreeShapes); anIter.More() && aRefL.IsNull(); anIter.Next())
|
||||
{
|
||||
const TDF_Label aLabel = anIter.Value();
|
||||
Handle(TDataStd_UAttribute) aSupGeomAttr;
|
||||
if (aLabel.FindAttribute(XCAFDoc::SupplementalContainerGUID(), aSupGeomAttr))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
TopoDS_Shape aTmpShape = theShTool->GetShape(aLabel);
|
||||
if (!aTmpShape.IsNull())
|
||||
{
|
||||
aRefL = aLabel;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (aRefL.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// set reference
|
||||
Handle(TDataStd_TreeNode) aMainNode = TDataStd_TreeNode::Set(aRefL, XCAFDoc::SupplementalRefGUID());
|
||||
Handle(TDataStd_TreeNode) aRefNode = TDataStd_TreeNode::Set(aSupGeomLabel, XCAFDoc::SupplementalRefGUID());
|
||||
aRefNode->Remove(); // abv: fix against bug in TreeNode::Append()
|
||||
aMainNode->Append(aRefNode);
|
||||
myGDTMap.Bind(theShapeStart, aSupGeomLabel);
|
||||
theShLabelSeq.Append(aSupGeomLabel);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : convertAngleValue
|
||||
//purpose : auxilary
|
||||
@@ -4511,9 +4646,16 @@ void collectRepresentationItems(const Interface_Graph& theGraph,
|
||||
const Handle(StepShape_ShapeRepresentation)& theRepresentation,
|
||||
NCollection_Sequence<Handle(StepRepr_RepresentationItem)>& theItems)
|
||||
{
|
||||
Handle(StepRepr_HArray1OfRepresentationItem) aReprItems = theRepresentation->Items();
|
||||
for (Standard_Integer itemIt = aReprItems->Lower(); itemIt <= aReprItems->Upper(); itemIt++)
|
||||
theItems.Append(aReprItems->Value(itemIt));
|
||||
for (StepRepr_HArray1OfRepresentationItem::Iterator anIter(theRepresentation->Items()->Array1());
|
||||
anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(StepRepr_RepresentationItem)& anReprItem = anIter.Value();
|
||||
if (anReprItem.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
theItems.Append(anReprItem);
|
||||
}
|
||||
|
||||
Interface_EntityIterator entIt = theGraph.TypedSharings(theRepresentation, STANDARD_TYPE(StepRepr_RepresentationRelationship));
|
||||
for (entIt.Start(); entIt.More(); entIt.Next())
|
||||
|
@@ -291,9 +291,18 @@ private:
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS);
|
||||
|
||||
//! Finds reference geometry or create supplemental geometry label
|
||||
//! @param[in] theShapeStart step entity to get reference
|
||||
//! @param[in] theShTool tool to work with shape labels
|
||||
//! @param[out] theShLabelSeq container to put reference label
|
||||
//! @return TRUE if a reference is found or supplemental geometry is added
|
||||
Standard_Boolean findReferenceGeometry(const Handle(Standard_Transient)& theShapeStart,
|
||||
const Handle(XCAFDoc_ShapeTool)& theShTool,
|
||||
TDF_LabelSequence& theShLabelSeq);
|
||||
|
||||
STEPControl_Reader myReader;
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> myFiles;
|
||||
TDF_Label mySupplementalLabel;
|
||||
Standard_Boolean myColorMode;
|
||||
Standard_Boolean myNameMode;
|
||||
Standard_Boolean myLayerMode;
|
||||
|
@@ -23,6 +23,8 @@
|
||||
#include <STEPCAFControl_Writer.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <GeomToStep_MakeSurface.hxx>
|
||||
#include <GeomToStep_MakeCurve.hxx>
|
||||
#include <GeomToStep_MakeAxis2Placement3d.hxx>
|
||||
#include <GeomToStep_MakeCartesianPoint.hxx>
|
||||
#include <HeaderSection_FileSchema.hxx>
|
||||
@@ -115,6 +117,7 @@
|
||||
#include <StepRepr_CompositeShapeAspect.hxx>
|
||||
#include <StepRepr_ConstructiveGeometryRepresentation.hxx>
|
||||
#include <StepRepr_ConstructiveGeometryRepresentationRelationship.hxx>
|
||||
#include <StepGeom_Curve.hxx>
|
||||
#include <StepRepr_DerivedShapeAspect.hxx>
|
||||
#include <StepRepr_DescriptiveRepresentationItem.hxx>
|
||||
#include <StepRepr_FeatureForDatumTargetRelationship.hxx>
|
||||
@@ -198,6 +201,7 @@
|
||||
#include <TDF_LabelSequence.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
#include <TDocStd_Document.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
@@ -526,6 +530,12 @@ Standard_Boolean STEPCAFControl_Writer::Transfer (STEPControl_Writer &writer,
|
||||
TDF_Label L = labels.Value(i);
|
||||
if ( myLabels.IsBound ( L ) ) continue; // already processed
|
||||
|
||||
Handle(TDataStd_UAttribute) aSupGeomAttr;
|
||||
if (L.FindAttribute(XCAFDoc::SupplementalContainerGUID(), aSupGeomAttr))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TopoDS_Shape shape = XCAFDoc_ShapeTool::GetShape ( L );
|
||||
if ( shape.IsNull() ) continue;
|
||||
|
||||
@@ -2419,6 +2429,110 @@ Handle(StepRepr_ShapeAspect) STEPCAFControl_Writer::WriteShapeAspect (const Hand
|
||||
return aSA;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteSupplementalGeometry
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(StepRepr_ShapeAspect) WriteSupplementalGeometry(const Handle(XSControl_WorkSession)& WS,
|
||||
const Handle(StepRepr_ConstructiveGeometryRepresentation)& theCGRepr,
|
||||
const TDF_Label& theLabel,
|
||||
const TopoDS_Shape& theShape,
|
||||
Handle(StepRepr_RepresentationContext)& theRC,
|
||||
Handle(StepAP242_GeometricItemSpecificUsage)& theGISU,
|
||||
NCollection_Vector<Handle(StepGeom_GeometricRepresentationItem)>& theGeomItems)
|
||||
{
|
||||
Handle(StepRepr_ShapeAspect) aResSA;
|
||||
// Get working data
|
||||
const Handle(Interface_InterfaceModel)& aModel = WS->Model();
|
||||
const Handle(XSControl_TransferWriter)& aTW = WS->TransferWriter();
|
||||
const Handle(Transfer_FinderProcess)& aFP = aTW->FinderProcess();
|
||||
const Handle(Interface_HGraph) aHGraph = WS->HGraph();
|
||||
if (aHGraph.IsNull())
|
||||
{
|
||||
return aResSA;
|
||||
}
|
||||
Interface_Graph aGraph = aHGraph->Graph();
|
||||
|
||||
// Shape_Aspect
|
||||
Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString();
|
||||
Handle(TDataStd_Name) aNameAttr;
|
||||
if (theLabel.FindAttribute(TDataStd_Name::GetID(), aNameAttr))
|
||||
{
|
||||
aName = new TCollection_HAsciiString(TCollection_AsciiString(aNameAttr->Get()));
|
||||
}
|
||||
Handle(TCollection_HAsciiString) aDescription = new TCollection_HAsciiString();
|
||||
|
||||
Handle(TDataStd_TreeNode) aRefNode;
|
||||
if (!theLabel.FindAttribute(XCAFDoc::SupplementalRefGUID(), aRefNode)
|
||||
|| aRefNode->Father().IsNull() || aRefNode->Father()->Label().IsNull())
|
||||
{
|
||||
return aResSA;
|
||||
}
|
||||
TopoDS_Shape aMainShape = XCAFDoc_ShapeTool::GetShape(aRefNode->Father()->Label());
|
||||
TopLoc_Location aLoc;
|
||||
TColStd_SequenceOfTransient aSeqRI;
|
||||
FindEntities(aFP, aMainShape, aLoc, aSeqRI);
|
||||
if (aSeqRI.Length() <= 0)
|
||||
{
|
||||
aFP->Messenger()->SendInfo() << "Warning: Cannot find RI for " << aMainShape.TShape()->DynamicType()->Name() << std::endl;
|
||||
return aResSA;
|
||||
}
|
||||
|
||||
Handle(StepRepr_ProductDefinitionShape) aPDS;
|
||||
Handle(StepRepr_RepresentationContext) aRC;
|
||||
Handle(Standard_Transient) anEnt = aSeqRI.Value(1);
|
||||
aPDS = FindPDS(aGraph, anEnt, aRC);
|
||||
if (aPDS.IsNull())
|
||||
return aResSA;
|
||||
|
||||
theRC = aRC;
|
||||
|
||||
Handle(StepGeom_GeometricRepresentationItem) anIdentifiedItem;
|
||||
if (theShape.ShapeType() == TopAbs_FACE)
|
||||
{
|
||||
const TopoDS_Face& aFace = TopoDS::Face(theShape);
|
||||
const Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
|
||||
GeomToStep_MakeSurface aMaker(aSurf);
|
||||
if (aMaker.IsDone())
|
||||
{
|
||||
anIdentifiedItem = aMaker.Value();
|
||||
}
|
||||
}
|
||||
else if (theShape.ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(theShape);
|
||||
Standard_Real aTmpFirst, aTmpLast;
|
||||
const Handle(Geom_Curve) aCurv = BRep_Tool::Curve(anEdge, aTmpFirst, aTmpLast);
|
||||
GeomToStep_MakeCurve aMaker(aCurv);
|
||||
if (aMaker.IsDone())
|
||||
{
|
||||
anIdentifiedItem = aMaker.Value();
|
||||
}
|
||||
}
|
||||
if (anIdentifiedItem.IsNull())
|
||||
{
|
||||
return aResSA;
|
||||
}
|
||||
aResSA = new StepRepr_ShapeAspect();
|
||||
aResSA->Init(aName, aDescription, aPDS, StepData_LTrue);
|
||||
// Geometric_Item_Specific_Usage
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU = new StepAP242_GeometricItemSpecificUsage();
|
||||
StepAP242_ItemIdentifiedRepresentationUsageDefinition aDefinition;
|
||||
aDefinition.SetValue(aResSA);
|
||||
Handle(StepRepr_HArray1OfRepresentationItem) anReprItems = new StepRepr_HArray1OfRepresentationItem(1, 1);
|
||||
|
||||
anIdentifiedItem->SetName(aName);
|
||||
theGISU = aGISU;
|
||||
anReprItems->SetValue(1, anIdentifiedItem);
|
||||
theGeomItems.Append(anIdentifiedItem);
|
||||
|
||||
// Set entities to model
|
||||
aGISU->Init(aName, aDescription, aDefinition, theCGRepr, anReprItems);
|
||||
aModel->AddWithRefs(aResSA);
|
||||
aModel->AddWithRefs(aGISU);
|
||||
return aResSA;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WritePresentation
|
||||
//purpose : auxiliary (write annotation plane and presentation)
|
||||
@@ -2958,14 +3072,14 @@ static void WriteDerivedGeometry (const Handle(XSControl_WorkSession) &WS,
|
||||
const Handle(StepRepr_ConstructiveGeometryRepresentation) theRepr,
|
||||
Handle(StepRepr_ShapeAspect)& theFirstSA,
|
||||
Handle(StepRepr_ShapeAspect)& theSecondSA,
|
||||
NCollection_Vector<Handle(StepGeom_CartesianPoint)>& thePnts)
|
||||
NCollection_Vector<Handle(StepGeom_GeometricRepresentationItem)>& theGeoms)
|
||||
{
|
||||
const Handle(Interface_InterfaceModel) &aModel = WS->Model();
|
||||
// First point
|
||||
if (theObject->HasPoint()) {
|
||||
GeomToStep_MakeCartesianPoint aPointMaker(theObject->GetPoint());
|
||||
Handle(StepGeom_CartesianPoint) aPoint = aPointMaker.Value();
|
||||
thePnts.Append(aPoint);
|
||||
theGeoms.Append(aPoint);
|
||||
Handle(StepRepr_DerivedShapeAspect) aDSA = new StepRepr_DerivedShapeAspect();
|
||||
aDSA->Init(new TCollection_HAsciiString(), new TCollection_HAsciiString(), theFirstSA->OfShape(), StepData_LFalse);
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU = new StepAP242_GeometricItemSpecificUsage();
|
||||
@@ -2985,7 +3099,7 @@ static void WriteDerivedGeometry (const Handle(XSControl_WorkSession) &WS,
|
||||
if (theObject->HasPoint2()) {
|
||||
GeomToStep_MakeCartesianPoint aPointMaker(theObject->GetPoint2());
|
||||
Handle(StepGeom_CartesianPoint) aPoint = aPointMaker.Value();
|
||||
thePnts.Append(aPoint);
|
||||
theGeoms.Append(aPoint);
|
||||
Handle(StepRepr_DerivedShapeAspect) aDSA = new StepRepr_DerivedShapeAspect();
|
||||
aDSA->Init(new TCollection_HAsciiString(), new TCollection_HAsciiString(), theFirstSA->OfShape(), StepData_LFalse);
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU = new StepAP242_GeometricItemSpecificUsage();
|
||||
@@ -3256,20 +3370,46 @@ void STEPCAFControl_Writer::WriteGeomTolerance (const Handle(XSControl_WorkSessi
|
||||
aLMWU->Init(aValueMember, aUnit);
|
||||
Model->AddWithRefs(aLMWU);
|
||||
|
||||
// Auxiliary entities for derived geometry
|
||||
Handle(StepRepr_ConstructiveGeometryRepresentation) aCGRepr =
|
||||
new StepRepr_ConstructiveGeometryRepresentation();
|
||||
Handle(StepRepr_ConstructiveGeometryRepresentationRelationship) aCGReprRel =
|
||||
new StepRepr_ConstructiveGeometryRepresentationRelationship();
|
||||
NCollection_Vector<Handle(StepGeom_GeometricRepresentationItem)> aConnectionGeometry;
|
||||
|
||||
// Geometric_Tolerance target
|
||||
Handle(StepRepr_ShapeAspect) aMainSA;
|
||||
Handle(StepRepr_RepresentationContext) dummyRC;
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) dummyGISU;
|
||||
if (theShapeSeqL.Length() == 1) {
|
||||
TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(theShapeSeqL.Value(1));
|
||||
aMainSA = WriteShapeAspect(WS, theGeomTolL, aShape, dummyRC, dummyGISU);
|
||||
const TDF_Label& aShLabel = theShapeSeqL.Value(1);
|
||||
Handle(TDataStd_UAttribute) aSupAttr;
|
||||
TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(aShLabel);
|
||||
if (aShLabel.FindAttribute(XCAFDoc::SupplementalGeometryGUID(), aSupAttr))
|
||||
{
|
||||
aMainSA = WriteSupplementalGeometry(WS, aCGRepr, aShLabel, aShape, dummyRC, dummyGISU, aConnectionGeometry);
|
||||
}
|
||||
else
|
||||
{
|
||||
aMainSA = WriteShapeAspect(WS, theGeomTolL, aShape, dummyRC, dummyGISU);
|
||||
}
|
||||
Model->AddWithRefs(aMainSA);
|
||||
}
|
||||
else {
|
||||
Handle(StepRepr_CompositeShapeAspect) aCSA;
|
||||
for (Standard_Integer i = 1; i <= theShapeSeqL.Length(); i++) {
|
||||
TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(theShapeSeqL.Value(i));
|
||||
Handle(StepRepr_ShapeAspect) aSA = WriteShapeAspect(WS, theGeomTolL, aShape, dummyRC, dummyGISU);
|
||||
const TDF_Label& aShLabel = theShapeSeqL.Value(i);
|
||||
Handle(TDataStd_UAttribute) aSupAttr;
|
||||
TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(aShLabel);
|
||||
Handle(StepRepr_ShapeAspect) aSA;
|
||||
if (aShLabel.FindAttribute(XCAFDoc::SupplementalGeometryGUID(), aSupAttr))
|
||||
{
|
||||
aSA = WriteSupplementalGeometry(WS, aCGRepr, aShLabel, aShape, dummyRC, dummyGISU, aConnectionGeometry);
|
||||
}
|
||||
else
|
||||
{
|
||||
aSA = WriteShapeAspect(WS, theGeomTolL, aShape, dummyRC, dummyGISU);
|
||||
}
|
||||
if (aSA.IsNull())
|
||||
continue;
|
||||
if (aCSA.IsNull()) {
|
||||
@@ -3283,6 +3423,17 @@ void STEPCAFControl_Writer::WriteGeomTolerance (const Handle(XSControl_WorkSessi
|
||||
}
|
||||
aMainSA = aCSA;
|
||||
}
|
||||
// Write Derived geometry
|
||||
if (aConnectionGeometry.Length() > 0)
|
||||
{
|
||||
Handle(StepRepr_HArray1OfRepresentationItem) anItems = new StepRepr_HArray1OfRepresentationItem(1, aConnectionGeometry.Length());
|
||||
for (Standard_Integer i = 0; i < aConnectionGeometry.Length(); i++)
|
||||
anItems->SetValue(i + 1, aConnectionGeometry(i));
|
||||
aCGRepr->Init(new TCollection_HAsciiString(), anItems, dummyRC);
|
||||
aCGReprRel->Init(new TCollection_HAsciiString(), new TCollection_HAsciiString(), dummyGISU->UsedRepresentation(), aCGRepr);
|
||||
Model->AddWithRefs(aCGReprRel);
|
||||
}
|
||||
|
||||
StepDimTol_GeometricToleranceTarget aGTTarget;
|
||||
aGTTarget.SetValue(aMainSA);
|
||||
|
||||
@@ -3813,7 +3964,7 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
|
||||
new StepRepr_ConstructiveGeometryRepresentation();
|
||||
Handle(StepRepr_ConstructiveGeometryRepresentationRelationship) aCGReprRel =
|
||||
new StepRepr_ConstructiveGeometryRepresentationRelationship();
|
||||
NCollection_Vector<Handle(StepGeom_CartesianPoint)> aConnectionPnts;
|
||||
NCollection_Vector<Handle(StepGeom_GeometricRepresentationItem)> aConnectionGeometry;
|
||||
Handle(StepRepr_RepresentationContext) dummyRC;
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) dummyGISU;
|
||||
for (Standard_Integer i = 1; i <= aDGTLabels.Length(); i++) {
|
||||
@@ -3840,16 +3991,36 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
|
||||
// Write links with shapes
|
||||
Handle(StepRepr_ShapeAspect) aFirstSA, aSecondSA;
|
||||
if (aFirstShapeL.Length() == 1) {
|
||||
TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(aFirstShapeL.Value(1));
|
||||
aFirstSA = WriteShapeAspect(WS, aDimensionL, aShape, dummyRC, dummyGISU);
|
||||
const TDF_Label& aShLabel = aFirstShapeL.Value(1);
|
||||
TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(aShLabel);
|
||||
Handle(TDataStd_UAttribute) aSupAttr;
|
||||
if (aShLabel.FindAttribute(XCAFDoc::SupplementalGeometryGUID(), aSupAttr))
|
||||
{
|
||||
aFirstSA = WriteSupplementalGeometry(WS,aCGRepr, aShLabel, aShape, dummyRC, dummyGISU,aConnectionGeometry);
|
||||
}
|
||||
else
|
||||
{
|
||||
aFirstSA = WriteShapeAspect(WS, aDimensionL, aShape, dummyRC, dummyGISU);
|
||||
}
|
||||
if (aRC.IsNull() && !dummyRC.IsNull())
|
||||
aRC = dummyRC;
|
||||
}
|
||||
else if (aFirstShapeL.Length() > 1) {
|
||||
Handle(StepRepr_CompositeShapeAspect) aCSA;
|
||||
for (Standard_Integer shIt = 1; shIt <= aFirstShapeL.Length(); shIt++) {
|
||||
TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(aFirstShapeL.Value(shIt));
|
||||
Handle(StepRepr_ShapeAspect) aSA = WriteShapeAspect(WS, aDimensionL, aShape, dummyRC, dummyGISU);
|
||||
for (Standard_Integer shIt = 1; shIt <= aFirstShapeL.Length(); shIt++)
|
||||
{
|
||||
const TDF_Label& aShLabel = aFirstShapeL.Value(shIt);
|
||||
TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(aShLabel);
|
||||
Handle(TDataStd_UAttribute) aSupAttr;
|
||||
Handle(StepRepr_ShapeAspect) aSA;
|
||||
if (aShLabel.FindAttribute(XCAFDoc::SupplementalGeometryGUID(), aSupAttr))
|
||||
{
|
||||
aSA = WriteSupplementalGeometry(WS, aCGRepr, aShLabel, aShape, dummyRC, dummyGISU, aConnectionGeometry);
|
||||
}
|
||||
else
|
||||
{
|
||||
aSA = WriteShapeAspect(WS, aDimensionL, aShape, dummyRC, dummyGISU);
|
||||
}
|
||||
if (aSA.IsNull())
|
||||
continue;
|
||||
if (aCSA.IsNull()) {
|
||||
@@ -3866,16 +4037,35 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
|
||||
aFirstSA = aCSA;
|
||||
}
|
||||
if (aSecondShapeL.Length() == 1) {
|
||||
TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(aSecondShapeL.Value(1));
|
||||
aSecondSA = WriteShapeAspect(WS, aDimensionL, aShape, dummyRC, dummyGISU);
|
||||
const TDF_Label& aShLabel = aSecondShapeL.Value(1);
|
||||
TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(aShLabel);
|
||||
Handle(TDataStd_UAttribute) aSupAttr;
|
||||
if (aShLabel.FindAttribute(XCAFDoc::SupplementalGeometryGUID(), aSupAttr))
|
||||
{
|
||||
aSecondSA = WriteSupplementalGeometry(WS, aCGRepr, aShLabel, aShape, dummyRC, dummyGISU, aConnectionGeometry);
|
||||
}
|
||||
else
|
||||
{
|
||||
aSecondSA = WriteShapeAspect(WS, aDimensionL, aShape, dummyRC, dummyGISU);
|
||||
}
|
||||
if (aRC.IsNull() && !dummyRC.IsNull())
|
||||
aRC = dummyRC;
|
||||
}
|
||||
else if (aSecondShapeL.Length() > 1) {
|
||||
Handle(StepRepr_CompositeShapeAspect) aCSA;
|
||||
for (Standard_Integer shIt = 1; shIt <= aSecondShapeL.Length(); shIt++) {
|
||||
TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(aSecondShapeL.Value(shIt));
|
||||
Handle(StepRepr_ShapeAspect) aSA = WriteShapeAspect(WS, aDimensionL, aShape, dummyRC, dummyGISU);
|
||||
const TDF_Label& aShLabel = aSecondShapeL.Value(shIt);
|
||||
TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(aShLabel);
|
||||
Handle(TDataStd_UAttribute) aSupAttr;
|
||||
Handle(StepRepr_ShapeAspect) aSA;
|
||||
if (aShLabel.FindAttribute(XCAFDoc::SupplementalGeometryGUID(), aSupAttr))
|
||||
{
|
||||
aSA = WriteSupplementalGeometry(WS, aCGRepr, aShLabel, aShape, dummyRC, dummyGISU, aConnectionGeometry);
|
||||
}
|
||||
else
|
||||
{
|
||||
aSA = WriteShapeAspect(WS, aDimensionL, aShape, dummyRC, dummyGISU);
|
||||
}
|
||||
if (aCSA.IsNull() && !aSA.IsNull())
|
||||
{
|
||||
aCSA = new StepRepr_CompositeShapeAspect();
|
||||
@@ -3902,7 +4092,7 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
|
||||
// Write dimensions
|
||||
StepShape_DimensionalCharacteristic aDimension;
|
||||
if (anObject->HasPoint() || anObject->HasPoint2())
|
||||
WriteDerivedGeometry(WS, anObject, aCGRepr, aFirstSA, aSecondSA, aConnectionPnts);
|
||||
WriteDerivedGeometry(WS, anObject, aCGRepr, aFirstSA, aSecondSA, aConnectionGeometry);
|
||||
XCAFDimTolObjects_DimensionType aDimType = anObject->GetType();
|
||||
if (STEPCAFControl_GDTProperty::IsDimensionalLocation(aDimType)) {
|
||||
// Dimensional_Location
|
||||
@@ -3972,10 +4162,10 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
|
||||
anObject->GetPlane(), anObject->GetPointTextAttach(), aDimension.Value());
|
||||
}
|
||||
// Write Derived geometry
|
||||
if (aConnectionPnts.Length() > 0) {
|
||||
Handle(StepRepr_HArray1OfRepresentationItem) anItems = new StepRepr_HArray1OfRepresentationItem(1, aConnectionPnts.Length());
|
||||
for (Standard_Integer i = 0; i < aConnectionPnts.Length(); i++)
|
||||
anItems->SetValue(i + 1, aConnectionPnts(i));
|
||||
if (aConnectionGeometry.Length() > 0) {
|
||||
Handle(StepRepr_HArray1OfRepresentationItem) anItems = new StepRepr_HArray1OfRepresentationItem(1, aConnectionGeometry.Length());
|
||||
for (Standard_Integer i = 0; i < aConnectionGeometry.Length(); i++)
|
||||
anItems->SetValue(i + 1, aConnectionGeometry(i));
|
||||
aCGRepr->Init(new TCollection_HAsciiString(), anItems, dummyRC);
|
||||
aCGReprRel->Init(new TCollection_HAsciiString(), new TCollection_HAsciiString(), dummyGISU->UsedRepresentation(), aCGRepr);
|
||||
aModel->AddWithRefs(aCGReprRel);
|
||||
|
@@ -17,6 +17,7 @@
|
||||
//gka,abv 14.04.99 S4136: maintain unit context, precision and maxtolerance values
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <BRepCheck_Shell.hxx>
|
||||
#include <BRepCheck_Status.hxx>
|
||||
#include <Geom_Axis2Placement.hxx>
|
||||
@@ -32,6 +33,7 @@
|
||||
#include <Message_ProgressScope.hxx>
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <ShapeProcess_ShapeContext.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
@@ -304,7 +306,10 @@ Handle(Transfer_Binder) STEPControl_ActorRead::Transfer
|
||||
}
|
||||
// [END] Get version of preprocessor (to detect I-Deas case) (ssv; 23.11.2010)
|
||||
Standard_Boolean aTrsfUse = (Interface_Static::IVal("read.step.root.transformation") == 0);
|
||||
return TransferShape(start, TP, Standard_True, aTrsfUse, theProgress);
|
||||
auto aResult = TransferShape(start, TP, Standard_True, aTrsfUse, theProgress);
|
||||
if (Interface_Static::IVal("read.step.parallel.healing") == 0)
|
||||
PostHealing(TP);
|
||||
return aResult;
|
||||
}
|
||||
|
||||
|
||||
@@ -1439,13 +1444,18 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
|
||||
mappedShape = myShapeBuilder.Value();
|
||||
// Apply ShapeFix (on manifold shapes only. Non-manifold topology is processed separately: ssv; 13.11.2010)
|
||||
if (isManifold) {
|
||||
Handle(Standard_Transient) info;
|
||||
mappedShape =
|
||||
XSAlgo::AlgoContainer()->ProcessShape( mappedShape, myPrecision, myMaxTol,
|
||||
"read.step.resource.name",
|
||||
"read.step.sequence", info,
|
||||
aPS.Next());
|
||||
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
|
||||
if (Interface_Static::IVal("read.step.parallel.healing") != 0)
|
||||
{
|
||||
Handle(Standard_Transient) info;
|
||||
mappedShape =
|
||||
XSAlgo::AlgoContainer()->ProcessShape(mappedShape, myPrecision, myMaxTol,
|
||||
"read.step.resource.name",
|
||||
"read.step.sequence", info,
|
||||
aPS.Next());
|
||||
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
|
||||
}
|
||||
else
|
||||
myShapesToHeal.Add(mappedShape);
|
||||
}
|
||||
}
|
||||
found = !mappedShape.IsNull();
|
||||
@@ -1996,3 +2006,68 @@ void STEPControl_ActorRead::computeIDEASClosings(const TopoDS_Compound& comp,
|
||||
shellClosingsMap.Add(shellA, closingShells);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Method : PostHealing
|
||||
// Purpose : postprocess shape healing
|
||||
//=======================================================================
|
||||
Standard_EXPORT void STEPControl_ActorRead::PostHealing(const Handle(Transfer_TransientProcess)& TP)
|
||||
{
|
||||
NCollection_Array1<Handle(ShapeProcess_ShapeContext)> aInfos(1, myShapesToHeal.Size());
|
||||
NCollection_Array1<TopTools_DataMapOfShapeShape> aOrigToCopyMapArr(1, myShapesToHeal.Size());
|
||||
NCollection_Array1<TopTools_DataMapOfShapeShape> aCopyToOrigMapArr(1, myShapesToHeal.Size());
|
||||
|
||||
#pragma omp parallel for
|
||||
for (int i = 1; i <= myShapesToHeal.Size(); i++)
|
||||
{
|
||||
TopoDS_Shape anOrig = myShapesToHeal.FindKey(i);
|
||||
BRepBuilderAPI_Copy aCurCopy(anOrig, true, true);
|
||||
TopoDS_Shape aCopy = aCurCopy.Shape();
|
||||
// Collect all the modified shapes in Copy() for futher update of binders not to lost attached attributes
|
||||
for (int aTypeIt = anOrig.ShapeType() + 1; aTypeIt <= TopAbs_VERTEX; aTypeIt++)
|
||||
{
|
||||
for (TopExp_Explorer anExp(anOrig, (TopAbs_ShapeEnum)aTypeIt); anExp.More(); anExp.Next())
|
||||
{
|
||||
const TopoDS_Shape& aSx = anExp.Current();
|
||||
const TopoDS_Shape& aModifShape = aCurCopy.ModifiedShape(aSx);
|
||||
aOrigToCopyMapArr.ChangeValue(i).Bind(aSx, aModifShape);
|
||||
aCopyToOrigMapArr.ChangeValue(i).Bind(aModifShape, aSx);
|
||||
}
|
||||
}
|
||||
Handle(Standard_Transient) anInfo;
|
||||
aCopy = XSAlgo::AlgoContainer()->ProcessShape(aCopy, myPrecision, myMaxTol,
|
||||
"read.step.resource.name",
|
||||
"read.step.sequence", aInfos[i],
|
||||
Message_ProgressRange());
|
||||
*(Handle(TopoDS_TShape)&)anOrig.TShape() = *aCopy.TShape();
|
||||
}
|
||||
|
||||
// Update Shape context for correct attributes attaching
|
||||
Handle(ShapeProcess_ShapeContext) aFullContext = new ShapeProcess_ShapeContext(TopoDS_Shape(), "", "");
|
||||
TopTools_DataMapOfShapeShape& aHealedMap = (TopTools_DataMapOfShapeShape&)aFullContext->Map();
|
||||
|
||||
// Copy maps to the common binders map
|
||||
for (int i = 1; i <= aOrigToCopyMapArr.Size(); i++)
|
||||
{
|
||||
const auto& aForwMap = aOrigToCopyMapArr.Value(i);
|
||||
const auto& aRevMap = aCopyToOrigMapArr.Value(i);
|
||||
Handle(ShapeProcess_ShapeContext) aContext = aInfos.Value(i);
|
||||
|
||||
for (TopTools_DataMapOfShapeShape::Iterator aMapIt(aForwMap); aMapIt.More(); aMapIt.Next())
|
||||
{
|
||||
aHealedMap.Bind(aMapIt.Key(), aMapIt.Value());
|
||||
}
|
||||
for (TopTools_DataMapOfShapeShape::Iterator anIter(aContext->Map()); anIter.More(); anIter.Next())
|
||||
{
|
||||
TopoDS_Shape aShape;
|
||||
if (aRevMap.Find(anIter.Key(), aShape))
|
||||
{
|
||||
aHealedMap.Bind(aShape, anIter.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, aFullContext);
|
||||
|
||||
CleanShapesToHeal();
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
#include <NCollection_IndexedMap.hxx>
|
||||
|
||||
class StepRepr_Representation;
|
||||
class Standard_Transient;
|
||||
@@ -98,8 +99,14 @@ public:
|
||||
//! REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION
|
||||
Standard_EXPORT Standard_Boolean ComputeSRRWT (const Handle(StepRepr_RepresentationRelationship)& SRR, const Handle(Transfer_TransientProcess)& TP, gp_Trsf& Trsf);
|
||||
|
||||
//! Heals the collected during transferring shapes
|
||||
Standard_EXPORT void PostHealing(const Handle(Transfer_TransientProcess)& TP);
|
||||
|
||||
|
||||
//! Cleans collected for post healing shapes.
|
||||
inline void CleanShapesToHeal()
|
||||
{
|
||||
myShapesToHeal.Clear();
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(STEPControl_ActorRead,Transfer_ActorOfTransientProcess)
|
||||
|
||||
@@ -185,8 +192,7 @@ private:
|
||||
Standard_Real myPrecision;
|
||||
Standard_Real myMaxTol;
|
||||
Handle(StepRepr_Representation) mySRContext;
|
||||
|
||||
|
||||
NCollection_IndexedMap<TopoDS_Shape> myShapesToHeal;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -217,6 +217,12 @@ STEPControl_Controller::STEPControl_Controller ()
|
||||
Interface_Static::Init("step", "read.step.root.transformation", '&', "eval OFF");
|
||||
Interface_Static::SetCVal("read.step.root.transformation", "ON");
|
||||
|
||||
Interface_Static::Init("step", "read.step.parallel.healing", 'e', "");
|
||||
Interface_Static::Init("step", "read.step.parallel.healing", '&', "enum 0");
|
||||
Interface_Static::Init("step", "read.step.parallel.healing", '&', "eval ON");
|
||||
Interface_Static::Init("step", "read.step.parallel.healing", '&', "eval OFF");
|
||||
Interface_Static::SetCVal("read.step.parallel.healing", "ON");
|
||||
|
||||
// STEP file encoding for names translation
|
||||
// Note: the numbers should be consistent with Resource_FormatType enumeration
|
||||
Interface_Static::Init("step", "read.step.codepage", 'e', "");
|
||||
|
@@ -1,7 +1,4 @@
|
||||
// Created on: 2005-03-15
|
||||
// Created by: Peter KURNEV
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
// Copyright (c) 1999-2023 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
@@ -14,301 +11,173 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_MMgrOpt.hxx>
|
||||
#include <Standard_MMgrRaw.hxx>
|
||||
#include <Standard_MMgrTBBalloc.hxx>
|
||||
#include <Standard_Assert.hxx>
|
||||
|
||||
#include <Standard_OutOfMemory.hxx>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if(defined(_WIN32) || defined(__WIN32__))
|
||||
#include <windows.h>
|
||||
#include <malloc.h>
|
||||
#include <locale.h>
|
||||
#include <windows.h>
|
||||
#include <malloc.h>
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) || defined(__ANDROID__) || defined(__QNX__)
|
||||
#include <malloc.h>
|
||||
#include <malloc.h>
|
||||
#elif (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && (defined(__i386) || defined(__x86_64)))
|
||||
#include <mm_malloc.h>
|
||||
#include <mm_malloc.h>
|
||||
#else
|
||||
extern "C" int posix_memalign (void** thePtr, size_t theAlign, size_t theSize);
|
||||
extern "C" int posix_memalign(void** thePtr, size_t theAlign, size_t theSize);
|
||||
#endif
|
||||
|
||||
// There is no support for environment variables in UWP
|
||||
// OSD_Environment could not be used here because of cyclic dependency
|
||||
#ifdef OCCT_UWP
|
||||
#define getenv(x) NULL
|
||||
#ifdef OCCT_MMGT_OPT_JEMALLOC
|
||||
#define JEMALLOC_NO_DEMANGLE
|
||||
#include <jemalloc.h>
|
||||
#endif // OCCT_MMGT_OPT_JEMALLOC
|
||||
|
||||
// paralleling with Intel TBB
|
||||
#ifdef HAVE_TBB
|
||||
#include <tbb/scalable_allocator.h>
|
||||
#else
|
||||
#ifdef OCCT_MMGT_OPT_TBB
|
||||
#undef OCCT_MMGT_OPT_TBB
|
||||
#endif
|
||||
#define scalable_malloc malloc
|
||||
#define scalable_calloc calloc
|
||||
#define scalable_realloc realloc
|
||||
#define scalable_free free
|
||||
#endif
|
||||
|
||||
#ifndef OCCT_MMGT_OPT_DEFAULT
|
||||
#define OCCT_MMGT_OPT_DEFAULT 0
|
||||
#endif
|
||||
|
||||
//=======================================================================
|
||||
//class : Standard_MMgrFactory
|
||||
//purpose : Container for pointer to memory manager;
|
||||
// used to construct appropriate memory manager according
|
||||
// to environment settings, and to ensure destruction upon exit
|
||||
//=======================================================================
|
||||
class Standard_MMgrFactory
|
||||
{
|
||||
public:
|
||||
static Standard_MMgrRoot* GetMMgr();
|
||||
~Standard_MMgrFactory();
|
||||
|
||||
private:
|
||||
Standard_MMgrFactory();
|
||||
Standard_MMgrFactory (const Standard_MMgrFactory&);
|
||||
Standard_MMgrFactory& operator= (const Standard_MMgrFactory&);
|
||||
|
||||
private:
|
||||
Standard_MMgrRoot* myFMMgr;
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : Standard_MMgrFactory
|
||||
//purpose : Check environment variables and create appropriate memory manager
|
||||
//=======================================================================
|
||||
|
||||
Standard_MMgrFactory::Standard_MMgrFactory()
|
||||
: myFMMgr (NULL)
|
||||
{
|
||||
/*#if defined(_MSC_VER) && (_MSC_VER > 1400)
|
||||
// Turn ON thread-safe C locale globally to avoid side effects by setlocale() calls between threads.
|
||||
// After this call all following _configthreadlocale() will be ignored assuming
|
||||
// Notice that this is MSVCRT feature - on POSIX systems xlocale API (uselocale instead of setlocale)
|
||||
// should be used explicitly to ensure thread-safety!
|
||||
|
||||
// This is not well documented call because _ENABLE_PER_THREAD_LOCALE_GLOBAL flag is defined but not implemented for some reason.
|
||||
// -1 will set global locale flag to force _ENABLE_PER_THREAD_LOCALE_GLOBAL + _ENABLE_PER_THREAD_LOCALE_NEW behaviour
|
||||
// although there NO way to turn it off again and following calls will have no effect (locale will be changed only for current thread).
|
||||
_configthreadlocale (-1);
|
||||
#endif*/
|
||||
|
||||
// Check basic assumption.
|
||||
// If assertion happens, then OCCT should be corrected for compatibility with such CPU architecture.
|
||||
Standard_STATIC_ASSERT(sizeof(Standard_Utf8Char) == 1);
|
||||
Standard_STATIC_ASSERT(sizeof(short) == 2);
|
||||
Standard_STATIC_ASSERT(sizeof(Standard_Utf16Char) == 2);
|
||||
Standard_STATIC_ASSERT(sizeof(Standard_Utf32Char) == 4);
|
||||
#ifdef _WIN32
|
||||
Standard_STATIC_ASSERT(sizeof(Standard_WideChar) == sizeof(Standard_Utf16Char));
|
||||
#endif
|
||||
|
||||
char* aVar;
|
||||
aVar = getenv ("MMGT_OPT");
|
||||
Standard_Integer anAllocId = (aVar ? atoi (aVar): OCCT_MMGT_OPT_DEFAULT);
|
||||
|
||||
#if defined(HAVE_TBB) && defined(_M_IX86)
|
||||
if (anAllocId == 2)
|
||||
{
|
||||
// CR25396: Check if SSE2 instructions are supported on 32-bit x86 processor on Windows platform,
|
||||
// if not then use MMgrRaw instead of MMgrTBBalloc.
|
||||
// It is to avoid runtime crash when running on a CPU
|
||||
// that supports SSE but does not support SSE2 (some modifications of AMD Sempron).
|
||||
static const DWORD _SSE2_FEATURE_BIT(0x04000000);
|
||||
DWORD volatile dwFeature;
|
||||
_asm
|
||||
{
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
|
||||
// get the CPU feature bits
|
||||
mov eax, 1
|
||||
cpuid
|
||||
mov dwFeature, edx
|
||||
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop eax
|
||||
}
|
||||
if ((dwFeature & _SSE2_FEATURE_BIT) == 0)
|
||||
anAllocId = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
aVar = getenv ("MMGT_CLEAR");
|
||||
Standard_Boolean toClear = (aVar ? (atoi (aVar) != 0) : Standard_True);
|
||||
|
||||
// on Windows (actual for XP and 2000) activate low fragmentation heap
|
||||
// for CRT heap in order to get best performance.
|
||||
// Environment variable MMGT_LFH can be used to switch off this action (if set to 0)
|
||||
#if defined(_MSC_VER)
|
||||
aVar = getenv ("MMGT_LFH");
|
||||
if ( aVar == NULL || atoi (aVar) != 0 )
|
||||
{
|
||||
ULONG aHeapInfo = 2;
|
||||
HANDLE aCRTHeap = (HANDLE)_get_heap_handle();
|
||||
HeapSetInformation (aCRTHeap, HeapCompatibilityInformation, &aHeapInfo, sizeof(aHeapInfo));
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (anAllocId)
|
||||
{
|
||||
case 1: // OCCT optimized memory allocator
|
||||
{
|
||||
aVar = getenv ("MMGT_MMAP");
|
||||
Standard_Boolean bMMap = (aVar ? (atoi (aVar) != 0) : Standard_True);
|
||||
aVar = getenv ("MMGT_CELLSIZE");
|
||||
Standard_Integer aCellSize = (aVar ? atoi (aVar) : 200);
|
||||
aVar = getenv ("MMGT_NBPAGES");
|
||||
Standard_Integer aNbPages = (aVar ? atoi (aVar) : 1000);
|
||||
aVar = getenv ("MMGT_THRESHOLD");
|
||||
Standard_Integer aThreshold = (aVar ? atoi (aVar) : 40000);
|
||||
myFMMgr = new Standard_MMgrOpt (toClear, bMMap, aCellSize, aNbPages, aThreshold);
|
||||
break;
|
||||
}
|
||||
case 2: // TBB memory allocator
|
||||
myFMMgr = new Standard_MMgrTBBalloc (toClear);
|
||||
break;
|
||||
case 0:
|
||||
default: // system default memory allocator
|
||||
myFMMgr = new Standard_MMgrRaw (toClear);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ~Standard_MMgrFactory
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_MMgrFactory::~Standard_MMgrFactory()
|
||||
{
|
||||
if ( myFMMgr )
|
||||
myFMMgr->Purge(Standard_True);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: GetMMgr
|
||||
//
|
||||
// This static function has a purpose to wrap static holder for memory
|
||||
// manager instance.
|
||||
//
|
||||
// Wrapping holder inside a function is needed to ensure that it will
|
||||
// be initialized not later than the first call to memory manager (that
|
||||
// would be impossible to guarantee if holder was static variable on
|
||||
// global or file scope, because memory manager may be called from
|
||||
// constructors of other static objects).
|
||||
//
|
||||
// Note that at the same time we could not guarantee that the holder
|
||||
// object is destroyed after last call to memory manager, since that
|
||||
// last call may be from static Handle() object which has been initialized
|
||||
// dynamically during program execution rather than in its constructor.
|
||||
//
|
||||
// Therefore holder currently does not call destructor of the memory manager
|
||||
// but only its method Purge() with Standard_True.
|
||||
//
|
||||
// To free the memory completely, we probably could use compiler-specific
|
||||
// pragmas (such as '#pragma fini' on SUN Solaris and '#pragma init_seg' on
|
||||
// WNT MSVC++) to put destructing function in code segment that is called
|
||||
// after destructors of other (even static) objects. However, this is not
|
||||
// done by the moment since it is compiler-dependent and there is no guarantee
|
||||
// thatsome other object calling memory manager is not placed also in that segment...
|
||||
//
|
||||
// Note that C runtime function atexit() could not help in this problem
|
||||
// since its behaviour is the same as for destructors of static objects
|
||||
// (see ISO 14882:1998 "Programming languages -- C++" 3.6.3)
|
||||
//
|
||||
// The correct approach to deal with the problem would be to have memory manager
|
||||
// to properly control its memory allocation and caching free blocks so
|
||||
// as to release all memory as soon as it is returned to it, and probably
|
||||
// even delete itself if all memory it manages has been released and
|
||||
// last call to method Purge() was with True.
|
||||
//
|
||||
// Note that one possible method to control memory allocations could
|
||||
// be counting calls to Allocate() and Free()...
|
||||
//
|
||||
//=======================================================================
|
||||
Standard_MMgrRoot* Standard_MMgrFactory::GetMMgr()
|
||||
{
|
||||
static Standard_MMgrFactory aFactory;
|
||||
return aFactory.myFMMgr;
|
||||
}
|
||||
// Available macros definition
|
||||
// - OCCT_MMGT_OPT_TBB, using tbb::scalable_allocator
|
||||
// - OCCT_MMGT_OPT_NATIVE, using native calloc, free
|
||||
// - OCCT_MMGT_OPT_JEMALLOC, using external jecalloc, jefree
|
||||
|
||||
//=======================================================================
|
||||
//function : Allocate
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Address Standard::Allocate(const Standard_Size size)
|
||||
Standard_Address Standard::Allocate(const Standard_Size theSize)
|
||||
{
|
||||
return Standard_MMgrFactory::GetMMgr()->Allocate(size);
|
||||
#if defined OCCT_MMGT_OPT_JEMALLOC
|
||||
Standard_Address aPtr = je_calloc(theSize, sizeof(char));
|
||||
if (!aPtr)
|
||||
throw Standard_OutOfMemory("Standard_MMgrRaw::Allocate(): malloc failed");
|
||||
return aPtr;
|
||||
#elif defined OCCT_MMGT_OPT_TBB
|
||||
Standard_Address aPtr = scalable_calloc(theSize, sizeof(char));
|
||||
if (!aPtr)
|
||||
throw Standard_OutOfMemory("Standard_MMgrRaw::Allocate(): malloc failed");
|
||||
return aPtr;
|
||||
#else
|
||||
Standard_Address aPtr = calloc(theSize, sizeof(char));
|
||||
if (!aPtr)
|
||||
throw Standard_OutOfMemory("Standard_MMgrRaw::Allocate(): malloc failed");
|
||||
return aPtr;
|
||||
#endif
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Free
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Standard::Free (Standard_Address theStorage)
|
||||
void Standard::Free(Standard_Address theStorage)
|
||||
{
|
||||
Standard_MMgrFactory::GetMMgr()->Free(theStorage);
|
||||
#if defined OCCT_MMGT_OPT_JEMALLOC
|
||||
je_free(theStorage);
|
||||
#elif defined OCCT_MMGT_OPT_TBB
|
||||
scalable_free(theStorage);
|
||||
#else
|
||||
free(theStorage);
|
||||
#endif
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Reallocate
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Address Standard::Reallocate (Standard_Address theStorage,
|
||||
const Standard_Size theSize)
|
||||
Standard_Address Standard::Reallocate(Standard_Address theStorage,
|
||||
const Standard_Size theSize)
|
||||
{
|
||||
return Standard_MMgrFactory::GetMMgr()->Reallocate (theStorage, theSize);
|
||||
// Note that it is not possible to ensure that additional memory
|
||||
// allocated by realloc will be cleared (so as to satisfy myClear mode);
|
||||
// in order to do that we would need using memset..
|
||||
#if defined OCCT_MMGT_OPT_JEMALLOC
|
||||
Standard_Address aNewStorage = (Standard_Address)je_realloc(theStorage, theSize);
|
||||
if (!aNewStorage)
|
||||
throw Standard_OutOfMemory("Standard_MMgrRaw::Reallocate(): realloc failed");
|
||||
return aNewStorage;
|
||||
#elif defined OCCT_MMGT_OPT_TBB
|
||||
Standard_Address aNewStorage = (Standard_Address)scalable_realloc(theStorage, theSize);
|
||||
if (!aNewStorage)
|
||||
throw Standard_OutOfMemory("Standard_MMgrRaw::Reallocate(): realloc failed");
|
||||
return aNewStorage;
|
||||
#else
|
||||
Standard_Address aNewStorage = (Standard_Address)realloc(theStorage, theSize);
|
||||
if (!aNewStorage)
|
||||
throw Standard_OutOfMemory("Standard_MMgrRaw::Reallocate(): realloc failed");
|
||||
return aNewStorage;
|
||||
#endif
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Purge
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer Standard::Purge()
|
||||
{
|
||||
return Standard_MMgrFactory::GetMMgr()->Purge();
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AllocateAligned
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Address Standard::AllocateAligned (const Standard_Size theSize,
|
||||
const Standard_Size theAlign)
|
||||
Standard_Address Standard::AllocateAligned(const Standard_Size theSize,
|
||||
const Standard_Size theAlign)
|
||||
{
|
||||
#ifdef OCCT_MMGT_OPT_JEMALLOC
|
||||
return je_aligned_alloc(theAlign, theSize);
|
||||
#elif defined OCCT_MMGT_OPT_TBB
|
||||
return scalable_aligned_malloc(theSize, theAlign);
|
||||
#else
|
||||
#if defined(_MSC_VER)
|
||||
return _aligned_malloc (theSize, theAlign);
|
||||
return _aligned_malloc(theSize, theAlign);
|
||||
#elif defined(__ANDROID__) || defined(__QNX__)
|
||||
return memalign (theAlign, theSize);
|
||||
return memalign(theAlign, theSize);
|
||||
#elif (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && (defined(__i386) || defined(__x86_64)))
|
||||
return _mm_malloc (theSize, theAlign);
|
||||
return _mm_malloc(theSize, theAlign);
|
||||
#else
|
||||
void* aPtr;
|
||||
if (posix_memalign (&aPtr, theAlign, theSize))
|
||||
if (posix_memalign(&aPtr, theAlign, theSize))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return aPtr;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FreeAligned
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Standard::FreeAligned (Standard_Address thePtrAligned)
|
||||
void Standard::FreeAligned(Standard_Address thePtrAligned)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
_aligned_free (thePtrAligned);
|
||||
#elif defined(__ANDROID__) || defined(__QNX__)
|
||||
free (thePtrAligned);
|
||||
#elif (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && (defined(__i386) || defined(__x86_64)))
|
||||
_mm_free (thePtrAligned);
|
||||
#ifdef OCCT_MMGT_OPT_JEMALLOC
|
||||
return je_free(thePtrAligned);
|
||||
#elif defined OCCT_MMGT_OPT_TBB
|
||||
return scalable_aligned_free(thePtrAligned);
|
||||
#else
|
||||
free (thePtrAligned);
|
||||
#if defined(_MSC_VER)
|
||||
_aligned_free(thePtrAligned);
|
||||
#elif defined(__ANDROID__) || defined(__QNX__)
|
||||
free(thePtrAligned);
|
||||
#elif (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && (defined(__i386) || defined(__x86_64)))
|
||||
_mm_free(thePtrAligned);
|
||||
#else
|
||||
free(thePtrAligned);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@@ -738,6 +738,8 @@ static Standard_CString schemaAP242DIS = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERI
|
||||
#include <StepVisual_TessellatedItem.hxx>
|
||||
#include <StepVisual_TessellatedGeometricSet.hxx>
|
||||
#include <StepVisual_TessellatedCurveSet.hxx>
|
||||
#include <StepVisual_RepositionedTessellatedGeometricSet.hxx>
|
||||
#include <StepVisual_RepositionedTessellatedItem.hxx>
|
||||
#include <StepVisual_CoordinatesList.hxx>
|
||||
#include <StepRepr_CharacterizedRepresentation.hxx>
|
||||
#include <StepRepr_ConstructiveGeometryRepresentation.hxx>
|
||||
@@ -756,7 +758,7 @@ static Standard_CString schemaAP242DIS = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERI
|
||||
#include <StepVisual_SurfaceStyleRenderingWithProperties.hxx>
|
||||
|
||||
static int THE_StepAP214_Protocol_init = 0;
|
||||
static Interface_DataMapOfTransientInteger types(800);
|
||||
static Interface_DataMapOfTransientInteger types(803);
|
||||
|
||||
//=======================================================================
|
||||
//function : StepAP214_Protocol
|
||||
@@ -1468,6 +1470,8 @@ StepAP214_Protocol::StepAP214_Protocol ()
|
||||
types.Bind (STANDARD_TYPE(StepVisual_SurfaceStyleReflectanceAmbient), 721);
|
||||
types.Bind (STANDARD_TYPE(StepVisual_SurfaceStyleRendering), 722);
|
||||
types.Bind (STANDARD_TYPE(StepVisual_SurfaceStyleRenderingWithProperties), 723);
|
||||
types.Bind(STANDARD_TYPE(StepVisual_RepositionedTessellatedGeometricSet), 802);
|
||||
types.Bind(STANDARD_TYPE(StepVisual_RepositionedTessellatedItem), 803);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -197,6 +197,10 @@ StepVisual_PresentedItemRepresentation.cxx
|
||||
StepVisual_PresentedItemRepresentation.hxx
|
||||
StepVisual_RenderingPropertiesSelect.cxx
|
||||
StepVisual_RenderingPropertiesSelect.hxx
|
||||
StepVisual_RepositionedTessellatedGeometricSet.hxx
|
||||
StepVisual_RepositionedTessellatedGeometricSet.cxx
|
||||
StepVisual_RepositionedTessellatedItem.hxx
|
||||
StepVisual_RepositionedTessellatedItem.cxx
|
||||
StepVisual_ShadingSurfaceMethod.hxx
|
||||
StepVisual_StyleContextSelect.cxx
|
||||
StepVisual_StyleContextSelect.hxx
|
||||
|
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) 2022 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 <StepVisual_RepositionedTessellatedGeometricSet.hxx>
|
||||
|
||||
#include <StepGeom_Axis2Placement3d.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(StepVisual_RepositionedTessellatedGeometricSet, StepVisual_TessellatedGeometricSet)
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void StepVisual_RepositionedTessellatedGeometricSet::Init(const Handle(TCollection_HAsciiString)& theName,
|
||||
const NCollection_Handle<StepVisual_Array1OfTessellatedItem>& theItems,
|
||||
const Handle(StepGeom_Axis2Placement3d)& theLocation)
|
||||
{
|
||||
StepVisual_TessellatedGeometricSet::Init(theName, theItems);
|
||||
myLocation = theLocation;
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
// Copyright (c) 2022 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 _StepVisual_RepositionedTessellatedGeometricSet_HeaderFile
|
||||
#define _StepVisual_RepositionedTessellatedGeometricSet_HeaderFile
|
||||
|
||||
#include <StepVisual_TessellatedGeometricSet.hxx>
|
||||
|
||||
class StepGeom_Axis2Placement3d;
|
||||
|
||||
DEFINE_STANDARD_HANDLE(StepVisual_RepositionedTessellatedGeometricSet, StepVisual_TessellatedGeometricSet)
|
||||
|
||||
//! Representation of complex STEP entity RepositionedTessellatedGeometricSet
|
||||
class StepVisual_RepositionedTessellatedGeometricSet : public StepVisual_TessellatedGeometricSet
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(StepVisual_RepositionedTessellatedGeometricSet, StepVisual_TessellatedGeometricSet)
|
||||
|
||||
//! Default constructor
|
||||
StepVisual_RepositionedTessellatedGeometricSet() {};
|
||||
|
||||
//! Initialize all fields (own and inherited)
|
||||
Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& theName,
|
||||
const NCollection_Handle<StepVisual_Array1OfTessellatedItem>& theItems,
|
||||
const Handle(StepGeom_Axis2Placement3d)& theLocation);
|
||||
|
||||
//! Returns location
|
||||
Handle(StepGeom_Axis2Placement3d) Location() const { return myLocation; }
|
||||
|
||||
//! Sets location
|
||||
void SetLocation(const Handle(StepGeom_Axis2Placement3d)& theLocation) { myLocation = theLocation; }
|
||||
|
||||
private:
|
||||
|
||||
Handle(StepGeom_Axis2Placement3d) myLocation;
|
||||
};
|
||||
#endif // StepVisual_RepositionedTessellatedGeometricSet_HeaderFile
|
29
src/StepVisual/StepVisual_RepositionedTessellatedItem.cxx
Normal file
29
src/StepVisual/StepVisual_RepositionedTessellatedItem.cxx
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2022 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 <StepVisual_RepositionedTessellatedItem.hxx>
|
||||
|
||||
#include <StepGeom_Axis2Placement3d.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(StepVisual_RepositionedTessellatedItem, StepVisual_TessellatedItem)
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void StepVisual_RepositionedTessellatedItem::Init(const Handle(TCollection_HAsciiString)& theName,
|
||||
const Handle(StepGeom_Axis2Placement3d)& theLocation)
|
||||
{
|
||||
StepVisual_TessellatedItem::Init(theName);
|
||||
myLocation = theLocation;
|
||||
}
|
49
src/StepVisual/StepVisual_RepositionedTessellatedItem.hxx
Normal file
49
src/StepVisual/StepVisual_RepositionedTessellatedItem.hxx
Normal file
@@ -0,0 +1,49 @@
|
||||
// Copyright (c) 2022 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 _StepVisual_RepositionedTessellatedItem_HeaderFile
|
||||
#define _StepVisual_RepositionedTessellatedItem_HeaderFile
|
||||
|
||||
#include <StepVisual_TessellatedItem.hxx>
|
||||
|
||||
class StepGeom_Axis2Placement3d;
|
||||
|
||||
DEFINE_STANDARD_HANDLE(StepVisual_RepositionedTessellatedItem, StepVisual_TessellatedItem)
|
||||
|
||||
//! Representation of STEP entity RepositionedTessellatedItem
|
||||
class StepVisual_RepositionedTessellatedItem : public StepVisual_TessellatedItem
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(StepVisual_RepositionedTessellatedItem, StepVisual_TessellatedItem)
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Default constructor
|
||||
StepVisual_RepositionedTessellatedItem() {};
|
||||
|
||||
//! Initialize all fields (own and inherited)
|
||||
Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& theName,
|
||||
const Handle(StepGeom_Axis2Placement3d)& theLocation);
|
||||
|
||||
//! Returns location
|
||||
Handle(StepGeom_Axis2Placement3d) Location() const { return myLocation; }
|
||||
|
||||
//! Sets location
|
||||
void SetLocation(const Handle(StepGeom_Axis2Placement3d)& theLocation) { myLocation = theLocation; }
|
||||
|
||||
private:
|
||||
|
||||
Handle(StepGeom_Axis2Placement3d) myLocation;
|
||||
};
|
||||
#endif // StepVisual_RepositionedTessellatedItem_HeaderFile
|
@@ -1,3 +1,12 @@
|
||||
project(TKernel)
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
|
||||
# Set desired Memory Manager
|
||||
if ("${USE_MMGR_TYPE}" STREQUAL "TBB")
|
||||
target_compile_definitions("TKernel" PRIVATE "OCCT_MMGT_OPT_TBB")
|
||||
elseif ("${USE_MMGR_TYPE}" STREQUAL "JEMALLOC")
|
||||
target_compile_definitions("TKernel" PRIVATE "OCCT_MMGT_OPT_JEMALLOC")
|
||||
else ()
|
||||
message (STATUS "Info: Used native memory manager")
|
||||
endif()
|
||||
|
@@ -7,3 +7,4 @@ CSF_dl
|
||||
CSF_wsock32
|
||||
CSF_psapi
|
||||
CSF_androidlog
|
||||
CSF_MMGR
|
||||
|
@@ -968,7 +968,7 @@ void V3d_View::SetTwist(const Standard_Real angle)
|
||||
const gp_Dir aReferencePlane (aCamera->Direction().Reversed());
|
||||
if (!screenAxis (aReferencePlane, gp::DZ(), myXscreenAxis, myYscreenAxis, myZscreenAxis)
|
||||
&& !screenAxis (aReferencePlane, gp::DY(), myXscreenAxis, myYscreenAxis, myZscreenAxis)
|
||||
&& !screenAxis (aReferencePlane, gp::DZ(), myXscreenAxis, myYscreenAxis, myZscreenAxis))
|
||||
&& !screenAxis (aReferencePlane, gp::DX(), myXscreenAxis, myYscreenAxis, myZscreenAxis))
|
||||
{
|
||||
throw V3d_BadValue ("V3d_ViewSetTwist, alignment of Eye,At,Up,");
|
||||
}
|
||||
|
@@ -43,6 +43,35 @@ const Standard_GUID& XCAFDoc::AssemblyGUID ()
|
||||
return ID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SupplementalContainerGUID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& XCAFDoc::SupplementalContainerGUID()
|
||||
{
|
||||
static const Standard_GUID ID("da071945-9557-41b4-9e44-19e649f98b54");
|
||||
return ID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SupplementalRefGUID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& XCAFDoc::SupplementalRefGUID()
|
||||
{
|
||||
static const Standard_GUID ID("85a1b8d7-0936-4e8b-a953-a8bd7731411a");
|
||||
return ID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SupplementalGeometryGUID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& XCAFDoc::SupplementalGeometryGUID()
|
||||
{
|
||||
static const Standard_GUID ID("e17cce33-1aa2-4b7f-9060-6e469a7954a9");
|
||||
return ID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ExternRefGUID
|
||||
|
@@ -72,6 +72,15 @@ public:
|
||||
|
||||
//! Returns GUID for TreeNode representing assembly link
|
||||
Standard_EXPORT static const Standard_GUID& ShapeRefGUID();
|
||||
|
||||
//! Returns GUID for TreeNode representing compound of supplemental geometry
|
||||
Standard_EXPORT static const Standard_GUID& SupplementalContainerGUID();
|
||||
|
||||
//! Returns GUID for TreeNode representing reference for supplemental geometry
|
||||
Standard_EXPORT static const Standard_GUID& SupplementalRefGUID();
|
||||
|
||||
//! Returns GUID for TreeNode representing supplemental geometry
|
||||
Standard_EXPORT static const Standard_GUID& SupplementalGeometryGUID();
|
||||
|
||||
//! Return GUIDs for TreeNode representing specified types of colors
|
||||
Standard_EXPORT static const Standard_GUID& ColorRefGUID (const XCAFDoc_ColorType type);
|
||||
|
@@ -13,6 +13,8 @@
|
||||
|
||||
#include <XCAFDoc_DimTolTool.hxx>
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_GUID.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
@@ -617,6 +619,51 @@ Standard_Boolean XCAFDoc_DimTolTool::GetRefDatumLabel(const TDF_Label& theShapeL
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetNumberOfPlaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer XCAFDoc_DimTolTool::GetNumberOfPlaces(const TDF_Label& theLabel)
|
||||
{
|
||||
TDF_LabelSequence aFirstShapes, aSecondShapes;
|
||||
GetRefShapeLabel(theLabel, aFirstShapes, aSecondShapes);
|
||||
|
||||
NCollection_Sequence<Bnd_Box> aBoxes;
|
||||
for (Standard_Integer anI = 1; anI <= aFirstShapes.Size(); anI++)
|
||||
{
|
||||
Bnd_Box aBox;
|
||||
BRepBndLib::Add(ShapeTool()->GetShape(aFirstShapes(anI)), aBox, Standard_True);
|
||||
aBoxes.Append(aBox);
|
||||
}
|
||||
|
||||
// Fill bounded boxes of number of places - this will exclude duplications
|
||||
NCollection_Sequence<Bnd_Box> aPlaces;
|
||||
for (Standard_Integer anI = 1; anI <= aBoxes.Size(); anI++)
|
||||
{
|
||||
Standard_Boolean toAddPlace = Standard_True;
|
||||
Standard_Integer aBoxesIndex = 1;
|
||||
for (Standard_Integer aJ = 1; aJ <= aPlaces.Size(); aJ++)
|
||||
{
|
||||
if (!aPlaces(aJ).IsOut(aBoxes(anI)))
|
||||
{
|
||||
toAddPlace = Standard_False;
|
||||
aBoxesIndex = aJ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (toAddPlace)
|
||||
{
|
||||
aPlaces.Append(aBoxes(anI));
|
||||
}
|
||||
else
|
||||
{
|
||||
aPlaces.ChangeValue(aBoxesIndex).Add(aBoxes(anI));
|
||||
}
|
||||
}
|
||||
return aPlaces.Size();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetDimTol
|
||||
//purpose :
|
||||
|
@@ -232,6 +232,10 @@ public:
|
||||
Standard_EXPORT Standard_Boolean GetRefDatumLabel (const TDF_Label& theShapeL,
|
||||
TDF_LabelSequence& theDatum) const;
|
||||
|
||||
//! @param theLabel [in] geometrical tolerance TDF label.
|
||||
//! @return Number Of Places corresponding to the Geometrical Tolerance or Dimensional Tolerance TDF label.
|
||||
Standard_EXPORT Standard_Integer GetNumberOfPlaces (const TDF_Label& theLabel);
|
||||
|
||||
//! Returns true if the given GDT is marked as locked.
|
||||
Standard_EXPORT Standard_Boolean IsLocked(const TDF_Label& theViewL) const;
|
||||
|
||||
|
17
tests/bugs/step/bug32731
Normal file
17
tests/bugs/step/bug32731
Normal file
@@ -0,0 +1,17 @@
|
||||
puts "======="
|
||||
puts "0032731: Data Exchange, Step Import - Incorrect PMI text location"
|
||||
puts "======="
|
||||
|
||||
pload OCAF
|
||||
|
||||
catch {Close D}
|
||||
|
||||
# Read file
|
||||
ReadStep D [locate_data_file bug32731_A5E46910589A.stp]
|
||||
|
||||
#Checking
|
||||
XGetShape repr0 D 0:1:4:106:15
|
||||
checkgravitycenter repr0 -l -109.847 153.679 0 1e-7
|
||||
|
||||
XGetShape repr1 D 0:1:4:56:15
|
||||
checkgravitycenter repr1 -l -68.7 123.272 -18.5624 1e-7
|
14
tests/bugs/step/bug33331
Normal file
14
tests/bugs/step/bug33331
Normal file
@@ -0,0 +1,14 @@
|
||||
puts "===================================="
|
||||
puts "0033331: Data Exchange, Step Import - Unsupported Representation Items"
|
||||
puts "===================================="
|
||||
puts ""
|
||||
|
||||
pload DCAF
|
||||
catch {Close D}
|
||||
|
||||
param "read.stepcaf.subshapes.name" 1
|
||||
|
||||
ReadStep D [locate_data_file bug33331.stp]
|
||||
|
||||
param "read.stepcaf.subshapes.name" 0
|
||||
Close D
|
Reference in New Issue
Block a user