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

Compare commits

..

23 Commits

Author SHA1 Message Date
sshutina
a516227511 0031354: Visualization - Dump improvement for V3d, Graphic3d, Aspect
- do not dump light in view as it's dumped in the viewer
2020-09-04 18:14:24 +03:00
mzernova
f0da497005 0031733: Visualization, Prs3d_ToolQuadric - create indexed arrays
Prs3d_ToolQuadric has been modified to return an indexed triangulation.
Added methods Prs3d_ToolQuadric::CreateTriangulation() and Prs3d_ToolQuadric::CreateTriangulation()
as more straightforward API returning generated triangulation.
Added missing const to constant methods.

Confusing method Prs3d_ToolQuadric::FillArray() filling both
Graphic3d_ArrayOfTriangles and Poly_Triangulation at once has been marked deprecated.

V3d_Trihedron, AIS_ViewCube and AIS_Manipulator
now set Closed flag to groups with shaded sphere and arrows.
2020-09-04 18:14:23 +03:00
emv
ba8175dd5d 0027973: Result of Common operation contains a face with an open wire
Integrating test case only as the problem is not reproduced anymore.
2020-09-04 18:14:22 +03:00
emv
129d6e8cc4 0026534: Boolean Cut returns empty result
Integrating test case only as the problem is not reproduced anymore.
2020-09-04 18:14:21 +03:00
mpv
59af6f852a 0029838: Application Framework - TObj.msg defines unused messages 2020-09-04 18:14:21 +03:00
mpv
8f34d47e21 0031340: LDOM fails to read XML file starting with BOM
Added support of BOM (byte order mask) characters at the start of an XML stream or file and provided information about found BOM in LDOMParser.
2020-09-04 18:14:20 +03:00
emv
b3df3dcd82 0026452: Infinite loop in Edge/Edge intersection.
Integrating test case only as the problem is not reproduced anymore.
2020-09-03 20:02:44 +03:00
akaftasev
992876e98f 0030795: BRepOffsetAPI_MakePipeShell: hangs on the attached model and produces infinite rails
Added new condition to catch bad shape
2020-09-03 20:00:47 +03:00
kgv
eca6e7c547 0031744: Configuration - add batch files to build OCCT for Android target
Added script adm/scripts/android_build.bat and template android_custom.bat.template
intended for automating building routines targeting Android platform.

OpenCASCADEConfig.cmake has been extended to detect "$INSTALL_DIR/libs/$CMAKE_ANDROID_ARCH_ABI/cmake/opencascade" location.
2020-09-03 19:56:25 +03:00
msv
a75f5cdd86 0031742: Configuration - Add batch files for cmake build
The scripts cmake_gen.bat and cmake_gen.sh have been added to facilitate batch building of OCCT correspondingly on Windows and Linux platforms.

The files build.bat and install.bat are copied to the build directory by cmake configure procedure to enable batch building and installation on Windows platform.
2020-09-02 19:58:07 +03:00
osa
b3da9c3ede 0031737: Configuration - Add batch files to build OCCT with Emscripten
The scripts occ_build_wasm.bat and occ_build_wasm.sh have been added
to simplify batch building of OCCT with Emscripten (Web Assembly packages) correspondingly on Windows and Linux platforms.
These scripts are configurable through calling files with custom environment wasm_custom_env.bat and wasm_custom_env.sh.
2020-09-02 19:51:56 +03:00
mpv
17a5b56767 0031320: TObj - method TObj_Object::GetFatherObject() is not protected against deleted object 2020-09-02 19:42:39 +03:00
kgv
f5e758d239 0031728: Visualization, Font_FontMgr - provide function to register fallback fonts in application level
Added public method Font_FontMgr::AddFontAlias() for registering custom aliases and fallback fonts.
vfont command has been extended with arguments -aliases, -addAlias, -removeAlias, -clearAlias and -clearAliases.
2020-09-02 19:38:48 +03:00
ifv
cdddd079cc 0026088: Modeling Algorithms - Exception in pipe algorithm
GeomFill_Sweep.cxx: treatment KPart for sphere is improved
bug26088: test case is corrected - TODO is removed
2020-09-02 19:37:14 +03:00
abv
fba34cf8ba 0031740: Configuration - recover support of Yacc and Lex generation
Scripts adm/cmake/bison.cmake and adm/cmake/flex.cmake are refactored to enable actual search for bison and flex.
Apart of standard locations, also sub-folders of 3RDPARTY_DIR whose names contain "bison" and "flex", respectively, are added to search.
Cache variables 3RDPARTY_BISON_EXECUTABLE and 3RDPARTY_FLEX_EXECUTABLE are removed to avoid confusion (they duplicated similar variables without "3RDPARTY_" prefix).

Lex and Yacc files are corrected to match changes made manually in generated files during last years:
- StepFile/step.yacc: correction missing from #22972
- StepFile/step.lex: corrected for compilation (broken by #31060)
- MSVC-specific code is synchronized between StepFile/step.lex and ExprIntrp/ExprIntrp.lex
- Old commented code and duplicate code blocks removed

Commands for execution of Flex and Bison tools in CMake scripts are tweaked to avoid embedding line numbers (with local paths) in generated files.

Scanners and parsers are regenerated from updated source files with modified options.
Note that lex.ExprIntrp.c is regenerated with multiple differences because option -f (fast scanner) was used for generation of previous version (by WOK).
2020-09-02 19:25:24 +03:00
kgv
dda9303c69 0031743: Draw Harness - fix misprint in Draw_Interpretor::SetToColorize() 2020-09-02 18:54:31 +03:00
kgv
7d47ebdbcd 0030617: Coding - using reinterpret_cast instead of static_cast for downcast
Several reinterpret_cast have been replaced by static_cast when applicable.
2020-09-02 18:48:56 +03:00
kgv
d6c489212b 0028990: Coding Rules - deprecate redundant class Prs3d_Root
Prs3d_Root usage has been replaced by direct calls to Prs3d_Presentation methods.
2020-08-30 19:04:53 +03:00
kgv
68a2329305 0031369: Foundation Classes, Standard_ReadBuffer - access violation on second ::ReadChunk() call after read failure
Standard_ReadBuffer::readRawDataChunk() - do not increment NULL pointer and return invalid address.
2020-08-28 18:13:36 +03:00
kgv
90bc1adb77 0031086: Coding Rules - STEPCAFControl_Reader has virtual functions, but no virtual destructor
Added missing virtual destructor.
2020-08-28 18:11:58 +03:00
kgv
af7fa1438e 0031706: Data Exchange, RWGltf_CafReader - imports model with incorrect transformation
RWGltf_GltfJsonParser::bindNamedShape() - shape location is now multiplied not just overridden.
2020-08-28 18:00:22 +03:00
emv
6f04cbb1fb 0031734: Modeling Algorithms - Incorrect result of offset operation in mode "Complete" join type "Intersection"
BRepOffset_MakeOffset_1::IntersectFaces - Build intersection pairs for rebuilding process basing on the intersection results and removed faces.
2020-08-28 17:53:40 +03:00
kgv
d99f0355e3 0031731: Draw Harness - colorize errors and exception messages
Draw_Interpretor, CommandCmd() - catched exceptions and messages put into Tcl string result
before throwing a Tcl exception (return 1) are now print in intense red (using Message::SendFail()).
Duplication of exception message in std::cout and Tcl output has been removed.

Draw Harness plugins have been updated to use either Message::SendFail() or theDI instead of std::cout/std::cerr
for printing colored error message before throwing a Tcl exception.
2020-08-25 09:44:15 +03:00
371 changed files with 6427 additions and 5560 deletions

View File

@@ -930,6 +930,9 @@ if (WIN32)
OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}")
# install env script
install (FILES "${CMAKE_BINARY_DIR}/env.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SCRIPT}")
# copy build.bat and install.bat scripts to CMake binary folder
OCCT_COPY_FILE_OR_DIR ("adm/templates/build.bat" "${CMAKE_BINARY_DIR}")
OCCT_COPY_FILE_OR_DIR ("adm/templates/install.bat" "${CMAKE_BINARY_DIR}")
else()
set (SUB_ENV_NAME "env.${SCRIPT_EXT}")
set (SUB_ENV_BUILD_NAME "env.install.${SCRIPT_EXT}")

View File

@@ -2,19 +2,28 @@
# execute FindBISON script by "find_package (Bison)" is required to define BISON_TARGET macro
if (NOT DEFINED 3RDPARTY_BISON_EXECUTABLE)
set (3RDPARTY_BISON_EXECUTABLE "" CACHE FILEPATH "The path to the bison command")
# delete obsolete 3RDPARTY_BISON_EXECUTABLE cache variable (not used anymore)
unset (3RDPARTY_BISON_EXECUTABLE CACHE)
# delete BISON_EXECUTABLE cache variable if it is empty, otherwise find_package will fail
# without reasonable diagnostic
if (NOT BISON_EXECUTABLE)
unset (BISON_EXECUTABLE CACHE)
endif()
# BISON_EXECUTABLE is required by BISON_TARGET macro and should be defined
set (BISON_EXECUTABLE "${3RDPARTY_BISON_EXECUTABLE}" CACHE FILEPATH "path to the bison executable" FORCE)
find_package (BISON)
if (BISON_FOUND)
set (3RDPARTY_BISON_EXECUTABLE "${BISON_EXECUTABLE}" CACHE FILEPATH "The Path to the bison command" FORCE)
# Add paths to 3rdparty subfolders containing name "bison" to CMAKE_PROGRAM_PATH variable to make
# these paths searhed by find_package
if (3RDPARTY_DIR)
file (GLOB BISON_PATHS LIST_DIRECTORIES true "${3RDPARTY_DIR}/*bison*/")
foreach (candidate_path ${BISON_PATHS})
if (IS_DIRECTORY ${candidate_path})
list (APPEND CMAKE_PROGRAM_PATH ${candidate_path})
endif()
endforeach()
endif()
find_package (BISON 2.7)
if (NOT 3RDPARTY_BISON_EXECUTABLE OR NOT EXISTS "${3RDPARTY_BISON_EXECUTABLE}")
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_BISON_EXECUTABLE)
if (NOT BISON_FOUND OR NOT BISON_EXECUTABLE OR NOT EXISTS "${BISON_EXECUTABLE}")
list (APPEND 3RDPARTY_NOT_INCLUDED BISON_EXECUTABLE)
endif()

View File

@@ -2,19 +2,28 @@
# execute FindFLEX script by "find_package (Flex)" is required to define FLEX_TARGET macro
if (NOT DEFINED 3RDPARTY_FLEX_EXECUTABLE)
set (3RDPARTY_FLEX_EXECUTABLE "" CACHE FILEPATH "The Path to the flex command")
# delete obsolete 3RDPARTY_FLEX_EXECUTABLE cache variable (not used anymore)
unset (3RDPARTY_FLEX_EXECUTABLE CACHE)
# delete FLEX_EXECUTABLE cache variable if it is empty, otherwise find_package will fail
# without reasonable diagnostic
if (NOT FLEX_EXECUTABLE)
unset (FLEX_EXECUTABLE CACHE)
endif()
# FLEX_EXECUTABLE is required by FLEX_TARGET macro and should be defined
set (FLEX_EXECUTABLE "${3RDPARTY_FLEX_EXECUTABLE}" CACHE FILEPATH "path to the flex executable" FORCE)
find_package (FLEX)
if (FLEX_FOUND)
set (3RDPARTY_FLEX_EXECUTABLE "${FLEX_EXECUTABLE}" CACHE FILEPATH "The Path to the flex command" FORCE)
# Add paths to 3rdparty subfolders containing name "flex" to CMAKE_PROGRAM_PATH variable to make
# these paths searhed by find_package
if (3RDPARTY_DIR)
file (GLOB FLEX_PATHS LIST_DIRECTORIES true "${3RDPARTY_DIR}/*flex*")
foreach (candidate_path ${FLEX_PATHS})
if (IS_DIRECTORY ${candidate_path})
list (APPEND CMAKE_PROGRAM_PATH ${candidate_path})
endif()
endforeach()
endif()
find_package (FLEX 2.5.3)
if (NOT 3RDPARTY_FLEX_EXECUTABLE OR NOT EXISTS "${3RDPARTY_FLEX_EXECUTABLE}")
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FLEX_EXECUTABLE)
if (NOT FLEX_FOUND OR NOT FLEX_EXECUTABLE OR NOT EXISTS "${FLEX_EXECUTABLE}")
list (APPEND 3RDPARTY_NOT_INCLUDED FLEX_EXECUTABLE)
endif()

View File

@@ -93,8 +93,8 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
if (EXISTS "${CURRENT_FLEX_FILE}" AND EXISTS "${CURRENT_BISON_FILE}" AND ${ARE_FILES_EQUAL})
set (BISON_OUTPUT_FILE ${CURRENT_BISON_FILE_NAME}.tab.c)
set (FLEX_OUTPUT_FILE lex.${CURRENT_FLEX_FILE_NAME}.c)
BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${BISON_OUTPUT_FILE} COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME}")
FLEX_TARGET (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${FLEX_OUTPUT_FILE} COMPILE_FLAGS "-P${CURRENT_FLEX_FILE_NAME}")
BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${BISON_OUTPUT_FILE} COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME} -l")
FLEX_TARGET (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${FLEX_OUTPUT_FILE} COMPILE_FLAGS "-P${CURRENT_FLEX_FILE_NAME} -L")
ADD_FLEX_BISON_DEPENDENCY (Scanner_${CURRENT_FLEX_FILE_NAME} Parser_${CURRENT_BISON_FILE_NAME})
list (APPEND SOURCE_FILES ${BISON_OUTPUT_FILE} ${FLEX_OUTPUT_FILE})

2
adm/scripts/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*custom.bat
*custom.sh

View File

@@ -0,0 +1,234 @@
@echo OFF
rem Auxiliary script for semi-automated building of OCCT for Android platform.
rem android_custom.bat should be configured with paths
rem to CMake, 3rd-parties, Android NDK and MinGW make tool.
set "aCasSrc=%~dp0..\.."
set "aBuildRoot=%aCasSrc%\work"
set aNbJobs=%NUMBER_OF_PROCESSORS%
rem Paths to 3rd-party tools and libraries
set "anNdkPath="
set "aFreeType="
set "aRapidJson="
rem Build stages to perform
set "toCMake=1"
set "toClean=0"
set "toMake=1"
set "toInstall=1"
set "toPack=1"
set "isStatic=0"
rem Minimal Android platform and CPU architectures
set "anNdkApiLevel=21"
set "anNdkAbiList=armeabi-v7a x86 arm64-v8a x86_64"
rem OCCT Modules to build
set "BUILD_ModelingData=ON"
set "BUILD_ModelingAlgorithms=ON"
set "BUILD_Visualization=ON"
set "BUILD_ApplicationFramework=ON"
set "BUILD_DataExchange=ON"
rem Optional 3rd-party libraries to enable
set USE_RAPIDJSON=OFF
rem Archive tool
set "THE_7Z_PARAMS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on"
set "THE_7Z_PATH=%ProgramW6432%\7-Zip\7z.exe"
rem Configuration file
if exist "%~dp0android_custom.bat" call "%~dp0android_custom.bat"
set "aCompiler=gcc"
set "aCppLib=gnustl_shared"
if not exist "%anNdkPath%/sources/cxx-stl/gnu-libstdc++" (
if exist "%anNdkPath%/sources/cxx-stl/llvm-libc++" (
set "aCompiler=clang"
set "aCppLib=c++_shared"
)
)
set "aLibType=Shared"
if ["%isStatic%"] == ["1"] set "aLibType=Static"
set "aDestDir=%aBuildRoot%\android-%aCompiler%"
set "anOcctVerSuffix="
set "anOcctVersion=0.0.0"
set "aGitBranch="
for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_DEVELOPMENT" "%aCasSrc%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVerSuffix=%%i" )
for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_COMPLETE" "%aCasSrc%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVersion=%%i" )
for /f %%i in ('git symbolic-ref --short HEAD') do ( set "aGitBranch=%%i" )
for %%s in (%anNdkAbiList%) do (
call :cmakeGenerate "%anNdkApiLevel%" "%%s"
)
for /F "skip=1 delims=" %%F in ('
wmic PATH Win32_LocalTime GET Day^,Month^,Year /FORMAT:TABLE
') do (
for /F "tokens=1-3" %%L in ("%%F") do (
set DAY00=0%%L
set MONTH00=0%%M
set YEAR=%%N
)
)
set DAY00=%DAY00:~-2%
set MONTH00=%MONTH00:~-2%
set "aRevision=-%YEAR%-%MONTH00%-%DAY00%"
rem set "aRevision=-%aGitBranch%"
set "anArchName=occt-%anOcctVersion%%anOcctVerSuffix%%aRevision%-android"
set "aTarget=%aBuildRoot%\%anArchName%"
if ["%toPack%"] == ["1"] (
echo Creating archive %anArchName%.7z
rmdir /S /Q "%aTarget%"
if not exist "%aTarget%" ( mkdir "%aTarget%" )
if exist "%aBuildRoot%/%anArchName%.7z" del "%aBuildRoot%/%anArchName%.7z"
xcopy /S /Y "%aDestDir%\*" "%aTarget%\"
"%THE_7Z_PATH%" a -r %THE_7Z_PARAMS% "%aBuildRoot%/%anArchName%.7z" "%aTarget%"
)
if not ["%1"] == ["-nopause"] (
pause
)
goto :eof
:cmakeGenerate
set "anApi=%~1"
set "anAbi=%~2"
set "aPlatformAndCompiler=android-%anAbi%-%aCompiler%"
set "aWorkDir=%aBuildRoot%\%aPlatformAndCompiler%-make"
set "aLogFile=%aBuildRoot%\build-%aPlatformAndCompiler%.log"
if not exist "%aWorkDir%" ( mkdir "%aWorkDir%" )
if exist "%aLogFile%" ( del "%aLogFile%" )
rem include some information about OCCT into archive
echo ^<pre^>> "%aWorkDir%\VERSION.html"
git status >> "%aWorkDir%\VERSION.html"
git log -n 100 >> "%aWorkDir%\VERSION.html"
echo ^</pre^>>> "%aWorkDir%\VERSION.html"
echo Start building OCCT for %aPlatformAndCompiler%
echo Start building OCCT for %aPlatformAndCompiler%>> %aLogFile%
pushd "%aWorkDir%"
set "aTimeZERO=%TIME%"
if ["%toCMake%"] == ["1"] (
echo Configuring OCCT for Android %anAbi%, API level %anApi%...
cmake -G "MinGW Makefiles" ^
-D CMAKE_SYSTEM_NAME:STRING="Android" ^
-D CMAKE_ANDROID_NDK="%anNdkPath%" ^
-D CMAKE_BUILD_TYPE:STRING="Release" ^
-D CMAKE_ANDROID_ARCH_ABI:STRING="%anAbi%" ^
-D CMAKE_SYSTEM_VERSION:STRING="%anApi%" ^
-D CMAKE_ANDROID_STL_TYPE="%aCppLib%" ^
-D BUILD_LIBRARY_TYPE:STRING="%aLibType%" ^
-D INSTALL_DIR:PATH="%aDestDir%" ^
-D INSTALL_DIR_INCLUDE:STRING="inc" ^
-D INSTALL_DIR_LIB:STRING="libs/%anAbi%" ^
-D INSTALL_DIR_CMAKE:STRING="libs/%anAbi%/cmake/opencascade" ^
-D INSTALL_DIR_RESOURCE:STRING="src" ^
-D BUILD_MODULE_FoundationClasses:BOOL="ON" ^
-D BUILD_MODULE_ModelingData:BOOL="%BUILD_ModelingData%" ^
-D BUILD_MODULE_ModelingAlgorithms:BOOL="%BUILD_ModelingAlgorithms%" ^
-D BUILD_MODULE_Visualization:BOOL="%BUILD_Visualization%" ^
-D BUILD_MODULE_ApplicationFramework:BOOL="%BUILD_ApplicationFramework%" ^
-D BUILD_MODULE_DataExchange:BOOL="%BUILD_DataExchange%" ^
-D BUILD_MODULE_Draw:BOOL="OFF" ^
-D BUILD_DOC_Overview:BOOL="OFF" ^
-D 3RDPARTY_FREETYPE_DIR:PATH="%aFreeType%" ^
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="%aFreeType%/include" ^
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="%aFreeType%/include" ^
-D 3RDPARTY_FREETYPE_LIBRARY_DIR:PATH="%aFreeType%/libs/%anAbi%" ^
-D 3RDPARTY_FREETYPE_LIBRARY:FILEPATH="%aFreeType%/libs/%anAbi%/libfreetype.so" ^
-D USE_RAPIDJSON:BOOL="%USE_RAPIDJSON%" ^
-D 3RDPARTY_RAPIDJSON_DIR:PATH="%aRapidJson%" ^
-D 3RDPARTY_RAPIDJSON_INCLUDE_DIR:PATH="%aRapidJson%/include" ^
"%aCasSrc%"
if errorlevel 1 (
popd
exit /B 1
goto :eof
)
)
set aTimeGEN=%TIME%
call :computeDuration %aTimeZERO% %aTimeGEN%
if ["%toCMake%"] == ["1"] (
echo Generation time: %DURATION%
echo Generation time: %DURATION%>> "%aLogFile%"
)
if ["%toClean%"] == ["1"] (
mingw32-make clean
)
if ["%toMake%"] == ["1"] (
echo Building...
mingw32-make -j %aNbJobs% 2>> "%aLogFile%"
if errorlevel 1 (
type "%aLogFile%"
popd
exit /B 1
goto :eof
)
type "%aLogFile%"
)
set aTimeBUILD=%TIME%
call :computeDuration %aTimeGEN% %aTimeBUILD%
if ["%toMake%"] == ["1"] (
echo Building time: %DURATION%
echo Building time: %DURATION%>> "%aLogFile%"
)
call :computeDuration %aTimeZERO% %aTimeBUILD%
if ["%toMake%"] == ["1"] (
echo Total building time: %DURATION%
echo Total building time: %DURATION%>> "%aLogFile%"
)
if ["%toInstall%"] == ["1"] (
echo Installing into %aDestDir%...
mingw32-make install 2>> "%aLogFile%"
copy /Y "%aWorkDir%\VERSION.html" "%aDestDir%\VERSION.html"
)
set "aTimeINSTALL=%TIME%"
call :computeDuration "%aTimeBUILD%" "%aTimeINSTALL%"
if ["%toInstall%"] == ["1"] (
echo Install time: %DURATION%
echo Install time: %DURATION%>> "%aLogFile%"
)
call :computeDuration "%aTimeZERO%" "%aTimeINSTALL%"
echo Total time: %DURATION%
echo Total time: %DURATION%>> "%aLogFile%"
popd
goto :eof
:computeDuration
set "aTimeFrom=%~1"
set "aTimeEnd=%~2"
rem handle time before 10AM (win10 - remove empty space at the beginning)
if "%aTimeFrom:~0,1%"==" " set "aTimeFrom=%aTimeFrom:~1%"
if "%aTimeEnd:~0,1%"==" " set "aTimeEnd=%aTimeEnd:~1%"
rem handle time before 10AM (win7 - add 0 at the beginning)
if "%aTimeFrom:~1,1%"==":" set "aTimeFrom=0%aTimeFrom%"
if "%aTimeEnd:~1,1%"==":" set "aTimeEnd=0%aTimeEnd%"
rem convert hours:minutes:seconds:ms into duration
set /A aTimeFrom=(1%aTimeFrom:~0,2%-100)*360000 + (1%aTimeFrom:~3,2%-100)*6000 + (1%aTimeFrom:~6,2%-100)*100 + (1%aTimeFrom:~9,2%-100)
set /A aTimeEnd= (1%aTimeEnd:~0,2%-100)*360000 + (1%aTimeEnd:~3,2%-100)*6000 + (1%aTimeEnd:~6,2%-100)*100 + (1%aTimeEnd:~9,2%-100)
set /A aDurTotalSec=%aTimeEnd%-%aTimeFrom%
if %aTimeEnd% LSS %aTimeFrom% set set /A aDurTotalSec=%aTimeFrom%-%aTimeEnd%
set /A aDurHH=%aDurTotalSec% / 360000
set /A aDurMM=(%aDurTotalSec% - %aDurHH%*360000) / 6000
set /A aDurSS=(%aDurTotalSec% - %aDurHH%*360000 - %aDurMM%*6000) / 100
if %aDurHH% LSS 10 set aDurHH=0%aDurHH%
if %aDurMM% LSS 10 set aDurMM=0%aDurMM%
if %aDurSS% LSS 10 set aDurSS=0%aDurSS%
set "DURATION=%aDurHH%:%aDurMM%:%aDurSS%"
goto :eof

View File

@@ -0,0 +1,31 @@
rem Environment configuration template for android_build.bat (to be renamed as android_custom.bat)
rem Paths to 3rd-party tools and libraries
rem call c:\TDM-GCC-64\mingwvars.bat
rem set "PATH=c:\CMake\bin;%PATH%"
rem set "anNdkPath=c:/android-ndk-r12"
rem set "aFreeType=c:/freetype-2.7.1-android"
rem set "aRapidJson=c:/rapidjson-1.1.0"
rem Uncomment to customize building steps
rem set "aBuildRoot=%~dp0..\..\work"
rem set "toCMake=1"
rem set "toClean=0"
rem set "toMake=1"
rem set "toInstall=1"
rem set "toPack=1"
rem set "isStatic=0"
rem Minimal Android platform and CPU architectures
rem set "anNdkApiLevel=21"
rem set "anNdkAbiList=arm64-v8a x86_64"
rem OCCT Modules to build
rem set "BUILD_ModelingData=ON"
rem set "BUILD_ModelingAlgorithms=ON"
rem set "BUILD_Visualization=ON"
rem set "BUILD_ApplicationFramework=ON"
rem set "BUILD_DataExchange=ON"
rem Optional 3rd-party libraries to enable
rem set USE_RAPIDJSON=ON

View File

@@ -0,0 +1,46 @@
rem Environment configuration template for cmake_gen.bat (to be renamed as cmake_gen_custom.bat)
set "OCCT3RDPARTY=%SrcRoot%\..\3rdparty"
set VS=14
set VSDATA=2015
rem Leave VSPLATFORM empty to build for x86 platform
set VSPLATFORM=Win64
rem ------------------------------------
rem Uncomment to customize building steps
rem ------------------------------------
rem set "BUILD_DIR=build-vs%VS%-%VSPLATFORM%"
rem set "INSTALL_DIR=%SrcRoot%\install"
rem set BUILD_DOC_Overview=OFF
rem set BUILD_Inspector=OFF
rem set BUILD_LIBRARY_TYPE=Shared
rem set BUILD_RELEASE_DISABLE_EXCEPTIONS=ON
rem set BUILD_WITH_DEBUG=OFF
rem set BUILD_ENABLE_FPE_SIGNAL_HANDLER=ON
rem set BUILD_USE_PCH=OFF
rem Use semicolon-separated list of toolkits if you want to disable all modules
rem and build only some toolkits.
rem set BUILD_ADDITIONAL_TOOLKITS=
rem Set a directory recognized as a patch for OCCT.
rem set BUILD_PATCH=
rem set BUILD_MODULE_ApplicationFramework=ON
rem set BUILD_MODULE_DataExchange=ON
rem set BUILD_MODULE_Draw=ON
rem set BUILD_MODULE_ModelingAlgorithms=ON
rem set BUILD_MODULE_ModelingData=ON
rem set BUILD_MODULE_Visualization=ON
rem set USE_D3D=OFF
rem set USE_FFMPEG=OFF
rem set USE_FREEIMAGE=OFF
rem set USE_GLES2=OFF
rem set USE_RAPIDJSON=OFF
rem set USE_TBB=OFF
rem set USE_VTK=OFF

View File

@@ -0,0 +1,42 @@
# Environment configuration template for cmake_gen.sh (to be renamed as cmake_gen_custom.sh)
OCCT3RDPARTY="$SrcRoot/../3rdparty"
FREETYPE_DIR="$OCCT3RDPARTY/freetype-2.7.1"
# ------------------------------------
# Uncomment to customize building steps
# ------------------------------------
#BUILD_DIR=build
#INSTALL_DIR="$SrcRoot/install"
#BUILD_DOC_Overview=OFF
#BUILD_Inspector=OFF
#BUILD_LIBRARY_TYPE=Shared
#BUILD_RELEASE_DISABLE_EXCEPTIONS=ON
#BUILD_WITH_DEBUG=OFF
#BUILD_ENABLE_FPE_SIGNAL_HANDLER=ON
# Use semicolon-separated list of toolkits if you want to disable all modules
# and build only some toolkits.
#BUILD_ADDITIONAL_TOOLKITS=
# Set a directory recognized as a patch for OCCT.
#BUILD_PATCH=
#BUILD_MODULE_ApplicationFramework=ON
#BUILD_MODULE_DataExchange=ON
#BUILD_MODULE_Draw=ON
#BUILD_MODULE_ModelingAlgorithms=ON
#BUILD_MODULE_ModelingData=ON
#BUILD_MODULE_Visualization=ON
#USE_FFMPEG=OFF
#USE_FREEIMAGE=OFF
#USE_GLES2=OFF
#USE_RAPIDJSON=OFF
#USE_TBB=OFF
#USE_VTK=OFF
# This is to add any additional arguments to cmake
#AUX_ARGS=

83
adm/scripts/cmake_gen.bat Normal file
View File

@@ -0,0 +1,83 @@
@echo off
rem Auxiliary script for semi-automated building of OCCT using cmake.
rem cmake_custom.bat should be configured with VS version and path to 3rd-parties.
rem OCCT3RDPARTY must be specified as mandatory dependency.
setlocal
set "SrcRoot=%~dp0..\.."
set VS=14
set VSDATA=2015
set VSPLATFORM=Win64
set "BUILD_DIR=build-vs%VS%-%VSPLATFORM%"
set "INSTALL_DIR=%SrcRoot%\install"
set BUILD_ADDITIONAL_TOOLKITS=
set BUILD_DOC_Overview=OFF
set BUILD_Inspector=OFF
set BUILD_LIBRARY_TYPE=Shared
set BUILD_PATCH=
set BUILD_RELEASE_DISABLE_EXCEPTIONS=ON
set BUILD_WITH_DEBUG=OFF
set BUILD_ENABLE_FPE_SIGNAL_HANDLER=ON
set BUILD_USE_PCH=OFF
set BUILD_MODULE_ApplicationFramework=ON
set BUILD_MODULE_DataExchange=ON
set BUILD_MODULE_Draw=ON
set BUILD_MODULE_ModelingAlgorithms=ON
set BUILD_MODULE_ModelingData=ON
set BUILD_MODULE_Visualization=ON
set USE_D3D=OFF
set USE_FFMPEG=OFF
set USE_FREEIMAGE=OFF
set USE_GLES2=OFF
set USE_RAPIDJSON=OFF
set USE_TBB=OFF
set USE_VTK=OFF
if exist "%~dp0cmake_custom.bat" call "%~dp0cmake_custom.bat"
if not "%VSPLATFORM%"=="" set "arch_compile=Visual Studio %VS% %VSDATA% %VSPLATFORM%"
if "%VSPLATFORM%"=="" set "arch_compile=Visual Studio %VS% %VSDATA%"
set "INSTALL_DIR=%INSTALL_DIR:\=/%"
set "OCCT3RDPARTY=%OCCT3RDPARTY:\=/%"
set "BUILD_DIR=%SrcRoot%\%BUILD_DIR%"
if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
pushd "%BUILD_DIR%"
cmake -G "%arch_compile%" ^
-D 3RDPARTY_DIR:STRING="%OCCT3RDPARTY%" ^
-D BUILD_ADDITIONAL_TOOLKITS:STRING="%BUILD_ADDITIONAL_TOOLKITS%" ^
-D BUILD_DOC_Overview:BOOL=%BUILD_DOC_Overview% ^
-D BUILD_Inspector:BOOL=%BUILD_Inspector% ^
-D BUILD_LIBRARY_TYPE:STRING=%BUILD_LIBRARY_TYPE% ^
-D BUILD_MODULE_ApplicationFramework:BOOL=%BUILD_MODULE_ApplicationFramework% ^
-D BUILD_MODULE_DataExchange:BOOL=%BUILD_MODULE_DataExchange% ^
-D BUILD_MODULE_Draw:BOOL=%BUILD_MODULE_Draw% ^
-D BUILD_MODULE_FoundationClasses:BOOL=ON ^
-D BUILD_MODULE_ModelingAlgorithms:BOOL=%BUILD_MODULE_ModelingAlgorithms% ^
-D BUILD_MODULE_ModelingData:BOOL=%BUILD_MODULE_ModelingData% ^
-D BUILD_MODULE_Visualization:BOOL=%BUILD_MODULE_Visualization% ^
-D BUILD_PATCH:PATH="%BUILD_PATCH%" ^
-D BUILD_RELEASE_DISABLE_EXCEPTIONS:BOOL=%BUILD_RELEASE_DISABLE_EXCEPTIONS% ^
-D BUILD_WITH_DEBUG:BOOL=%BUILD_WITH_DEBUG% ^
-D BUILD_ENABLE_FPE_SIGNAL_HANDLER:BOOL=%BUILD_ENABLE_FPE_SIGNAL_HANDLER% ^
-D BUILD_USE_PCH:BOOL=%BUILD_USE_PCH% ^
-D INSTALL_DIR:PATH="%INSTALL_DIR%" ^
-D USE_D3D:BOOL=%USE_D3D% ^
-D USE_FFMPEG:BOOL=%USE_FFMPEG% ^
-D USE_FREEIMAGE:BOOL=%USE_FREEIMAGE% ^
-D USE_GLES2:BOOL=%USE_GLES2% ^
-D USE_RAPIDJSON:BOOL=%USE_RAPIDJSON% ^
-D USE_TBB:BOOL=%USE_TBB% ^
-D USE_VTK:BOOL=%USE_VTK% ^
"%SrcRoot%"
popd
endlocal

86
adm/scripts/cmake_gen.sh Executable file
View File

@@ -0,0 +1,86 @@
#!/bin/bash
# Auxiliary script for semi-automated building of OCCT using cmake.
# cmake_custom.sh should be configured with path to 3rd-parties.
# OCCT3RDPARTY and FREETYPE_DIR must be specified as mandatory dependencies.
ScriptDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
SrcRoot="${ScriptDir}/../.."
INSTALL_DIR="$SrcRoot/install"
BUILD_DIR=build
DEB=
CMAKE_BUILD_TYPE=Release
if [ "$1" = "-d" ]; then
DEB=d
BUILD_DIR=${BUILD_DIR}-deb
CMAKE_BUILD_TYPE=Debug
fi
INSTALL_DIR_BIN=lin64/gcc/bin$DEB
INSTALL_DIR_LIB=lin64/gcc/lib$DEB
BUILD_ADDITIONAL_TOOLKITS=
BUILD_DOC_Overview=OFF
BUILD_Inspector=OFF
BUILD_LIBRARY_TYPE=Shared
BUILD_PATCH=
BUILD_RELEASE_DISABLE_EXCEPTIONS=ON
BUILD_WITH_DEBUG=OFF
BUILD_ENABLE_FPE_SIGNAL_HANDLER=ON
BUILD_MODULE_ApplicationFramework=ON
BUILD_MODULE_DataExchange=ON
BUILD_MODULE_Draw=ON
BUILD_MODULE_ModelingAlgorithms=ON
BUILD_MODULE_ModelingData=ON
BUILD_MODULE_Visualization=ON
USE_FFMPEG=OFF
USE_FREEIMAGE=OFF
USE_GLES2=OFF
USE_RAPIDJSON=OFF
USE_TBB=OFF
USE_VTK=OFF
AUX_ARGS=
if [ -f "${ScriptDir}/cmake_custom.sh" ]; then
. "${ScriptDir}/cmake_custom.sh"
fi
BUILD_DIR="$SrcRoot/$BUILD_DIR"
if [ ! -d "$BUILD_DIR" ]; then mkdir -p "$BUILD_DIR"; fi
pushd "$BUILD_DIR"
cmake -G "Unix Makefiles" \
-D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
-D 3RDPARTY_DIR:PATH="$OCCT3RDPARTY" \
-D 3RDPARTY_FREETYPE_DIR:PATH="$FREETYPE_DIR" \
-D BUILD_ADDITIONAL_TOOLKITS:STRING="$BUILD_ADDITIONAL_TOOLKITS" \
-D BUILD_DOC_Overview:BOOL=$BUILD_DOC_Overview \
-D BUILD_Inspector:BOOL=$BUILD_Inspector \
-D BUILD_LIBRARY_TYPE:STRING=$BUILD_LIBRARY_TYPE \
-D BUILD_MODULE_ApplicationFramework:BOOL=$BUILD_MODULE_ApplicationFramework \
-D BUILD_MODULE_DataExchange:BOOL=$BUILD_MODULE_DataExchange \
-D BUILD_MODULE_Draw:BOOL=$BUILD_MODULE_Draw \
-D BUILD_MODULE_FoundationClasses:BOOL=ON \
-D BUILD_MODULE_ModelingAlgorithms:BOOL=$BUILD_MODULE_ModelingAlgorithms \
-D BUILD_MODULE_ModelingData:BOOL=$BUILD_MODULE_ModelingData \
-D BUILD_MODULE_Visualization:BOOL=$BUILD_MODULE_Visualization \
-D BUILD_PATCH:PATH="$BUILD_PATCH" \
-D BUILD_RELEASE_DISABLE_EXCEPTIONS:BOOL=$BUILD_RELEASE_DISABLE_EXCEPTIONS \
-D BUILD_WITH_DEBUG:BOOL=$BUILD_WITH_DEBUG \
-D BUILD_ENABLE_FPE_SIGNAL_HANDLER:BOOL=$BUILD_ENABLE_FPE_SIGNAL_HANDLER \
-D INSTALL_DIR:PATH="$INSTALL_DIR" \
-D INSTALL_DIR_LAYOUT:STRING=Windows \
-D INSTALL_DIR_BIN:STRING=$INSTALL_DIR_BIN \
-D INSTALL_DIR_LIB:STRING=$INSTALL_DIR_LIB \
-D USE_FFMPEG:BOOL=$USE_FFMPEG \
-D USE_FREEIMAGE:BOOL=$USE_FREEIMAGE \
-D USE_GLES2:BOOL=$USE_GLES2 \
-D USE_RAPIDJSON:BOOL=$USE_RAPIDJSON \
-D USE_TBB:BOOL=$USE_TBB \
-D USE_VTK:BOOL=$USE_VTK \
$AUX_ARGS "$SrcRoot"
popd

165
adm/scripts/wasm_build.bat Normal file
View File

@@ -0,0 +1,165 @@
@echo OFF
rem Auxiliary script for semi-automated building of OCCT for WASM platform.
rem wasm_custom.bat should be configured with paths to CMake, 3rd-parties and Emscripten SDK.
rem FreeType should be specified as mandatory dependency.
set "aSrcRoot=%~dp0..\.."
set "aBuildRoot=work"
set aNbJobs=%NUMBER_OF_PROCESSORS%
set "toCMake=1"
set "toClean=0"
set "toMake=1"
set "toInstall=1"
set "BUILD_ModelingData=ON"
set "BUILD_ModelingAlgorithms=ON"
set "BUILD_Visualization=ON"
set "BUILD_ApplicationFramework=ON"
set "BUILD_DataExchange=ON"
rem Configuration file
if exist "%~dp0wasm_custom.bat" call "%~dp0wasm_custom.bat"
call "%EMSDK_ROOT%\emsdk_env.bat"
set "aToolchain=%EMSDK%/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
set "anOcctVerSuffix="
set "anOcctVersion=0.0.0"
set "aGitBranch="
for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_DEVELOPMENT" "%aSrcRoot%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVerSuffix=%%i" )
for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_COMPLETE" "%aSrcRoot%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVersion=%%i" )
for /f %%i in ('git symbolic-ref --short HEAD') do ( set "aGitBranch=%%i" )
call :cmakeGenerate
if not ["%1"] == ["-nopause"] (
pause
)
goto :eof
:cmakeGenerate
set "aPlatformAndCompiler=wasm"
set "aWorkDir=%aSrcRoot%\%aBuildRoot%\%aPlatformAndCompiler%-make"
set "aDestDir=%aSrcRoot%\%aBuildRoot%\%aPlatformAndCompiler%"
set "aLogFile=%aSrcRoot%\%aBuildRoot%\build-%aPlatformAndCompiler%.log"
if not exist "%aWorkDir%" ( mkdir "%aWorkDir%" )
if exist "%aLogFile%" ( del "%aLogFile%" )
rem include some information about OCCT into archive
echo ^<pre^>> "%aWorkDir%\VERSION.html"
git status >> "%aWorkDir%\VERSION.html"
git log -n 100 >> "%aWorkDir%\VERSION.html"
echo ^</pre^>>> "%aWorkDir%\VERSION.html"
echo Start building OCCT for %aPlatformAndCompiler%
echo Start building OCCT for %aPlatformAndCompiler%>> %aLogFile%
pushd "%aWorkDir%"
set aTimeZERO=%TIME%
if ["%toCMake%"] == ["1"] (
echo "Configuring OCCT for WASM..."
cmake -G "MinGW Makefiles" ^
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
-D CMAKE_BUILD_TYPE:STRING="Release" ^
-D BUILD_LIBRARY_TYPE:STRING="Static" ^
-D INSTALL_DIR:PATH="%aDestDir%" ^
-D INSTALL_DIR_INCLUDE:STRING="inc" ^
-D INSTALL_DIR_RESOURCE:STRING="src" ^
-D 3RDPARTY_FREETYPE_DIR:PATH="%aFreeType%" ^
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="%aFreeType%/include" ^
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="%aFreeType%/include" ^
-D BUILD_MODULE_FoundationClasses:BOOL="ON" ^
-D BUILD_MODULE_ModelingData:BOOL="%BUILD_ModelingData%" ^
-D BUILD_MODULE_ModelingAlgorithms:BOOL="%BUILD_ModelingAlgorithms%" ^
-D BUILD_MODULE_Visualization:BOOL="%BUILD_Visualization%" ^
-D BUILD_MODULE_ApplicationFramework:BOOL="%BUILD_ApplicationFramework%" ^
-D BUILD_MODULE_DataExchange:BOOL="%BUILD_DataExchange%" ^
-D BUILD_MODULE_Draw:BOOL="OFF" ^
-D BUILD_DOC_Overview:BOOL="OFF" ^
"%aSrcRoot%"
if errorlevel 1 (
popd
exit /B 1
goto :eof
)
)
set aTimeGEN=%TIME%
call :computeDuration %aTimeZERO% %aTimeGEN%
if ["%toCMake%"] == ["1"] (
echo Generation time: %DURATION%
echo Generation time: %DURATION%>> "%aLogFile%"
)
if "%toClean%"=="1" (
mingw32-make clean
)
if "%toMake%"=="1" (
echo Building...
mingw32-make -j %aNbJobs% 2>> "%aLogFile%"
if errorlevel 1 (
popd
exit /B 1
goto :eof
)
type "%aLogFile%"
)
set aTimeBUILD=%TIME%
call :computeDuration %aTimeGEN% %aTimeBUILD%
if "%toMake%"=="1" (
echo Building time: %DURATION%
echo Building time: %DURATION%>> "%aLogFile%"
)
call :computeDuration %aTimeZERO% %aTimeBUILD%
if "%toMake%"=="1" (
echo Total building time: %DURATION%
echo Total building time: %DURATION%>> "%aLogFile%"
)
if "%toInstall%"=="1" (
echo Installing into %aDestDir%...
mingw32-make install 2>> "%aLogFile%"
copy /Y "%aWorkDir%\VERSION.html" "%aDestDir%\VERSION.html"
)
set aTimeINSTALL=%TIME%
call :computeDuration %aTimeBUILD% %aTimeINSTALL%
if "%toInstall%"=="1" (
echo Install time: %DURATION%
echo Install time: %DURATION%>> "%aLogFile%"
)
call :computeDuration %aTimeZERO% %aTimeINSTALL%
echo Total time: %DURATION%
echo Total time: %DURATION%>> "%aLogFile%"
popd
goto :eof
:computeDuration
set aTimeFrom=%1
set aTimeEnd=%2
rem handle time before 10AM (win10 - remove empty space at the beginning)
if "%aTimeFrom:~0,1%"==" " set "aTimeFrom=%aTimeFrom:~1%"
if "%aTimeEnd:~0,1%"==" " set "aTimeEnd=%aTimeEnd:~1%"
rem handle time before 10AM (win7 - add 0 at the beginning)
if "%aTimeFrom:~1,1%"==":" set "aTimeFrom=0%aTimeFrom%"
if "%aTimeEnd:~1,1%"==":" set "aTimeEnd=0%aTimeEnd%"
rem convert hours:minutes:seconds:ms into duration
set /A aTimeFrom=(1%aTimeFrom:~0,2%-100)*360000 + (1%aTimeFrom:~3,2%-100)*6000 + (1%aTimeFrom:~6,2%-100)*100 + (1%aTimeFrom:~9,2%-100)
set /A aTimeEnd= (1%aTimeEnd:~0,2%-100)*360000 + (1%aTimeEnd:~3,2%-100)*6000 + (1%aTimeEnd:~6,2%-100)*100 + (1%aTimeEnd:~9,2%-100)
set /A aDurTotalSec=%aTimeEnd%-%aTimeFrom%
if %aTimeEnd% LSS %aTimeFrom% set set /A aDurTotalSec=%aTimeFrom%-%aTimeEnd%
set /A aDurHH=%aDurTotalSec% / 360000
set /A aDurMM=(%aDurTotalSec% - %aDurHH%*360000) / 6000
set /A aDurSS=(%aDurTotalSec% - %aDurHH%*360000 - %aDurMM%*6000) / 100
if %aDurHH% LSS 10 set aDurHH=0%aDurHH%
if %aDurMM% LSS 10 set aDurMM=0%aDurMM%
if %aDurSS% LSS 10 set aDurSS=0%aDurSS%
set "DURATION=%aDurHH%:%aDurMM%:%aDurSS%"
goto :eof

126
adm/scripts/wasm_build.sh Executable file
View File

@@ -0,0 +1,126 @@
#!/bin/bash
# Auxiliary script for semi-automated building of OCCT for WASM platform.
# wasm_custom.sh should be configured with paths to CMake, 3rd-parties and Emscripten SDK.
# FreeType should be specified as mandatory dependency.
export aScriptDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
export aSrcRoot="${aScriptDir}/../.."
export aBuildRoot=work
export aNbJobs=${NUMBER_OF_PROCESSORS}
export toCMake=1
export toClean=0
export toMake=1
export toInstall=1
export BUILD_ModelingData=ON
export BUILD_ModelingAlgorithms=ON
export BUILD_Visualization=ON
export BUILD_ApplicationFramework=ON
export BUILD_DataExchange=ON
if [ -f "${aScriptDir}/wasm_custom.sh" ] ; then
. "${aScriptDir}/wasm_custom.sh"
fi
. "${EMSDK_ROOT}/emsdk_env.sh"
export aToolchain="${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
export aGitBranch=`git symbolic-ref --short HEAD`
echo "Compilation OCCT branch : $aGitBranch"
export aPlatformAndCompiler=wasm
export aWorkDir="${aSrcRoot}/${aBuildRoot}/${aPlatformAndCompiler}-make"
if [ ! -d "${aWorkDir}" ]; then
mkdir -p "${aWorkDir}"
fi
export aDestDir="${aSrcRoot}/${aBuildRoot}/${aPlatformAndCompiler}"
if [ ! -d "${aDestDir}" ]; then
mkdir -p "${aDestDir}"
fi
export aLogFile="${aSrcRoot}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
if [ -f "${aLogFile}" ]; then
rm "${aLogFile}"
fi
echo Start building OCCT for ${aPlatformAndCompiler}
echo Start building OCCT for ${aPlatformAndCompiler}>> "${aLogFile}"
pushd "${aWorkDir}"
pwd
echo toCMake=${toCMake}
if [ "${toCMake}" = "1" ]; then
echo "Configuring OCCT for WASM..."
echo cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="${aToolchain}" \
-DCMAKE_BUILD_TYPE:STRING="Release" \
-DBUILD_LIBRARY_TYPE:STRING="Static" \
-DINSTALL_DIR:PATH="${aDestDir}" \
-DINSTALL_DIR_INCLUDE:STRING="inc" \
-DINSTALL_DIR_RESOURCE:STRING="src" \
-D3RDPARTY_FREETYPE_DIR:PATH="$aFreeType" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \
-DBUILD_MODULE_FoundationClasses:BOOL="ON" \
-DBUILD_MODULE_ModelingData:BOOL="${BUILD_ModelingData}" \
-DBUILD_MODULE_ModelingAlgorithms:BOOL="${BUILD_ModelingAlgorithms}" \
-DBUILD_MODULE_Visualization:BOOL="${BUILD_Visualization}" \
-DBUILD_MODULE_ApplicationFramework:BOOL="${BUILD_ApplicationFramework}" \
-DBUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \
-DBUILD_MODULE_Draw:BOOL="OFF" \
-DBUILD_DOC_Overview:BOOL="OFF" "${aSrcRoot}"
cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="${aToolchain}" \
-DCMAKE_BUILD_TYPE:STRING="Release" \
-DBUILD_LIBRARY_TYPE:STRING="Static" \
-DINSTALL_DIR:PATH="${aDestDir}" \
-DINSTALL_DIR_INCLUDE:STRING="inc" \
-DINSTALL_DIR_RESOURCE:STRING="src" \
-D3RDPARTY_FREETYPE_DIR:PATH="$aFreeType" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \
-DBUILD_MODULE_FoundationClasses:BOOL="ON" \
-DBUILD_MODULE_ModelingData:BOOL="${BUILD_ModelingData}" \
-DBUILD_MODULE_ModelingAlgorithms:BOOL="${BUILD_ModelingAlgorithms}" \
-DBUILD_MODULE_Visualization:BOOL="${BUILD_Visualization}" \
-DBUILD_MODULE_ApplicationFramework:BOOL="${BUILD_ApplicationFramework}" \
-DBUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \
-DBUILD_MODULE_Draw:BOOL="OFF" \
-DBUILD_DOC_Overview:BOOL="OFF" "${aSrcRoot}"
if [ $? -ne 0 ]; then
echo "Problem during configuration"
popd
exit 1
fi
fi
if [ "${toClean}" = "1" ]; then
make clean
fi
if [ "${toMake}" = "1" ]; then
echo Building...
make -j ${aNbJobs} 2>> "${aLogFile}"
if [ $? -ne 0 ]; then
echo "Problem during make operation"
popd
exit 1
fi
echo "${aLogFile}"
fi
if [ "${toInstall}" = "1" ]; then
echo Installing into ${aDestDir}
make install 2>> "${aLogFile}"
fi
popd

View File

@@ -0,0 +1,16 @@
rem Environment configuration template for occ_build_wasm.bat (to be renamed as wasm_custom_env.bat)
set "aFreeType=%aSrcRoot%\..\3rdparty\freetype-2.7.1-wasm"
set "EMSDK_ROOT=%aSrcRoot%\..\emsdk"
rem Uncomment to customize building steps
rem set "aBuildRoot=work"
rem set "toCMake=1"
rem set "toClean=0"
rem set "toMake=1"
rem set "toInstall=1"
rem set "BUILD_ModelingData=ON"
rem set "BUILD_ModelingAlgorithms=ON"
rem set "BUILD_Visualization=ON"
rem set "BUILD_ApplicationFramework=ON"
rem set "BUILD_DataExchange=ON"

View File

@@ -0,0 +1,16 @@
# environment configuration template for occ_build_wasm.sh (to be renamed as wasm_custom_env.sh)
export aFreeType="$aSrcRoot/../3rdparty/freetype-2.7.1-wasm"
export EMSDK_ROOT="$aSrcRoot/../emsdk"
# Uncomment to customize building steps
#export aBuildRoot=work
#export toCMake=1
#export toClean=0
#export toMake=1
#export toInstall=1
#export BUILD_ModelingData=ON
#export BUILD_ModelingAlgorithms=ON
#export BUILD_Visualization=ON
#export BUILD_ApplicationFramework=ON
#export BUILD_DataExchange=ON

View File

@@ -21,6 +21,7 @@ set (OpenCASCADE_DEVELOPMENT_VERSION "@OCC_VERSION_DEVELOPMENT@")
# This is made to support different locations of CMake files:
# - in UNIX style: $INSTALL_DIR/lib/cmake/opencascade-<version>
# - in Windows style: $INSTALL_DIR/cmake
# - in Android style: $INSTALL_DIR/libs/$CMAKE_ANDROID_ARCH_ABI/cmake/opencascade-<version>
get_filename_component (OpenCASCADE_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component (OpenCASCADE_INSTALL_PREFIX "${OpenCASCADE_INSTALL_PREFIX}" PATH)
if (OpenCASCADE_INSTALL_PREFIX MATCHES "/cmake$")
@@ -29,6 +30,10 @@ endif()
if (OpenCASCADE_INSTALL_PREFIX MATCHES "/lib$")
get_filename_component (OpenCASCADE_INSTALL_PREFIX "${OpenCASCADE_INSTALL_PREFIX}" PATH)
endif()
if (OpenCASCADE_INSTALL_PREFIX MATCHES "/libs/${CMAKE_ANDROID_ARCH_ABI}$")
get_filename_component (OpenCASCADE_INSTALL_PREFIX "${OpenCASCADE_INSTALL_PREFIX}" PATH)
get_filename_component (OpenCASCADE_INSTALL_PREFIX "${OpenCASCADE_INSTALL_PREFIX}" PATH)
endif()
# Set OpenCASCADE paths to headers, binaries, libraries, resources, tests, samples, data
set (OpenCASCADE_BINARY_DIR "${OpenCASCADE_INSTALL_PREFIX}/@INSTALL_DIR_BIN@")

38
adm/templates/build.bat Normal file
View File

@@ -0,0 +1,38 @@
@echo off
setlocal
rem Setup environment
call "%~dp0env.bat" %1 %2 %3
rem Define path to project file
set "PRJFILE=%~dp0OCCT.sln"
if "%VCVER%" == "vc8" (
call "%VS80COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc9" (
call "%VS90COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc10" (
call "%VS100COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc11" (
call "%VS110COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc12" (
call "%VS120COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc14" (
call "%VS140COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc141" (
call "%VS141COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc142" (
call "%VS142COMNTOOLS%/vsvars32.bat" > nul
) else (
echo Error: wrong VS identifier
exit /B
)
set BUILDCONFIG=Release
if "%CASDEB%"=="i" set BUILDCONFIG=RelWithDebInfo
if "%CASDEB%"=="d" set BUILDCONFIG=Debug
if "%ARCH%"=="32" set PLATFORM=win32
if "%ARCH%"=="64" set PLATFORM=x64
msbuild "%PRJFILE%" /m /fl /flp:LogFile="build_%BUILDCONFIG%.log" /p:Configuration=%BUILDCONFIG% /p:Platform=%PLATFORM% /p:BuildProjectReferences=false
endlocal

38
adm/templates/install.bat Normal file
View File

@@ -0,0 +1,38 @@
@echo off
setlocal
rem Setup environment
call "%~dp0env.bat" %1 %2 %3
rem Define path to project file
set "PRJFILE=%~dp0INSTALL.vcxproj"
if "%VCVER%" == "vc8" (
call "%VS80COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc9" (
call "%VS90COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc10" (
call "%VS100COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc11" (
call "%VS110COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc12" (
call "%VS120COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc14" (
call "%VS140COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc141" (
call "%VS141COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc142" (
call "%VS142COMNTOOLS%/vsvars32.bat" > nul
) else (
echo Error: wrong VS identifier
exit /B
)
set BUILDCONFIG=Release
if "%CASDEB%"=="i" set BUILDCONFIG=RelWithDebInfo
if "%CASDEB%"=="d" set BUILDCONFIG=Debug
if "%ARCH%"=="32" set PLATFORM=win32
if "%ARCH%"=="64" set PLATFORM=x64
msbuild "%PRJFILE%" /m /fl /flp:LogFile="install_%BUILDCONFIG%.log" /p:Configuration=%BUILDCONFIG% /p:Platform=%PLATFORM% /p:BuildProjectReferences=false
endlocal

View File

@@ -1980,6 +1980,10 @@ Previously, sub-classes of *Message_Printer* have to provide a triplet of *Messa
*Message_Printer* interface has been changed, so that sub-classes now have to implement only single method *Message_Printer::send()* accepting TCollection_AsciiString argument and having no Endl flag, which has been removed.
Old three Message_Printer::Send() methods remain defined virtual with unused last argument and redirecting to new send() method by default.
@subsection upgrade_750_prd3d_root Prs3d_Root deprecation
Redundant class Prs3d_Root has been marked as deprecated - Prs3d_Presentation::NewGroup() should be called directly.
@subsection upgrade_750_draw_hotkeys Draw Harness hotkeys
Draw Harness hotkeys **W** (Wireframe) and **S** (Shaded) have been re-mapped to **Ctrl+W** and **Ctrl+S**.

View File

@@ -30,7 +30,7 @@ void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& ,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer )
{
Handle(Graphic3d_Group) aPrsGroup = Prs3d_Root::CurrentGroup (thePrs);
Handle(Graphic3d_Group) aPrsGroup = thePrs->CurrentGroup();
aPrsGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());
aPrsGroup->SetGroupPrimitivesAspect (myDrawer->PointAspect()->Aspect());

View File

@@ -84,10 +84,10 @@ void ISession_Direction::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments (2);
aPrims->AddVertex (myPnt);
aPrims->AddVertex (aLastPoint);
Prs3d_Root::CurrentGroup (aPresentation)->SetPrimitivesAspect (myDrawer->LineAspect()->Aspect());
Prs3d_Root::CurrentGroup (aPresentation)->AddPrimitiveArray (aPrims);
aPresentation->CurrentGroup()->SetPrimitivesAspect (myDrawer->LineAspect()->Aspect());
aPresentation->CurrentGroup()->AddPrimitiveArray (aPrims);
// Draw arrow
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation),
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(),
aLastPoint,
myDir,
anArrowAspect->Angle(),
@@ -97,7 +97,7 @@ void ISession_Direction::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
if (myText.Length() != 0)
{
gp_Pnt aTextPosition = aLastPoint;
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (aPresentation),
Prs3d_Text::Draw (aPresentation->CurrentGroup(),
myDrawer->TextAspect(),
myText,
aTextPosition);

View File

@@ -214,7 +214,6 @@
#include <Precision.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_Text.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_IsoAspect.hxx>

View File

@@ -42,10 +42,10 @@ void ISession_Direction::Compute(const Handle(PrsMgr_PresentationManager3d)& /*a
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments (2);
aPrims->AddVertex (myStartPnt);
aPrims->AddVertex (myEndPnt);
Prs3d_Root::CurrentGroup (aPresentation)->SetPrimitivesAspect (myDrawer->LineAspect()->Aspect());
Prs3d_Root::CurrentGroup (aPresentation)->AddPrimitiveArray (aPrims);
aPresentation->CurrentGroup()->SetPrimitivesAspect (myDrawer->LineAspect()->Aspect());
aPresentation->CurrentGroup()->AddPrimitiveArray (aPrims);
// Draw arrow
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation),
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(),
myEndPnt,
gp_Dir (gp_Vec(myStartPnt, myEndPnt)),
anArrowAspect->Angle(),

View File

@@ -126,7 +126,6 @@
#include <Plate_GtoCConstraint.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Root.hxx>
#include <GeomPlate_Surface.hxx>
#include <GeomProjLib.hxx>
#include <GCE2d_MakeSegment.hxx>

View File

@@ -46,7 +46,7 @@ void Sample2D_Face::DrawMarker(const Handle(Geom2d_TrimmedCurve)& theCurve, cons
anArrow->AddVertex(aPoint);
anArrow->AddVertex(aRight);
Prs3d_Root::CurrentGroup(thePresentation)->AddPrimitiveArray(anArrow);
thePresentation->CurrentGroup()->AddPrimitiveArray(anArrow);
}
}
@@ -212,19 +212,19 @@ void Sample2D_Face::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
{
case TopAbs_FORWARD: {
Prs3d_Root::CurrentGroup(thePresentation)->SetPrimitivesAspect(aLineAspect_FORWARD);
thePresentation->CurrentGroup()->SetPrimitivesAspect(aLineAspect_FORWARD);
DrawMarker(aTrimmedCurve, thePresentation);
break;
}
case TopAbs_REVERSED: {
Prs3d_Root::CurrentGroup(thePresentation)->SetPrimitivesAspect(aLineAspect_REVERSED);
thePresentation->CurrentGroup()->SetPrimitivesAspect(aLineAspect_REVERSED);
DrawMarker(aTrimmedCurve, thePresentation);
break;
}
case TopAbs_INTERNAL: {
Prs3d_Root::CurrentGroup(thePresentation)->SetPrimitivesAspect(aLineAspect_INTERNAL);
thePresentation->CurrentGroup()->SetPrimitivesAspect(aLineAspect_INTERNAL);
DrawMarker(aTrimmedCurve, thePresentation);
mySeq_INTERNAL.Append(aCurve3d);
@@ -232,7 +232,7 @@ void Sample2D_Face::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
}
case TopAbs_EXTERNAL: {
Prs3d_Root::CurrentGroup(thePresentation)->SetPrimitivesAspect(aLineAspect_EXTERNAL);
thePresentation->CurrentGroup()->SetPrimitivesAspect(aLineAspect_EXTERNAL);
DrawMarker(aTrimmedCurve, thePresentation);
break;
}
@@ -242,17 +242,17 @@ void Sample2D_Face::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
ex.Next();
}
//add all primitives to the presentation
Prs3d_Root::CurrentGroup(thePresentation)->SetPrimitivesAspect(aLineAspect_FORWARD);
Prs3d_Root::CurrentGroup(thePresentation)->AddPrimitiveArray(myForwardArray);
thePresentation->CurrentGroup()->SetPrimitivesAspect(aLineAspect_FORWARD);
thePresentation->CurrentGroup()->AddPrimitiveArray(myForwardArray);
Prs3d_Root::CurrentGroup(thePresentation)->SetPrimitivesAspect(aLineAspect_REVERSED);
Prs3d_Root::CurrentGroup(thePresentation)->AddPrimitiveArray(myReversedArray);
thePresentation->CurrentGroup()->SetPrimitivesAspect(aLineAspect_REVERSED);
thePresentation->CurrentGroup()->AddPrimitiveArray(myReversedArray);
Prs3d_Root::CurrentGroup(thePresentation)->SetPrimitivesAspect(aLineAspect_INTERNAL);
Prs3d_Root::CurrentGroup(thePresentation)->AddPrimitiveArray(myInternalArray);
thePresentation->CurrentGroup()->SetPrimitivesAspect(aLineAspect_INTERNAL);
thePresentation->CurrentGroup()->AddPrimitiveArray(myInternalArray);
Prs3d_Root::CurrentGroup(thePresentation)->SetPrimitivesAspect(aLineAspect_EXTERNAL);
Prs3d_Root::CurrentGroup(thePresentation)->AddPrimitiveArray(myExternalArray);
thePresentation->CurrentGroup()->SetPrimitivesAspect(aLineAspect_EXTERNAL);
thePresentation->CurrentGroup()->AddPrimitiveArray(myExternalArray);
}
//Method for advanced customizable selection of picked object
@@ -275,8 +275,7 @@ void Sample2D_Face::HilightSelected
aSelectionPrs->Clear();
FillData();
Prs3d_Root::NewGroup ( aSelectionPrs );
Handle (Graphic3d_Group) aSelectGroup = Prs3d_Root::CurrentGroup ( aSelectionPrs);
Handle (Graphic3d_Group) aSelectGroup = aSelectionPrs->NewGroup();
for(Standard_Integer i=1; i<=aLength; ++i)
{
@@ -344,8 +343,7 @@ void Sample2D_Face::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationMana
FillData();
//Direct highlighting
Prs3d_Root::NewGroup ( aHighlightPrs );
Handle (Graphic3d_Group) aHilightGroup = Prs3d_Root::CurrentGroup(aHighlightPrs);
Handle (Graphic3d_Group) aHilightGroup = aHighlightPrs->NewGroup();
Handle(Graphic3d_AspectLine3d) aLineAspect =
new Graphic3d_AspectLine3d(theStyle->Color(), Aspect_TOL_SOLID,2);
switch(theOwner->Priority())

View File

@@ -43,15 +43,15 @@ void Sample2D_Markers::Compute (const Handle(PrsMgr_PresentationManager3d)& /*aP
if(myMarkerType == Aspect_TOM_USERDEFINED)
{
Handle(Graphic3d_AspectMarker3d) aMarker = new Graphic3d_AspectMarker3d(Aspect_TOM_POINT,myColor,myIndex);
Prs3d_Root::CurrentGroup(aPresentation)->SetGroupPrimitivesAspect(aMarker);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (myArrayOfPoints);
aPresentation->CurrentGroup()->SetGroupPrimitivesAspect(aMarker);
aPresentation->CurrentGroup()->AddPrimitiveArray (myArrayOfPoints);
}
else
{
Handle(Graphic3d_AspectMarker3d) aMarker = new Graphic3d_AspectMarker3d(myMarkerType,myColor,myIndex);
Prs3d_Root::CurrentGroup (aPresentation)->SetPrimitivesAspect(aMarker);
aPresentation->CurrentGroup()->SetPrimitivesAspect(aMarker);
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (myXPosition, myYPosition, 0);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
aPresentation->CurrentGroup()->AddPrimitiveArray (anArrayOfPoints);
}
}

View File

@@ -66,7 +66,6 @@
#include <gp_Pnt2d.hxx>
#include <OpenGl_GraphicDriver.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_IsoAspect.hxx>
#include <Prs3d_ShadingAspect.hxx>

View File

@@ -76,7 +76,7 @@ case 6: //color
Handle(Graphic3d_StructureManager) aStrucMana = GetContext()->MainPrsMgr()->StructureManager();
Handle(Graphic3d_Group) mygroup = Prs3d_Root::CurrentGroup(aPresentation);
Handle(Graphic3d_Group) mygroup = aPresentation->CurrentGroup();
myAspect = (new Prs3d_ShadingAspect())->Aspect();
Graphic3d_MaterialAspect material = myAspect->FrontMaterial();
material.SetAmbientColor (Quantity_NOC_BLACK);
@@ -281,7 +281,7 @@ case 6: //color
} // end of "if the triangle is valid
} // end of the "parcours" of the triangles
Prs3d_Root::CurrentGroup (aPresentation)->AddPrimitiveArray (aOP);
aPresentation->CurrentGroup()->AddPrimitiveArray (aOP);
mygroup->SetGroupPrimitivesAspect(myAspect);
}// end of the exploration of the shape in faces

View File

@@ -28,7 +28,6 @@
#include <Graphic3d_ArrayOfTriangles.hxx>
#include <Graphic3d_Text.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Prs3d_Text.hxx>
#include <Prs3d_TextAspect.hxx>

View File

@@ -33,7 +33,6 @@
#include <Prs3d_IsoAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Prs3d_Root.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <Standard_ErrorHandler.hxx>
#include <StdSelect_BRepSelectionTool.hxx>

View File

@@ -21,7 +21,6 @@
#include <gce_MakeDir.hxx>
#include <IntAna_IntConicQuad.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Prs3d_ToolDisk.hxx>
#include <Prs3d_ToolSector.hxx>
@@ -1213,7 +1212,8 @@ void AIS_Manipulator::Disk::Init (const Standard_ShortReal theInnerRadius,
gp_Ax3 aSystem (myPosition.Location(), myPosition.Direction());
gp_Trsf aTrsf;
aTrsf.SetTransformation (aSystem, gp_Ax3());
aTool.FillArray (myArray, myTriangulation, aTrsf);
myArray = aTool.CreateTriangulation (aTrsf);
myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
}
//=======================================================================
@@ -1232,7 +1232,8 @@ void AIS_Manipulator::Sphere::Init (const Standard_ShortReal theRadius,
Prs3d_ToolSphere aTool (theRadius, theSlicesNb, theStacksNb);
gp_Trsf aTrsf;
aTrsf.SetTranslation (gp_Vec(gp::Origin(), thePosition));
aTool.FillArray (myArray, myTriangulation, aTrsf);
myArray = aTool.CreateTriangulation (aTrsf);
myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
}
//=======================================================================
@@ -1268,24 +1269,24 @@ void AIS_Manipulator::Cube::Init (const gp_Ax1& thePosition, const Standard_Shor
addTriangle (1, aBottomLeft, aV3, aV4, -thePosition.Direction());
// Front
addTriangle (2, aV3, aV4, aV5, aFront);
addTriangle (3, aV3, aV5, aTopRight, aFront);
addTriangle (2, aV3, aV5, aV4, -aFront);
addTriangle (3, aV3, aTopRight, aV5, -aFront);
// Back
addTriangle (4, aBottomLeft, aV2, aV7, -aFront);
addTriangle (5, aBottomLeft, aV7, aV6, -aFront);
addTriangle (4, aBottomLeft, aV7, aV2, aFront);
addTriangle (5, aBottomLeft, aV6, aV7, aFront);
// aTop
addTriangle (6, aV7, aV6, aV5, thePosition.Direction());
addTriangle (7, aTopRight, aV7, aV5, thePosition.Direction());
//Left
addTriangle (8, aV6, aV5, aV4, -aRight);
addTriangle (9, aBottomLeft, aV6, aV4, -aRight);
// Left
addTriangle (8, aV6, aV4, aV5, aRight);
addTriangle (9, aBottomLeft, aV4, aV6, aRight);
// Right
addTriangle (10, aV3, aTopRight, aV7, aRight);
addTriangle (11, aV3, aV7, aV2, aRight);
addTriangle (10, aV3, aV7, aTopRight, -aRight);
addTriangle (11, aV3, aV2, aV7, -aRight);
}
//=======================================================================
@@ -1322,7 +1323,8 @@ void AIS_Manipulator::Sector::Init (const Standard_ShortReal theRadius,
gp_Ax3 aSystem(thePosition.Location(), thePosition.Direction(), theXDirection);
gp_Trsf aTrsf;
aTrsf.SetTransformation(aSystem, gp_Ax3());
aTool.FillArray(myArray, myTriangulation, aTrsf);
myArray = aTool.CreateTriangulation (aTrsf);
myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
}
//=======================================================================
@@ -1374,7 +1376,8 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
myAxisRadius * 1.5,
anArrowLength,
myFacettesNumber);
myTranslatorGroup = thePrs->NewGroup ();
myTranslatorGroup = thePrs->NewGroup();
myTranslatorGroup->SetClosed (true);
myTranslatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
myTranslatorGroup->AddPrimitiveArray (myTriangleArray);
@@ -1387,7 +1390,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
myHighlightTranslator->Clear();
}
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightTranslator);
Handle(Graphic3d_Group) aGroup = myHighlightTranslator->CurrentGroup();
aGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
aGroup->AddPrimitiveArray (myTriangleArray);
}
@@ -1398,7 +1401,8 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
myCubePos = myReferenceAxis.Direction().XYZ() * (myLength + myIndent);
myCube.Init (gp_Ax1 (myCubePos, myReferenceAxis.Direction()), myBoxSize);
myScalerGroup = thePrs->NewGroup ();
myScalerGroup = thePrs->NewGroup();
myScalerGroup->SetClosed (true);
myScalerGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
myScalerGroup->AddPrimitiveArray (myCube.Array());
@@ -1411,7 +1415,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
myHighlightScaler->Clear();
}
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightScaler);
Handle(Graphic3d_Group) aGroup = myHighlightScaler->CurrentGroup();
aGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
aGroup->AddPrimitiveArray (myCube.Array());
}
@@ -1434,7 +1438,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
myHighlightRotator->Clear();
}
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightRotator);
Handle(Graphic3d_Group) aGroup = myHighlightRotator->CurrentGroup();
aGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
aGroup->AddPrimitiveArray (myCircle.Array());
}
@@ -1466,7 +1470,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
myHighlightDragger->Clear();
}
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(myHighlightDragger);
Handle(Graphic3d_Group) aGroup = myHighlightDragger->CurrentGroup();
aGroup->SetGroupPrimitivesAspect(aFillArea);
aGroup->AddPrimitiveArray(mySector.Array());
}

View File

@@ -258,7 +258,7 @@ void AIS_Plane::Compute(const Handle(PrsMgr_PresentationManager3d)& ,
{
ComputeFrame();
Handle(Prs3d_PlaneAspect) theaspect = myDrawer->PlaneAspect();
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
Handle(Graphic3d_Group) TheGroup = aPresentation->CurrentGroup();
TheGroup->SetPrimitivesAspect(myDrawer->ShadingAspect()->Aspect());
gp_Pnt p1;
const Standard_Real Xmax = 0.5*Standard_Real(theaspect->PlaneXLength());

View File

@@ -91,7 +91,7 @@ void AIS_Point::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
StdPrs_Point::Add(aPresentation,myComponent,myDrawer);
else if (aMode== -99)
{
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
Handle(Graphic3d_Group) TheGroup = aPresentation->CurrentGroup();
TheGroup->SetPrimitivesAspect (myHilightDrawer->PointAspect()->Aspect());
Handle(Graphic3d_ArrayOfPoints) aPoint = new Graphic3d_ArrayOfPoints (1);
aPoint->AddVertex (myComponent->X(),myComponent->Y(),myComponent->Z());

View File

@@ -22,7 +22,6 @@
#include <Prs3d_Drawer.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <PrsMgr_Presentations.hxx>
#include <Select3D_SensitiveBox.hxx>

View File

@@ -24,7 +24,6 @@
#include <Graphic3d_TransModeFlags.hxx>
#include <Graphic3d_ZLayerId.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <V3d_Viewer.hxx>

View File

@@ -42,7 +42,6 @@
#include <Prs3d_Drawer.hxx>
#include <Prs3d_IsoAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Prs3d_BndBox.hxx>
#include <StdPrs_ToolTriangulatedShape.hxx>

View File

@@ -299,7 +299,7 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
if (myHasFlipping)
{
gp_Ax2 aFlippingAxes (aCenterOfLabel, myOrientation3D.Direction(), myOrientation3D.XDirection());
Prs3d_Root::CurrentGroup (thePrs)->SetFlippingOptions (Standard_True, aFlippingAxes);
thePrs->CurrentGroup()->SetFlippingOptions (Standard_True, aFlippingAxes);
}
gp_Ax2 anOrientation = myOrientation3D;
anOrientation.SetLocation (aPosition);
@@ -308,15 +308,15 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
{
aHasOwnAnchor = Standard_False; // always not using own anchor if flipping
}
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (thePrs), anAsp, myText, anOrientation, aHasOwnAnchor);
Prs3d_Text::Draw (thePrs->CurrentGroup(), anAsp, myText, anOrientation, aHasOwnAnchor);
if (myHasFlipping && isInit)
{
Prs3d_Root::CurrentGroup (thePrs)->SetFlippingOptions (Standard_False, gp_Ax2());
thePrs->CurrentGroup()->SetFlippingOptions (Standard_False, gp_Ax2());
}
}
else
{
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (thePrs), anAsp, myText, aPosition);
Prs3d_Text::Draw (thePrs->CurrentGroup(), anAsp, myText, aPosition);
}
if (isInit)
@@ -328,7 +328,7 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
gp_Pnt aMinPnt = gp_Pnt (-aDx, -aDy, 0.0).Transformed (aLabelPlane);
gp_Pnt aMaxPnt = gp_Pnt ( aDx, aDy, 0.0).Transformed (aLabelPlane);
Graphic3d_BndBox4f& aBox = Prs3d_Root::CurrentGroup (thePrs)->ChangeBoundingBox();
Graphic3d_BndBox4f& aBox = thePrs->CurrentGroup()->ChangeBoundingBox();
aBox.Add (Graphic3d_Vec4 ((float) aMinPnt.X(), (float) aMinPnt.Y(), (float) aMinPnt.Z(), 1.0));
aBox.Add (Graphic3d_Vec4 ((float) aMaxPnt.X(), (float) aMaxPnt.Y(), (float) aMaxPnt.Z(), 1.0));
}

View File

@@ -28,7 +28,6 @@
#include <Precision.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <PrsMgr_PresentationManager3d.hxx>

View File

@@ -11,14 +11,14 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <AIS_DisplayMode.hxx>
#include <AIS_Triangulation.hxx>
#include <AIS_DisplayMode.hxx>
#include <AIS_InteractiveObject.hxx>
#include <Standard_Type.hxx>
#include <Poly_Array1OfTriangle.hxx>
#include <Poly_Triangulation.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <TShort_Array1OfShortReal.hxx>
#include <TColgp_Array1OfPnt.hxx>
@@ -131,7 +131,7 @@ void AIS_Triangulation::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aP
Handle(Graphic3d_ArrayOfTriangles) anArray = new Graphic3d_ArrayOfTriangles (myNbNodes, myNbTriangles * 3,
hasVNormals, hasVColors, Standard_False);
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
Handle(Graphic3d_Group) TheGroup = aPresentation->CurrentGroup();
Handle(Graphic3d_AspectFillArea3d) aspect = myDrawer->ShadingAspect()->Aspect();
Standard_Integer i;

View File

@@ -298,7 +298,7 @@ void AIS_Trihedron::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManag
aPresentation->Clear();
const Prs3d_DatumParts aPart = anOwner->DatumPart();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPresentation);
Handle(Graphic3d_Group) aGroup = aPresentation->CurrentGroup();
if (aPart >= Prs3d_DP_XOYAxis && aPart <= Prs3d_DP_XOZAxis)
{
// planes selection is equal in both shading and wireframe mode
@@ -443,7 +443,7 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager
// display origin
{
// Origin is visualized only in shading mode
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePrs);
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
const Prs3d_DatumParts aPart = Prs3d_DP_Origin;
if (anAspect->DrawDatumPart(aPart))
{
@@ -470,7 +470,7 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager
continue;
}
Handle(Graphic3d_Group) anAxisGroup = Prs3d_Root::NewGroup (thePrs);
Handle(Graphic3d_Group) anAxisGroup = thePrs->NewGroup();
myPartToGroup.Bind (aPart, anAxisGroup);
if (isShadingMode)
{
@@ -489,7 +489,7 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager
continue;
}
Handle(Graphic3d_Group) anArrowGroup = Prs3d_Root::NewGroup (thePrs);
Handle(Graphic3d_Group) anArrowGroup = thePrs->NewGroup();
anArrowGroup->SetGroupPrimitivesAspect (anAspect->ArrowAspect()->Aspect());
anArrowGroup->AddPrimitiveArray (arrayOfPrimitives (anArrowPart));
}
@@ -518,7 +518,7 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager
case Prs3d_DP_ZAxis: aDir = aComponent->Direction(); break;
default: break;
}
Handle(Graphic3d_Group) aLabelGroup = Prs3d_Root::NewGroup (thePrs);
Handle(Graphic3d_Group) aLabelGroup = thePrs->NewGroup();
const gp_Pnt aPoint = anOrigin.XYZ() + aDir.XYZ() * anAxisLength;
Prs3d_Text::Draw (aLabelGroup, anAspect->TextAspect(), aLabel, aPoint);
}
@@ -533,7 +533,7 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager
continue;
}
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePrs);
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
myPartToGroup.Bind (aPart, aGroup);
aGroup->AddPrimitiveArray (arrayOfPrimitives (aPart));

View File

@@ -24,7 +24,6 @@
#include <Prs3d.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_DatumAspect.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_Text.hxx>
#include <Prs3d_ToolDisk.hxx>
#include <Prs3d_ToolSphere.hxx>
@@ -599,6 +598,7 @@ void AIS_ViewCube::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
}
Handle(Graphic3d_Group) anAxisGroup = thePrs->NewGroup();
anAxisGroup->SetClosed (true);
anAxisGroup->SetGroupPrimitivesAspect (aDatumAspect->ShadingAspect (aPart)->Aspect());
const Standard_Real anArrowLength = 0.2 * anAxisSize;
@@ -621,6 +621,7 @@ void AIS_ViewCube::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
// Display center
{
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
aGroup->SetClosed (true);
Handle(Prs3d_ShadingAspect) anAspectCen = new Prs3d_ShadingAspect();
anAspectCen->SetColor (Quantity_NOC_WHITE);
aGroup->SetGroupPrimitivesAspect (anAspectCen->Aspect());

View File

@@ -23,6 +23,7 @@
#include <Aspect_Background.hxx>
#include <Quantity_Color.hxx>
#include <Standard_Dump.hxx>
//-Aliases
//-Global data definitions
@@ -56,3 +57,14 @@ Quantity_Color Aspect_Background::Color () const {
return (MyColor);
}
// =======================================================================
// function : DumpJson
// purpose :
// =======================================================================
void Aspect_Background::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_CLASS_BEGIN (theOStream, Aspect_Background)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &MyColor)
}

View File

@@ -46,6 +46,9 @@ public:
//! Returns the colour of the window background <me>.
Standard_EXPORT Quantity_Color Color() const;
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;

View File

@@ -140,3 +140,20 @@ void Aspect_CircularGrid::Init () {
myAlpha = M_PI / Standard_Real(myDivisionNumber);
myA1 = Cos(myAlpha); myB1=Sin(myAlpha);
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Aspect_CircularGrid::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_BASE_CLASS(theOStream, theDepth, Aspect_Grid)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myRadiusStep)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDivisionNumber)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAlpha)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myA1)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myB1)
}

View File

@@ -55,6 +55,9 @@ public:
Standard_EXPORT Standard_Integer DivisionNumber() const;
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
private:

View File

@@ -18,6 +18,8 @@
#include <Aspect_GenId.hxx>
#include <Aspect_IdentDefinitionError.hxx>
#include <Standard_Dump.hxx>
// =======================================================================
// function : Aspect_GenId
// purpose :
@@ -114,3 +116,21 @@ Standard_Boolean Aspect_GenId::Next (Standard_Integer& theId)
theId = myLowerBound + myLength - myFreeCount - 1;
return Standard_True;
}
// =======================================================================
// function : DumpJson
// purpose :
// =======================================================================
void Aspect_GenId::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFreeCount)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLength)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLowerBound)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUpperBound)
for (TColStd_ListOfInteger::Iterator anIter (myFreeIds); anIter.More(); anIter.Next())
{
Standard_Integer aFreeId = anIter.Value();
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aFreeId)
}
}

View File

@@ -72,6 +72,9 @@ public:
//! Returns the upper identifier in range.
Standard_Integer Upper() const { return myUpperBound; }
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
private:

View File

@@ -55,3 +55,18 @@ Aspect_GradientFillMethod Aspect_GradientBackground::BgGradientFillMethod( ) con
{
return MyGradientMethod;
}
// =======================================================================
// function : DumpJson
// purpose :
// =======================================================================
void Aspect_GradientBackground::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_CLASS_BEGIN (theOStream, Aspect_GradientBackground)
Quantity_Color aColor = Color();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aColor)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &MyColor2)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, MyGradientMethod)
}

View File

@@ -51,6 +51,9 @@ public:
//! Returns the current gradient background fill mode.
Standard_EXPORT Aspect_GradientFillMethod BgGradientFillMethod() const;
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;

View File

@@ -104,3 +104,22 @@ void Aspect_Grid::SetDrawMode (const Aspect_GridDrawMode theDrawMode)
myDrawMode = theDrawMode;
UpdateDisplay();
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Aspect_Grid::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myRotationAngle)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myXOrigin)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myYOrigin)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myColor)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myTenthColor)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsActive)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDrawMode)
}

View File

@@ -96,6 +96,9 @@ public:
Standard_EXPORT virtual Standard_Boolean IsDisplayed() const = 0;
Standard_EXPORT virtual void Init() = 0;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
protected:

View File

@@ -155,3 +155,25 @@ Standard_Boolean Aspect_RectangularGrid::CheckAngle(const Standard_Real alpha,
const Standard_Real beta) const {
return (Abs( Sin(alpha) * Cos(beta + M_PI / 2.) - Cos(alpha) * Sin(beta + M_PI / 2.)) != 0) ;
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Aspect_RectangularGrid::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_BASE_CLASS(theOStream, theDepth, Aspect_Grid)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myXStep)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myYStep)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFirstAngle)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySecondAngle)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, a1)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, b1)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, c1)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, a2)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, b2)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, c2)
}

View File

@@ -67,6 +67,9 @@ public:
Standard_EXPORT Standard_Real SecondAngle() const;
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
private:

View File

@@ -92,3 +92,18 @@ void Aspect_Window::SetBackground (const Quantity_Color& theFirstColor,
{
MyGradientBackground.SetColors (theFirstColor, theSecondColor, theFillMethod);
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Aspect_Window::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &MyBackground)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &MyGradientBackground)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, MyBackgroundFillMethod)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, MyIsVirtual)
}

View File

@@ -114,6 +114,9 @@ public:
//! on platforms implementing thread-unsafe connections to display.
//! NULL can be passed instead otherwise.
virtual void InvalidateContent (const Handle(Aspect_DisplayConnection)& theDisp) { (void )theDisp; }
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
DEFINE_STANDARD_RTTIEXT(Aspect_Window,Standard_Transient)

View File

@@ -145,8 +145,7 @@ Standard_Integer BOPAlgo_PaveFiller::MakeSDVertices
Standard_Integer nV;
if (nSD != -1) {
// update old SD vertex with new value
Handle(BRep_TVertex)& aTVertex =
reinterpret_cast<Handle(BRep_TVertex)&>(const_cast<Handle(TopoDS_TShape)&>(aVSD.TShape()));
BRep_TVertex* aTVertex = static_cast<BRep_TVertex*>(aVSD.TShape().get());
aTVertex->Pnt(BRep_Tool::Pnt(aVn));
aTVertex->Tolerance(BRep_Tool::Tolerance(aVn));
aVn = aVSD;

View File

@@ -3328,7 +3328,7 @@ void BOPAlgo_PaveFiller::CorrectToleranceOfSE()
Standard_Real aTolE = BRep_Tool::Tolerance(aE);
if (aTolC < aTolE) {
// reduce edge tolerance
reinterpret_cast<BRep_TEdge*>(aE.TShape().operator->())->Tolerance(aTolC);
static_cast<BRep_TEdge*>(aE.TShape().get())->Tolerance(aTolC);
bIsReduced = Standard_True;
}
}
@@ -3446,7 +3446,7 @@ void BOPAlgo_PaveFiller::CorrectToleranceOfSE()
}
//
if (aMaxTol < aTolV) {
reinterpret_cast<BRep_TVertex*>(aV.TShape().operator->())->Tolerance(aMaxTol);
static_cast<BRep_TVertex*>(aV.TShape().get())->Tolerance(aMaxTol);
}
}
}

View File

@@ -154,7 +154,7 @@ void BRepExtrema_DistShapeShape::DistanceMapMap (const TopTools_IndexedMapOfShap
const TopoDS_Shape& aShape1 = theMap1 (aPair.Index1);
const TopoDS_Shape& aShape2 = theMap2 (aPair.Index2);
BRepExtrema_DistanceSS aDistTool (aShape1, aShape2, aBox1, aBox2, myDistRef, myEps, myFlag);
BRepExtrema_DistanceSS aDistTool (aShape1, aShape2, aBox1, aBox2, myDistRef, myEps);
if (aDistTool.IsDone())
{
if (aDistTool.DistValue() < myDistRef - myEps)
@@ -199,7 +199,8 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape()
myEps (Precision::Confusion()),
myIsInitS1 (Standard_False),
myIsInitS2 (Standard_False),
myFlag (Extrema_ExtFlag_MINMAX)
myFlag (Extrema_ExtFlag_MINMAX),
myAlgo (Extrema_ExtAlgo_Grad)
{
//
}
@@ -210,14 +211,16 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape()
//=======================================================================
BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,
const TopoDS_Shape& Shape2,
const Extrema_ExtFlag F)
const Extrema_ExtFlag F,
const Extrema_ExtAlgo A)
: myDistRef (0.0),
myIsDone (Standard_False),
myInnerSol (Standard_False),
myEps (Precision::Confusion()),
myIsInitS1 (Standard_False),
myIsInitS2 (Standard_False),
myFlag (F)
myFlag (F),
myAlgo (A)
{
LoadS1(Shape1);
LoadS2(Shape2);
@@ -232,14 +235,16 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape
BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,
const TopoDS_Shape& Shape2,
const Standard_Real theDeflection,
const Extrema_ExtFlag F)
const Extrema_ExtFlag F,
const Extrema_ExtAlgo A)
: myDistRef (0.0),
myIsDone (Standard_False),
myInnerSol (Standard_False),
myEps (theDeflection),
myIsInitS1 (Standard_False),
myIsInitS2 (Standard_False),
myFlag (F)
myFlag (F),
myAlgo (A)
{
LoadS1(Shape1);
LoadS2(Shape2);

View File

@@ -18,6 +18,7 @@
#include <BRepExtrema_SeqOfSolution.hxx>
#include <BRepExtrema_SolutionElem.hxx>
#include <BRepExtrema_SupportType.hxx>
#include <Extrema_ExtAlgo.hxx>
#include <Extrema_ExtFlag.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS_Shape.hxx>
@@ -38,9 +39,9 @@ class BRepExtrema_DistShapeShape
Standard_EXPORT BRepExtrema_DistShapeShape();
//! computation of the minimum distance (value and pair of points) using default deflection <br>
//! Default value is Precision::Confusion(). <br>
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Extrema_ExtFlag F = Extrema_ExtFlag_MIN);
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
//! create tool and load both shapes into it <br>
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Standard_Real theDeflection,const Extrema_ExtFlag F = Extrema_ExtFlag_MIN);
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Standard_Real theDeflection,const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
void SetDeflection(const Standard_Real theDeflection)
{
@@ -128,6 +129,11 @@ class BRepExtrema_DistShapeShape
myFlag = F;
}
void SetAlgo(const Extrema_ExtAlgo A)
{
myAlgo = A;
}
private:
//! computes the minimum distance between two maps of shapes (Face,Edge,Vertex) <br>
@@ -150,6 +156,7 @@ private:
Standard_Boolean myIsInitS1;
Standard_Boolean myIsInitS2;
Extrema_ExtFlag myFlag;
Extrema_ExtAlgo myAlgo;
Bnd_SeqOfBox myBV1;
Bnd_SeqOfBox myBV2;
Bnd_SeqOfBox myBE1;

View File

@@ -772,7 +772,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& S1, const TopoDS_Face&
const Standard_Real Dst=B1.Distance(B2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
BRepExtrema_ExtPF Ext(S1,S2,myFlag);
BRepExtrema_ExtPF Ext(S1,S2,myFlag,myAlgo);
const Standard_Integer NbExtrema = Ext.IsDone()? Ext.NbExt() : 0;
if ( NbExtrema > 0 )
{
@@ -828,7 +828,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Vertex&
const Standard_Real Dst=B1.Distance(B2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
BRepExtrema_ExtPF Ext(S2,S1,myFlag);
BRepExtrema_ExtPF Ext(S2,S1,myFlag,myAlgo);
const Standard_Integer NbExtrema = Ext.IsDone()? Ext.NbExt() : 0;
if ( NbExtrema > 0 )
{

View File

@@ -16,6 +16,7 @@
#include <BRepExtrema_SeqOfSolution.hxx>
#include <Extrema_ExtFlag.hxx>
#include <Extrema_ExtAlgo.hxx>
#include <Precision.hxx>
#include <Standard_DefineAlloc.hxx>
@@ -38,8 +39,9 @@ class BRepExtrema_DistanceSS
BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
const Bnd_Box& B1, const Bnd_Box& B2,
const Standard_Real DstRef,
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX)
: myDstRef(DstRef), myModif(Standard_False), myEps(Precision::Confusion()), myFlag(F)
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad)
: myDstRef(DstRef), myModif(Standard_False), myEps(Precision::Confusion()), myFlag(F), myAlgo(A)
{
Perform(S1, S2, B1, B2);
}
@@ -50,8 +52,9 @@ class BRepExtrema_DistanceSS
BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
const Bnd_Box& B1, const Bnd_Box& B2,
const Standard_Real DstRef, const Standard_Real aDeflection,
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX)
: myDstRef(DstRef), myModif(Standard_False), myEps(aDeflection), myFlag(F)
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad)
: myDstRef(DstRef), myModif(Standard_False), myEps(aDeflection), myFlag(F), myAlgo(A)
{
Perform(S1, S2, B1, B2);
}
@@ -80,6 +83,11 @@ class BRepExtrema_DistanceSS
{
myFlag = F;
}
//! sets the flag controlling ...
void SetAlgo(const Extrema_ExtAlgo A)
{
myAlgo = A;
}
private:
@@ -122,6 +130,7 @@ class BRepExtrema_DistanceSS
Standard_Boolean myModif;
Standard_Real myEps;
Extrema_ExtFlag myFlag;
Extrema_ExtAlgo myAlgo;
};
#endif

View File

@@ -32,9 +32,9 @@
//=======================================================================
BRepExtrema_ExtPF::BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex, const TopoDS_Face& TheFace,
const Extrema_ExtFlag TheFlag)
const Extrema_ExtFlag TheFlag, const Extrema_ExtAlgo TheAlgo)
{
Initialize(TheFace,TheFlag);
Initialize(TheFace,TheFlag,TheAlgo);
Perform(TheVertex,TheFace);
}
@@ -44,7 +44,7 @@ BRepExtrema_ExtPF::BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex, const TopoD
//=======================================================================
void BRepExtrema_ExtPF::Initialize(const TopoDS_Face& TheFace,
const Extrema_ExtFlag TheFlag)
const Extrema_ExtFlag TheFlag, const Extrema_ExtAlgo TheAlgo)
{
// cette surface doit etre en champ. Extrema ne fait
// pas de copie et prend seulement un pointeur dessus.
@@ -60,6 +60,7 @@ void BRepExtrema_ExtPF::Initialize(const TopoDS_Face& TheFace,
Standard_Real U1, U2, V1, V2;
BRepTools::UVBounds(TheFace, U1, U2, V1, V2);
myExtPS.SetFlag(TheFlag);
myExtPS.SetAlgo(TheAlgo);
myExtPS.Initialize(mySurf, U1, U2, V1, V2, aTolU, aTolV);
}

View File

@@ -21,6 +21,7 @@
#include <Extrema_SequenceOfPOnSurf.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <Extrema_ExtFlag.hxx>
#include <Extrema_ExtAlgo.hxx>
class TopoDS_Vertex;
class TopoDS_Face;
@@ -37,10 +38,12 @@ class BRepExtrema_ExtPF
{}
//! It calculates all the distances. <br>
Standard_EXPORT BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex,const TopoDS_Face& TheFace,
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX);
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo TheAlgo = Extrema_ExtAlgo_Grad);
Standard_EXPORT void Initialize(const TopoDS_Face& TheFace,
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX);
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo TheAlgo = Extrema_ExtAlgo_Grad);
//! An exception is raised if the fields have not been initialized. <br>
//! Be careful: this method uses the Face only for classify not for the fields. <br>
@@ -76,6 +79,11 @@ class BRepExtrema_ExtPF
myExtPS.SetFlag(F);
}
void SetAlgo(const Extrema_ExtAlgo A)
{
myExtPS.SetAlgo(A);
}
private:
Extrema_ExtPS myExtPS;

View File

@@ -2923,38 +2923,46 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
Standard_Real Extend = 0.0;
if (NbTrous==1) Extend = EvalExtrapol(1, Transition);
isDone = BuildShell(Transition,
1, NbPath+1,
1, NbPath+1,
ReversedEdges,
Tapes, Rails,
Extend, Extend);
Extend, Extend);
}
else { // This is done piece by piece
Standard_Integer IFirst = 1, ILast;
for (ii=1, isDone=Standard_True;
ii<=NbPart && isDone; ii++) {
if (ii > NbTrous) ILast = NbPath+1;
else ILast = Trous->Value(ii);
isDone = BuildShell(Transition,
IFirst, ILast,
ii<=NbPart && isDone; ii++) {
if (ii > NbTrous) ILast = NbPath+1;
else ILast = Trous->Value(ii);
isDone = BuildShell(Transition,
IFirst, ILast,
ReversedEdges,
Tapes, Rails,
EvalExtrapol(IFirst, Transition),
EvalExtrapol(ILast, Transition));
if (IFirst>1) {
Translate(myVEdges, IFirst, Bounds, 2);
PerformCorner(IFirst,
Transition, Bounds);
}
IFirst = ILast;
Translate(myVEdges, IFirst, Bounds, 1);
EvalExtrapol(IFirst, Transition),
EvalExtrapol(ILast, Transition));
if (IFirst>1) {
Translate(myVEdges, IFirst, Bounds, 2);
if (!PerformCorner(IFirst,
Transition, Bounds))
{
isDone = Standard_False;
return;
}
}
IFirst = ILast;
Translate(myVEdges, IFirst, Bounds, 1);
}
}
// Management of looping ends
if ( (NbTrous>0) && (myLoc->IsClosed()) &&
(Trous->Value(NbTrous) == NbPath+1) ) {
(Trous->Value(NbTrous) == NbPath+1) ) {
Translate(myVEdges, NbPath+1, Bounds, 1);
Translate(myVEdges, 1, Bounds, 2);
PerformCorner(1, Transition, Bounds);
if (!PerformCorner(1, Transition, Bounds))
{
isDone = Standard_False;
return;
}
Translate(myVEdges, 1, myVEdges, NbPath+1);
}
@@ -3175,12 +3183,14 @@ TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
//function : PerformCorner
//purpose : Trim and/or loop a corner
//======================================================================
void BRepFill_Sweep::PerformCorner(const Standard_Integer Index,
const BRepFill_TransitionStyle Transition,
const Handle(TopTools_HArray2OfShape)& Bounds)
Standard_Boolean BRepFill_Sweep::PerformCorner(const Standard_Integer Index,
const BRepFill_TransitionStyle Transition,
const Handle(TopTools_HArray2OfShape)& Bounds)
{
if (Transition == BRepFill_Modified) return; // Do nothing.
if (Transition == BRepFill_Modified) return Standard_True; // Do nothing.
const Standard_Real anAngularTol = 0.025;
BRepFill_TransitionStyle TheTransition = Transition;
Standard_Boolean isTangent=Standard_False;
@@ -3226,11 +3236,15 @@ TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
#ifdef OCCT_DEBUG
std::cout << "BRepFill_Sweep::PerformCorner : This is not a corner !" << std::endl;
#endif
return;
return Standard_True;
}
Sortant = t2 - t1;
}
if (T1.Angle(T2) >= M_PI - anAngularTol)
{
return Standard_False;
}
if ((TheTransition == BRepFill_Right)
&& (T1.Angle(T2) > myAngMax) ) {
TheTransition = BRepFill_Round;
@@ -3336,7 +3350,7 @@ TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
#ifdef OCCT_DEBUG
std::cout << "Fail of TrimCorner" << std::endl;
#endif
return; // Nothing is touched
return Standard_True; // Nothing is touched
}
if (mySec->IsUClosed())
@@ -3416,7 +3430,7 @@ TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
#endif
}
}
return Standard_True;
/*
#if DRAW
if (Affich) {

View File

@@ -124,7 +124,7 @@ protected:
Standard_EXPORT Standard_Boolean BuildShell (const BRepFill_TransitionStyle Transition, const Standard_Integer Vf, const Standard_Integer Vl, TopTools_MapOfShape& ReversedEdges, BRepFill_DataMapOfShapeHArray2OfShape& Tapes, BRepFill_DataMapOfShapeHArray2OfShape& Rails, const Standard_Real ExtendFirst = 0.0, const Standard_Real ExtendLast = 0.0);
Standard_EXPORT void PerformCorner (const Standard_Integer Index, const BRepFill_TransitionStyle Transition, const Handle(TopTools_HArray2OfShape)& Bounds);
Standard_EXPORT Standard_Boolean PerformCorner (const Standard_Integer Index, const BRepFill_TransitionStyle Transition, const Handle(TopTools_HArray2OfShape)& Bounds);
Standard_EXPORT Standard_Real EvalExtrapol (const Standard_Integer Index, const BRepFill_TransitionStyle Transition) const;

View File

@@ -23,7 +23,6 @@
#include <BRepLib_MakeFace.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <GCPnts.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
@@ -182,6 +181,39 @@ BRepLib_FindSurface::BRepLib_FindSurface(const TopoDS_Shape& S,
namespace
{
static void fillParams (const TColStd_Array1OfReal& theKnots,
Standard_Integer theDegree,
Standard_Real theParMin,
Standard_Real theParMax,
NCollection_Vector<Standard_Real>& theParams)
{
Standard_Real aPrevPar = theParMin;
theParams.Append (aPrevPar);
Standard_Integer aNbP = Max (theDegree, 1);
for (Standard_Integer i = 1;
(i < theKnots.Length()) && (theKnots (i) < (theParMax - Precision::PConfusion())); ++i)
{
if (theKnots (i + 1) < theParMin + Precision::PConfusion())
continue;
Standard_Real aStep = (theKnots (i + 1) - theKnots (i)) / aNbP;
for (Standard_Integer k = 1; k <= aNbP ; ++k)
{
Standard_Real aPar = theKnots (i) + k * aStep;
if (aPar > theParMax - Precision::PConfusion())
break;
if (aPar > aPrevPar + Precision::PConfusion())
{
theParams.Append (aPar);
aPrevPar = aPar;
}
}
}
theParams.Append (theParMax);
}
static void fillPoints (const BRepAdaptor_Curve& theCurve,
const NCollection_Vector<Standard_Real> theParams,
@@ -329,13 +361,13 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
aKnots.SetValue (1, GC->FirstParameter());
aKnots.SetValue (2, GC->LastParameter());
GCPnts::FillParams (aKnots, GC->Degree(), dfUf, dfUl, aParams);
fillParams (aKnots, GC->Degree(), dfUf, dfUl, aParams);
break;
}
case GeomAbs_BSplineCurve:
{
Handle(Geom_BSplineCurve) GC = c.BSpline();
GCPnts::FillParams (GC->Knots(), GC->Degree(), dfUf, dfUl, aParams);
fillParams (GC->Knots(), GC->Degree(), dfUf, dfUl, aParams);
break;
}
case GeomAbs_Line:
@@ -362,7 +394,7 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
aBounds.SetValue (1, dfUf);
aBounds.SetValue (2, dfUl);
GCPnts::FillParams (aBounds, iNbPoints - 1, dfUf, dfUl, aParams);
fillParams (aBounds, iNbPoints - 1, dfUf, dfUl, aParams);
}
}

View File

@@ -106,6 +106,16 @@ static
TopTools_DataMapOfShapeShape& theOrigins,
TopTools_ListOfShape& theLFImages);
//! Auxiliary structure to contain intersection information
struct BRepOffset_MakeOffset_InterResults
{
TopTools_DataMapOfShapeListOfShape SSInterfs; //!< Intersection information, used to add pair for intersection
NCollection_DataMap <TopoDS_Shape,
BRepOffset_DataMapOfShapeMapOfShape,
TopTools_ShapeMapHasher> InterPairs; //!< All possible intersection pairs, used to avoid
//! some of the intersection
};
static
void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
const TopTools_MapOfShape& theModifiedEdges,
@@ -126,7 +136,7 @@ static
TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
TopTools_DataMapOfShapeListOfShape& theDMFNewHoles,
TopoDS_Shape& theSolids,
TopTools_DataMapOfShapeListOfShape& theSSInterfs);
BRepOffset_MakeOffset_InterResults& theIntRes);
static
void BuildSplitsOfInvFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild,
@@ -263,7 +273,7 @@ static
const TopTools_IndexedMapOfShape& theMFToCheckInt,
const TopTools_IndexedMapOfShape& theMFInvInHole,
const TopoDS_Shape& theFHoles,
TopTools_DataMapOfShapeListOfShape& theSSInterfs,
BRepOffset_MakeOffset_InterResults& theIntRes,
TopTools_IndexedMapOfShape& theMERemoved,
TopTools_IndexedMapOfShape& theMEInside,
TopoDS_Shape& theSolids);
@@ -336,7 +346,7 @@ static
void RebuildFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild,
const TopTools_MapOfShape& theFSelfRebAvoid,
const TopoDS_Shape& theSolids,
const TopTools_DataMapOfShapeListOfShape& theSSInterfs,
const BRepOffset_MakeOffset_InterResults& theIntRes,
const BRepOffset_Analyse* theAnalyse,
TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
TopTools_DataMapOfShapeListOfShape& theDMFNewHoles,
@@ -360,7 +370,7 @@ static
void IntersectFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild,
const TopTools_MapOfShape& theFSelfRebAvoid,
const TopoDS_Shape& theSolids,
const TopTools_DataMapOfShapeListOfShape& theSSInterfs,
const BRepOffset_MakeOffset_InterResults& theIntRes,
TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
TopTools_DataMapOfShapeListOfShape& theEdgesOrigins,
TopTools_DataMapOfShapeListOfShape& theOEImages,
@@ -723,7 +733,7 @@ void BRepOffset_MakeOffset::BuildSplitsOfExtendedFaces(const TopTools_ListOfShap
// but may be filled on the following rebuilding steps
TopTools_DataMapOfShapeShape anArtInvFaces;
// shapes connections for using in rebuilding
TopTools_DataMapOfShapeListOfShape aSSInterfs;
BRepOffset_MakeOffset_InterResults aIntRes;
// edges to avoid on second steps
TopTools_MapOfShape aLastInvEdges;
// keep information of already invalid faces to avoid
@@ -737,18 +747,18 @@ void BRepOffset_MakeOffset::BuildSplitsOfExtendedFaces(const TopTools_ListOfShap
BuildSplitsOfFaces(theLF, aNewEdges, theEdgesOrigins, &theAnalyse, theAsDes, theFacesOrigins,
anOEImages, anOEOrigins, aLastInvEdges, anEdgesToAvoid, anInvEdges, aValidEdges,
anInvertedEdges, anAlreadyInvFaces, anInvFaces, anArtInvFaces, aFImages,
aDMFNewHoles, aSolids, aSSInterfs);
aDMFNewHoles, aSolids, aIntRes);
//
// Find faces to rebuild
if (anInvFaces.Extent()) {
TopTools_IndexedDataMapOfShapeListOfShape aFToRebuild;
TopTools_MapOfShape aFSelfRebAvoid;
FindFacesToRebuild(aFImages, anInvEdges, anInvFaces, aSSInterfs, aFToRebuild, aFSelfRebAvoid);
FindFacesToRebuild(aFImages, anInvEdges, anInvFaces, aIntRes.SSInterfs, aFToRebuild, aFSelfRebAvoid);
//
if (aFToRebuild.Extent()) {
// vertices to avoid
TopTools_MapOfShape aVAEmpty;
RebuildFaces(aFToRebuild, aFSelfRebAvoid, aSolids, aSSInterfs, &theAnalyse, aFImages, aDMFNewHoles,
RebuildFaces(aFToRebuild, aFSelfRebAvoid, aSolids, aIntRes, &theAnalyse, aFImages, aDMFNewHoles,
theEdgesOrigins, theFacesOrigins, anOEImages, anOEOrigins, aLastInvEdges,
anEdgesToAvoid, anInvEdges, aValidEdges, anInvertedEdges, anAlreadyInvFaces,
anInvFaces, anArtInvFaces, aVAEmpty, theETrimEInf, theAsDes);
@@ -805,22 +815,22 @@ void BuildSplitsOfInvFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theF
// inverted edges
TopTools_MapOfShape anInvertedEdges;
// shapes connection for using in rebuilding process
TopTools_DataMapOfShapeListOfShape aSSInterfs;
BRepOffset_MakeOffset_InterResults aIntRes;
//
TopoDS_Shape aSolids;
//
BuildSplitsOfFaces(aLF, theModifiedEdges, theEdgesOrigins, theAnalyse, theAsDes, theFacesOrigins,
theOEImages, theOEOrigins, theLastInvEdges, theEdgesToAvoid, anInvEdges, theValidEdges,
anInvertedEdges, theAlreadyInvFaces, anInvFaces, anArtInvFaces, theFImages,
theDMFNewHoles, aSolids, aSSInterfs);
theDMFNewHoles, aSolids, aIntRes);
//
if (anInvFaces.Extent()) {
TopTools_IndexedDataMapOfShapeListOfShape aFToRebuild;
TopTools_MapOfShape aFSelfRebAvoid;
FindFacesToRebuild(theFImages, anInvEdges, anInvFaces, aSSInterfs, aFToRebuild, aFSelfRebAvoid);
FindFacesToRebuild(theFImages, anInvEdges, anInvFaces, aIntRes.SSInterfs, aFToRebuild, aFSelfRebAvoid);
//
if (aFToRebuild.Extent()) {
RebuildFaces(aFToRebuild, aFSelfRebAvoid, aSolids, aSSInterfs, theAnalyse, theFImages, theDMFNewHoles,
RebuildFaces(aFToRebuild, aFSelfRebAvoid, aSolids, aIntRes, theAnalyse, theFImages, theDMFNewHoles,
theEdgesOrigins, theFacesOrigins, theOEImages, theOEOrigins, theLastInvEdges,
theEdgesToAvoid, anInvEdges, theValidEdges, anInvertedEdges, theAlreadyInvFaces,
anInvFaces, anArtInvFaces, theVertsToAvoid, theETrimEInf, theAsDes);
@@ -852,7 +862,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
TopTools_DataMapOfShapeListOfShape& theDMFNewHoles,
TopoDS_Shape& theSolids,
TopTools_DataMapOfShapeListOfShape& theSSInterfs)
BRepOffset_MakeOffset_InterResults& theIntRes)
{
if (theLF.IsEmpty()) {
return;
@@ -1163,7 +1173,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
// remove inside faces
TopTools_IndexedMapOfShape aMEInside;
RemoveInsideFaces(theFImages, theInvFaces, theArtInvFaces, theInvEdges, theInvertedEdges,
anInvertedFaces, aMFToCheckInt, aMFInvInHole, aFHoles, theSSInterfs,
anInvertedFaces, aMFToCheckInt, aMFInvInHole, aFHoles, theIntRes,
aMERemoved, aMEInside, theSolids);
//
// make compound of valid splits
@@ -3244,6 +3254,186 @@ void RemoveInvalidSplitsFromValid(const TopTools_IndexedDataMapOfShapeListOfShap
}
}
namespace
{
//=======================================================================
//function : buildPairs
//purpose : builds pairs of shapes
//=======================================================================
static void buildPairs (const TopTools_IndexedMapOfShape& theSMap,
BRepOffset_DataMapOfShapeMapOfShape& theIntPairs)
{
const Standard_Integer aNbS = theSMap.Extent();
if (aNbS < 2)
return;
for (Standard_Integer it1 = 1; it1 <= aNbS; ++it1)
{
const TopoDS_Shape& aS = theSMap (it1);
if (!theIntPairs.IsBound (aS))
theIntPairs.Bind (aS, TopTools_MapOfShape());
}
for (Standard_Integer it1 = 1; it1 <= aNbS; ++it1)
{
const TopoDS_Shape& aS1 = theSMap (it1);
TopTools_MapOfShape& aMap1 = theIntPairs (aS1);
for (Standard_Integer it2 = it1 + 1; it2 <= aNbS; ++it2)
{
const TopoDS_Shape& aS2 = theSMap (it2);
aMap1.Add (aS2);
theIntPairs (aS2).Add (aS1);
}
}
}
//=======================================================================
//function : buildIntersectionPairs
//purpose : builds intersection pairs
//=======================================================================
static void buildIntersectionPairs (const TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
const TopTools_IndexedDataMapOfShapeListOfShape& theInvFaces,
const BOPAlgo_Builder& theBuilder,
const TopTools_MapOfShape& theMFRemoved,
const TopTools_DataMapOfShapeShape& theFOrigins,
NCollection_DataMap<TopoDS_Shape,
BRepOffset_DataMapOfShapeMapOfShape,
TopTools_ShapeMapHasher>& theIntPairs)
{
TopAbs_ShapeEnum aCType = TopAbs_VERTEX;
// Build connection map from vertices to faces
TopTools_IndexedDataMapOfShapeListOfShape aDMVF;
TopExp::MapShapesAndAncestors (theBuilder.Shape(), aCType, TopAbs_FACE, aDMVF);
const TopTools_DataMapOfShapeListOfShape& anImages = theBuilder.Images();
const TopTools_DataMapOfShapeListOfShape& anOrigins = theBuilder.Origins();
// Find all faces connected to the not removed faces and build intersection pairs among them.
// For removed faces intersect only those connected to each other.
for (Standard_Integer iF = 1; iF <= theInvFaces.Extent(); ++iF)
{
const TopoDS_Shape& aFInv = theInvFaces.FindKey (iF);
TopoDS_Compound aCF, aCFRem;
BRep_Builder().MakeCompound (aCF);
BRep_Builder().MakeCompound (aCFRem);
for (Standard_Integer iC = 0; iC < 2; ++iC)
{
const TopTools_ListOfShape& aLF = !iC ? theInvFaces (iF) : theFImages.FindFromKey (aFInv);
for (TopTools_ListOfShape::Iterator it (aLF); it.More(); it.Next())
{
TopTools_ListOfShape aLFIm;
TakeModified (it.Value(), anImages, aLFIm);
for (TopTools_ListOfShape::Iterator itIm (aLFIm); itIm.More(); itIm.Next())
{
const TopoDS_Shape& aFIm = itIm.Value();
if (theMFRemoved.Contains (aFIm))
BRep_Builder().Add (aCFRem, aFIm);
else
BRep_Builder().Add (aCF, aFIm);
}
}
}
TopTools_ListOfShape aLCB;
BOPTools_AlgoTools::MakeConnexityBlocks (aCF, TopAbs_EDGE, TopAbs_FACE, aLCB);
if (aLCB.IsEmpty())
continue;
BRepOffset_DataMapOfShapeMapOfShape* pFInterMap =
theIntPairs.Bound (aFInv, BRepOffset_DataMapOfShapeMapOfShape());
// build pairs for not removed faces
for (TopTools_ListOfShape::Iterator itCB (aLCB); itCB.More(); itCB.Next())
{
const TopoDS_Shape& aCB = itCB.Value();
TopTools_IndexedMapOfShape aMFInter;
for (TopExp_Explorer exp (aCB, aCType); exp.More(); exp.Next())
{
const TopoDS_Shape& aCS = exp.Current();
const TopTools_ListOfShape* pLFV = aDMVF.Seek (aCS);
if (!pLFV)
continue;
for (TopTools_ListOfShape::Iterator itFV (*pLFV); itFV.More(); itFV.Next())
{
const TopoDS_Shape& aFConnected = itFV.Value();
TopTools_ListOfShape aLFOr;
TakeModified (aFConnected, anOrigins, aLFOr);
for (TopTools_ListOfShape::Iterator itOr (aLFOr); itOr.More(); itOr.Next())
{
const TopoDS_Shape* pFOr = theFOrigins.Seek (itOr.Value());
if (pFOr)
aMFInter.Add (*pFOr);
}
}
}
// build intersection pairs
buildPairs (aMFInter, *pFInterMap);
}
aLCB.Clear();
BOPTools_AlgoTools::MakeConnexityBlocks (aCFRem, TopAbs_EDGE, TopAbs_FACE, aLCB);
if (aLCB.IsEmpty())
continue;
for (TopTools_ListOfShape::Iterator itCB (aLCB); itCB.More(); itCB.Next())
{
const TopoDS_Shape& aCB = itCB.Value();
TopTools_IndexedDataMapOfShapeListOfShape aDMEF;
for (TopExp_Explorer exp (aCB, aCType); exp.More(); exp.Next())
{
const TopoDS_Shape& aCS = exp.Current();
const TopTools_ListOfShape* pLFV = aDMVF.Seek (aCS);
if (!pLFV)
continue;
for (TopTools_ListOfShape::Iterator itFV (*pLFV); itFV.More(); itFV.Next())
{
const TopoDS_Shape& aFConnected = itFV.Value();
TopExp::MapShapesAndAncestors (aFConnected, TopAbs_EDGE, TopAbs_FACE, aDMEF);
}
}
for (Standard_Integer iE = 1; iE <= aDMEF.Extent(); ++iE)
{
const TopTools_ListOfShape& aLFConnected = aDMEF (iE);
if (aLFConnected.Extent() < 2)
continue;
TopTools_IndexedMapOfShape aMFInter;
for (TopTools_ListOfShape::Iterator itLF (aLFConnected); itLF.More(); itLF.Next())
{
const TopoDS_Shape& aFConnected = itLF.Value();
TopTools_ListOfShape aLFOr;
TakeModified (aFConnected, anOrigins, aLFOr);
for (TopTools_ListOfShape::Iterator itOr (aLFOr); itOr.More(); itOr.Next())
{
const TopoDS_Shape* pFOr = theFOrigins.Seek (itOr.Value());
if (pFOr)
aMFInter.Add (*pFOr);
}
}
buildPairs (aMFInter, *pFInterMap);
}
}
}
}
}
//=======================================================================
//function : RemoveInsideFaces
//purpose : Looking for the inside faces that can be safely removed
@@ -3257,7 +3447,7 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
const TopTools_IndexedMapOfShape& theMFToCheckInt,
const TopTools_IndexedMapOfShape& theMFInvInHole,
const TopoDS_Shape& theFHoles,
TopTools_DataMapOfShapeListOfShape& theSSInterfs,
BRepOffset_MakeOffset_InterResults& theIntRes,
TopTools_IndexedMapOfShape& theMERemoved,
TopTools_IndexedMapOfShape& theMEInside,
TopoDS_Shape& theSolids)
@@ -3319,7 +3509,7 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
//
// get shapes connection for using in the rebuilding process
// for the cases in which some of the intersection left undetected
ShapesConnections(theInvFaces, theInvEdges, aDMFImF, aMV, theSSInterfs);
ShapesConnections(theInvFaces, theInvEdges, aDMFImF, aMV, theIntRes.SSInterfs);
//
// find faces to remove
const TopoDS_Shape& aSols = aMV.Shape();
@@ -3520,6 +3710,11 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
theMEInside.Add(aE);
}
}
// build all possible intersection pairs basing on the intersection results
// taking into account removed faces.
if (aMFToRem.Extent())
buildIntersectionPairs (theFImages, theInvFaces, aMV, aMFToRem, aDMFImF, theIntRes.InterPairs);
}
//=======================================================================
@@ -4465,7 +4660,7 @@ void FindFacesToRebuild(const TopTools_IndexedDataMapOfShapeListOfShape& theLFI
void RebuildFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild,
const TopTools_MapOfShape& theFSelfRebAvoid,
const TopoDS_Shape& theSolids,
const TopTools_DataMapOfShapeListOfShape& theSSInterfs,
const BRepOffset_MakeOffset_InterResults& theIntRes,
const BRepOffset_Analyse* theAnalyse,
TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
TopTools_DataMapOfShapeListOfShape& theDMFNewHoles,
@@ -4488,7 +4683,7 @@ void RebuildFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild
TopTools_MapOfShape aModifiedEdges;
//
// 1. Intersect faces
IntersectFaces(theFToRebuild, theFSelfRebAvoid, theSolids, theSSInterfs, theFImages, theEdgesOrigins, theOEImages,
IntersectFaces(theFToRebuild, theFSelfRebAvoid, theSolids, theIntRes, theFImages, theEdgesOrigins, theOEImages,
theOEOrigins, theInvEdges, theValidEdges, theInvertedEdges, theEdgesToAvoid,
theInvFaces, theArtInvFaces, theVertsToAvoid, theETrimEInf, aModifiedEdges, theAsDes);
//
@@ -4507,7 +4702,7 @@ void RebuildFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild
void IntersectFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild,
const TopTools_MapOfShape& theFSelfRebAvoid,
const TopoDS_Shape& theSolids,
const TopTools_DataMapOfShapeListOfShape& theSSInterfs,
const BRepOffset_MakeOffset_InterResults& theIntRes,
TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
TopTools_DataMapOfShapeListOfShape& theEdgesOrigins,
TopTools_DataMapOfShapeListOfShape& theOEImages,
@@ -4818,12 +5013,13 @@ void IntersectFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebui
TopTools_IndexedMapOfShape aMFAvoid;
//
FindFacesForIntersection(aFInv, aME, theFImages, aDMSF, aMVInvAll,
theArtInvFaces, bArtificial, theSSInterfs, aMFAvoid, aMFInt, aMFIntExt, aLFInt);
theArtInvFaces, bArtificial, theIntRes.SSInterfs, aMFAvoid, aMFInt, aMFIntExt, aLFInt);
if (aMFInt.Extent() < 3) {
// nothing to intersect
continue;
}
//
const BRepOffset_DataMapOfShapeMapOfShape* pMFInter = theIntRes.InterPairs.Seek (aFInv);
// intersect the faces, but do not intersect the invalid ones
// among each other (except for the artificially invalid faces)
TopTools_IndexedMapOfShape aMEToInt;
@@ -4840,12 +5036,19 @@ void IntersectFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebui
//
TopTools_ListOfShape& aLFDone = aMDone.ChangeFind(aFi);
//
const TopTools_MapOfShape* pInterFi = !pMFInter ? 0 : pMFInter->Seek (aFi);
if (pMFInter && !pInterFi)
continue;
for (j = i + 1; j <= aNb; ++j) {
const TopoDS_Face& aFj = TopoDS::Face(aMFInt(j));
if (bSelfRebAvoid && aFj.IsSame(aFInv)) {
continue;
}
//
if (pInterFi && !pInterFi->Contains (aFj))
continue;
const TopTools_ListOfShape& aLFImj = theFImages.FindFromKey(aFj);
//
TopTools_ListOfShape& aLFEj = aFLE.ChangeFromKey(aFj);

View File

@@ -39,6 +39,7 @@
#include <BRepBndLib.hxx>
#include <Bnd_Box.hxx>
#include <Bnd_Box2d.hxx>
#include <Message.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <BRepTools_WireExplorer.hxx>
@@ -176,7 +177,7 @@ static Standard_Integer transform(Draw_Interpretor& ,Standard_Integer n,const ch
TopoDS_Shape S = DBRep::Get(a[i]);
if (S.IsNull())
{
std::cerr << "Error: " << a[i] << " is not a valid shape\n";
Message::SendFail() << "Error: " << a[i] << " is not a valid shape";
return 1;
}
else
@@ -188,7 +189,7 @@ static Standard_Integer transform(Draw_Interpretor& ,Standard_Integer n,const ch
for (Standard_Integer i = 1; i < last; i++) {
TopoDS_Shape S = DBRep::Get(a[i]);
if (S.IsNull()) {
std::cerr << "Error: " << a[i] << " is not a valid shape\n";
Message::SendFail() << "Error: " << a[i] << " is not a valid shape";
return 1;
}
else {
@@ -271,9 +272,9 @@ static Standard_Integer tcopy(Draw_Interpretor& di,Standard_Integer n,const char
}
if (n < 3 || (n - iFirst) % 2) {
std::cout << "Use: " << a[0] << " [-n(ogeom)] [-m(esh)] shape1 copy1 [shape2 copy2 [...]]" << std::endl;
std::cout << "Option -n forbids copying of geometry (it will be shared)" << std::endl;
std::cout << "Option -m forces copying of mesh (disabled by default)" << std::endl;
Message::SendFail() << "Use: " << a[0] << " [-n(ogeom)] [-m(esh)] shape1 copy1 [shape2 copy2 [...]]\n"
<< "Option -n forbids copying of geometry (it will be shared)\n"
<< "Option -m forces copying of mesh (disabled by default)";
return 1;
}
@@ -584,7 +585,7 @@ static Standard_Integer BoundBox(Draw_Interpretor& theDI,
}
else
{
std::cout << "Syntax error at argument '" << theArgVal[anArgIter] << "'.\n";
Message::SendFail() << "Syntax error at argument '" << theArgVal[anArgIter] << "'";
return 1;
}
}
@@ -592,19 +593,19 @@ static Standard_Integer BoundBox(Draw_Interpretor& theDI,
if (anAABB.IsVoid()
&& aShape.IsNull())
{
std::cout << "Syntax error: input is not specified (neither shape nor coordinates)\n";
Message::SendFail() << "Syntax error: input is not specified (neither shape nor coordinates)";
return 1;
}
else if (!anAABB.IsVoid()
&& (isOBB || isOptimal || isTolerUsed))
{
std::cout << "Syntax error: Options -obb, -optimal and -extToler cannot be used for explicitly defined AABB.\n";
Message::SendFail() << "Syntax error: Options -obb, -optimal and -extToler cannot be used for explicitly defined AABB";
return 1;
}
else if (isOBB
&& !anOutVars[0].IsEmpty())
{
std::cout << "Error: Option -save works only with axes-aligned boxes.\n";
Message::SendFail() << "Error: Option -save works only with axes-aligned boxes";
return 1;
}

View File

@@ -14,8 +14,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// modified by mps (juillet 96) : ajout de la commande distmini
#include <DBRep.hxx>
#include <BRepTest.hxx>
#include <BRepExtrema_Poly.hxx>
@@ -28,15 +26,13 @@
#include <TopoDS_Builder.hxx>
#include <TopoDS_Compound.hxx>
#include <Draw.hxx>
#include <Message.hxx>
#include <OSD_Timer.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
#include <Precision.hxx>
//#ifdef _MSC_VER
#include <stdio.h>
//#endif
//=======================================================================
//function : distance
@@ -77,7 +73,7 @@ static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const
if (n == 5)
aDeflection = Draw::Atof(a[4]);
BRepExtrema_DistShapeShape dst(S1 ,S2, aDeflection, Extrema_ExtFlag_MIN);
BRepExtrema_DistShapeShape dst(S1 ,S2, aDeflection);
if (dst.IsDone())
{
@@ -150,9 +146,7 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
{
if (theNbArgs < 3 || theNbArgs > 6)
{
std::cout << "Usage: " << theArgs[0] <<
" Shape1 Shape2 [-tol <value>] [-profile]" << std::endl;
Message::SendFail() << "Usage: " << theArgs[0] << " Shape1 Shape2 [-tol <value>] [-profile]";
return 1;
}
@@ -161,7 +155,7 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
if (aShape1.IsNull() || aShape2.IsNull())
{
std::cout << "Error: Failed to find specified shapes" << std::endl;
Message::SendFail() << "Error: Failed to find specified shapes";
return 1;
}
@@ -178,14 +172,14 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
{
if (++anArgIdx >= theNbArgs)
{
std::cout << "Error: wrong syntax at argument '" << aFlag << std::endl;
Message::SendFail() << "Error: wrong syntax at argument '" << aFlag;
return 1;
}
const Standard_Real aTolerance = Draw::Atof (theArgs[anArgIdx]);
if (aTolerance < 0.0)
{
std::cout << "Error: Tolerance value should be non-negative" << std::endl;
Message::SendFail() << "Error: Tolerance value should be non-negative";
return 1;
}
else
@@ -231,7 +225,7 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
if (!aTool.IsDone())
{
std::cout << "Error: Failed to perform proximity test" << std::endl;
Message::SendFail() << "Error: Failed to perform proximity test";
return 1;
}
@@ -287,17 +281,14 @@ static int ShapeSelfIntersection (Draw_Interpretor& theDI, Standard_Integer theN
{
if (theNbArgs < 2 || theNbArgs > 5)
{
std::cout << "Usage: " << theArgs[0] <<
" Shape [-tol <value>] [-profile]" << std::endl;
Message::SendFail() << "Usage: " << theArgs[0] << " Shape [-tol <value>] [-profile]";
return 1;
}
TopoDS_Shape aShape = DBRep::Get (theArgs[1]);
if (aShape.IsNull())
{
std::cout << "Error: Failed to find specified shape" << std::endl;
Message::SendFail() << "Error: Failed to find specified shape";
return 1;
}
@@ -313,14 +304,14 @@ static int ShapeSelfIntersection (Draw_Interpretor& theDI, Standard_Integer theN
{
if (++anArgIdx >= theNbArgs)
{
std::cout << "Error: wrong syntax at argument '" << aFlag << std::endl;
Message::SendFail() << "Error: wrong syntax at argument '" << aFlag;
return 1;
}
const Standard_Real aValue = Draw::Atof (theArgs[anArgIdx]);
if (aValue < 0.0)
{
std::cout << "Error: Tolerance value should be non-negative" << std::endl;
Message::SendFail() << "Error: Tolerance value should be non-negative";
return 1;
}
else
@@ -360,7 +351,7 @@ static int ShapeSelfIntersection (Draw_Interpretor& theDI, Standard_Integer theN
if (!aTool.IsDone())
{
std::cout << "Error: Failed to perform proximity test" << std::endl;
Message::SendFail() << "Error: Failed to perform proximity test";
return 1;
}

View File

@@ -65,6 +65,7 @@
#include <BRepFilletAPI_MakeFillet.hxx>
#include <ChFi3d_FilletShape.hxx>
#include <Message.hxx>
#include <Precision.hxx>
@@ -756,16 +757,16 @@ static Standard_Integer SPLS(Draw_Interpretor&,
if (narg < 3)
{
std::cout << "Invalid number of arguments. Should be : splitshape result shape [splitedges] \
[face wire/edge/compound [wire/edge/compound ...] \
[face wire/edge/compound [wire/edge/compound...] ...] \
[@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]" << std::endl;
Message::SendFail() << "Invalid number of arguments. Should be : splitshape result shape [splitedges] "
"[face wire/edge/compound [wire/edge/compound ...] "
"[face wire/edge/compound [wire/edge/compound...] ...] "
"[@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]";
return 1;
}
TopoDS_Shape S = DBRep::Get(a[2]);
if (S.IsNull())
{
std::cout << "Invalid input shape " << a[2] << std::endl;
Message::SendFail() << "Invalid input shape " << a[2];
return 1;
}
BRepFeat_SplitShape Spls(S);
@@ -792,7 +793,7 @@ static Standard_Integer SPLS(Draw_Interpretor&,
TopoDS_Shape aSh = DBRep::Get(a[i]);
if (aSh.IsNull())
{
std::cout << "Invalid input shape " << a[i] << std::endl;
Message::SendFail() << "Invalid input shape " << a[i];
return 1;
}
@@ -871,7 +872,7 @@ static Standard_Integer SPLS(Draw_Interpretor&,
TopoDS_Shape aSh = DBRep::Get(a[i]);
if (aSh.IsNull())
{
std::cout << "Invalid input shape " << a[i] << std::endl;
Message::SendFail() << "Invalid input shape " << a[i];
return 1;
}
TopExp_Explorer aExpE(aSh, TopAbs_EDGE, TopAbs_FACE);
@@ -880,10 +881,10 @@ static Standard_Integer SPLS(Draw_Interpretor&,
}
else
{
std::cout << "Invalid input arguments. Should be : splitshape result shape [splitedges] \
[face wire/edge/compound [wire/edge/compound ...] \
[face wire/edge/compound [wire/edge/compound...] ...] \
[@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]" << std::endl;
Message::SendFail() << "Invalid input arguments. Should be : splitshape result shape [splitedges] "
"[face wire/edge/compound [wire/edge/compound ...] "
"[face wire/edge/compound [wire/edge/compound...] ...] "
"[@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]";
return 1;
}
}
@@ -906,7 +907,7 @@ static Standard_Integer SPLS(Draw_Interpretor&,
Ew = TopoDS::Edge(aLocalShape);
// Ew = TopoDS::Edge(DBRep::Get(a[i+1],TopAbs_EDGE));
if (Ew.IsNull()) {
std::cout << "Invalid input shape " << a[i + 1] << std::endl;
Message::SendFail() << "Invalid input shape " << a[i + 1];
return 1;
}
Spls.Add(TopoDS::Edge(Ew), TopoDS::Edge(Es));

View File

@@ -51,6 +51,7 @@
#include <FilletSurf_ErrorTypeStatus.hxx>
#include <TopAbs.hxx>
#include <DrawTrSurf.hxx>
#include <Message.hxx>
#include <stdio.h>
@@ -333,7 +334,7 @@ Standard_Integer boptopoblend(Draw_Interpretor& di, Standard_Integer narg, const
printtolblend(di);
if(narg < 5)
{
std::cout << "Use <command name> result shape1 shape2 radius [-d]" << std::endl;
Message::SendFail() << "Use <command name> result shape1 shape2 radius [-d]";
return 1;
}
@@ -341,7 +342,7 @@ Standard_Integer boptopoblend(Draw_Interpretor& di, Standard_Integer narg, const
TopoDS_Shape S1 = DBRep::Get(a[2]);
TopoDS_Shape S2 = DBRep::Get(a[3]);
if (S1.IsNull() || S2.IsNull()) {
printf(" Null shapes are not allowed \n");
Message::SendFail() << " Null shapes are not allowed";
return 1;
}
Standard_Real Rad = Draw::Atof(a[4]);
@@ -363,7 +364,7 @@ Standard_Integer boptopoblend(Draw_Interpretor& di, Standard_Integer narg, const
//
theDSFiller.Perform();
if (theDSFiller.HasErrors()) {
printf("Check types of the arguments, please\n");
Message::SendFail() << "Check types of the arguments, please";
return 1;
}
@@ -377,7 +378,7 @@ Standard_Integer boptopoblend(Draw_Interpretor& di, Standard_Integer narg, const
Standard_Boolean anIsDone = pBuilder->IsDone();
if (!anIsDone)
{
printf("boolean operation not done HasErrors()=%d\n", pBuilder->HasErrors());
Message::SendFail() << "boolean operation not done HasErrors()=" << pBuilder->HasErrors();
return 1;
}

View File

@@ -75,6 +75,7 @@
#include <BRepOffset_MakeOffset.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <Message.hxx>
static
void SampleEdges (const TopoDS_Shape& theShape,
@@ -277,7 +278,7 @@ Standard_Integer brepintcs(Draw_Interpretor& di, Standard_Integer n, const char*
{
if (n <= 2)
{
std::cout<<"Invalid input arguments. Should be: curve1 [curve2 ...] shape [result] [tol]"<<std::endl;
Message::SendFail() << "Invalid input arguments. Should be: curve1 [curve2 ...] shape [result] [tol]";
return 1;
}
Standard_Integer indshape = 2;
@@ -290,7 +291,7 @@ Standard_Integer brepintcs(Draw_Interpretor& di, Standard_Integer n, const char*
}
if (S.IsNull())
{
std::cout<<"Invalid input shape"<<std::endl;
Message::SendFail() << "Invalid input shape";
return 1;
}

View File

@@ -32,7 +32,7 @@
#include <BRepPrimAPI_MakeSphere.hxx>
#include <Geom_Plane.hxx>
#include <gp_Pln.hxx>
#include <Message.hxx>
//=======================================================================
// box
@@ -129,7 +129,7 @@ static Standard_Integer box(Draw_Interpretor& , Standard_Integer n, const char**
}
else
{
std::cout<<"Syntax error\n";
Message::SendFail() << "Syntax error";
return 1;
}
}

View File

@@ -46,6 +46,7 @@
#include <BRepBuilderAPI_FastSewing.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <Message.hxx>
#ifdef _WIN32
//#define strcasecmp strcmp Already defined
@@ -75,7 +76,7 @@ static Standard_Integer mkface(Draw_Interpretor& , Standard_Integer n, const cha
Handle(Geom_Surface) S = DrawTrSurf::GetSurface(a[2]);
if (S.IsNull()) {
std::cout << a[2] << " is not a surface" << std::endl;
Message::SendFail() << a[2] << " is not a surface";
return 1;
}
@@ -580,7 +581,7 @@ static Standard_Integer getedgeregul
{
if( argc < 3)
{
std::cout<<"Invalid number of arguments. Should be: checkedgeregularity edge face1 [face2]"<<std::endl;
Message::SendFail() << "Invalid number of arguments. Should be: checkedgeregularity edge face1 [face2]";
return 1;
}
@@ -589,7 +590,7 @@ static Standard_Integer getedgeregul
TopoDS_Shape aFace2 = (argc > 3 ? DBRep::Get(argv[3],TopAbs_FACE) : aFace1);
if( anEdge.IsNull() || aFace1.IsNull() || aFace2.IsNull())
{
std::cout<<"Invalid number of arguments. Should be: getedgeregularity edge face1 [face2]"<<std::endl;
Message::SendFail() << "Invalid number of arguments. Should be: getedgeregularity edge face1 [face2]";
return 1;
}
@@ -617,9 +618,9 @@ static Standard_Integer getedgeregul
//=======================================================================
static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n < 3 || n > 4) {
if (n < 3 || n > 5) {
di << "Project point on the face.\n";
di << "Usage: projponf face pnt [extrema flag: -min/-max/-minmax]\n";
di << "Usage: projponf face pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]\n";
return 1;
}
// get face
@@ -642,6 +643,7 @@ static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const
//
// get projection options
// default values;
Extrema_ExtAlgo anExtAlgo = Extrema_ExtAlgo_Grad;
Extrema_ExtFlag anExtFlag = Extrema_ExtFlag_MINMAX;
//
for (Standard_Integer i = 3; i < n; ++i) {
@@ -654,6 +656,12 @@ static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const
else if (!strcasecmp(a[i], "-minmax")) {
anExtFlag = Extrema_ExtFlag_MINMAX;
}
else if (!strcasecmp(a[i], "-t")) {
anExtAlgo = Extrema_ExtAlgo_Tree;
}
else if (!strcasecmp(a[i], "-g")) {
anExtAlgo = Extrema_ExtAlgo_Grad;
}
}
//
// get surface
@@ -670,6 +678,7 @@ static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const
GeomAPI_ProjectPointOnSurf aProjPS;
aProjPS.Init(aSurf, aUMin, aUMax, aVMin, aVMax);
// set the options
aProjPS.SetExtremaAlgo(anExtAlgo);
aProjPS.SetExtremaFlag(anExtFlag);
// perform projection
aProjPS.Perform(aP);
@@ -758,7 +767,7 @@ void BRepTest::SurfaceCommands(Draw_Interpretor& theCommands)
theCommands.Add ("getedgeregularity", "getedgeregularity edge face1 [face2]", __FILE__,getedgeregul,g);
theCommands.Add ("projponf",
"projponf face pnt [extrema flag: -min/-max/-minmax]\n"
"projponf face pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]\n"
"\t\tProject point on the face.",
__FILE__, projponf, g);
}

View File

@@ -59,7 +59,7 @@ static BRepOffsetAPI_ThruSections* Generator = 0;
#include <gp_Vec.hxx>
#include <Geom_Circle.hxx>
#include <gp_Ax2.hxx>
#include <Message.hxx>
//=======================================================================
// prism
@@ -244,7 +244,7 @@ static Standard_Integer geompipe(Draw_Interpretor&,
aPipe.Perform(Standard_True);
if (!aPipe.IsDone())
{
std::cout << "GeomFill_Pipe cannot make a surface" << std::endl;
Message::SendFail() << "GeomFill_Pipe cannot make a surface";
return 1;
}
@@ -550,16 +550,6 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
Standard_Integer n, const char** a)
{
if (n == 1) {
//std::cout << "setsweep options [arg1 [arg2 [...]]] : options are :" << std::endl;
//std::cout << " -FR : Tangent and Normal are given by Frenet trihedron" <<std::endl;
//std::cout << " -CF : Tangente is given by Frenet," << std::endl;
//std::cout << " the Normal is computed to minimize the torsion " << std::endl;
//std::cout << " -DX Surf : Tangent and Normal are given by Darboux trihedron,"
// <<std::endl;
//std::cout << " Surf have to be a shell or a face" <<std::endl;
//std::cout << " -CN dx dy dz : BiNormal is given by dx dy dz" << std::endl;
//std::cout << " -FX Tx Ty TZ [Nx Ny Nz] : Tangent and Normal are fixed" <<std::endl;
//std::cout << " -G guide 0|1(ACR|Plan) 0|1(contact|no contact) : with guide"<<std::endl;
di << "setsweep options [arg1 [arg2 [...]]] : options are :\n";
di << " -FR : Tangent and Normal are given by Frenet trihedron\n";
di << " -CF : Tangente is given by Frenet,\n";
@@ -574,7 +564,6 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
}
if (Sweep == 0) {
//std::cout << "You have forgotten the <<mksweep>> command !"<< std::endl;
di << "You have forgotten the <<mksweep>> command !\n";
return 1;
}
@@ -589,14 +578,12 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
}
else if (!strcmp(a[1], "-DX")) {
if (n != 3) {
//std::cout << "bad arguments !" << std::endl;
di << "bad arguments !\n";
return 1;
}
TopoDS_Shape Surf;
Surf = DBRep::Get(a[2], TopAbs_SHAPE);
if (Surf.IsNull()) {
//std::cout << a[2] <<"is not a shape !" << std::endl;
di << a[2] << "is not a shape !\n";
return 1;
}
@@ -604,7 +591,6 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
}
else if (!strcmp(a[1], "-CN")) {
if (n != 5) {
//std::cout << "bad arguments !" << std::endl;
di << "bad arguments !\n";
return 1;
}
@@ -613,7 +599,6 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
}
else if (!strcmp(a[1], "-FX")) {
if ((n != 5) && (n != 8)) {
//std::cout << "bad arguments !" << std::endl;
di << "bad arguments !\n";
return 1;
}
@@ -632,7 +617,6 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
{
if (n != 5)
{
//std::cout << "bad arguments !" << std::endl;
di << "bad arguments !\n";
return 1;
}
@@ -648,7 +632,6 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
}
else {
//std::cout << "The option "<< a[1] << " is unknown !" << std::endl;
di << "The option " << a[1] << " is unknown !\n";
return 1;
}
@@ -663,11 +646,6 @@ static Standard_Integer addsweep(Draw_Interpretor& di,
Standard_Integer n, const char** a)
{
if (n == 1) {
//std::cout << "addsweep wire/vertex [Vertex] [-T] [-R] [u0 v0 u1 v1 [...[uN vN]]] : options are :" << std::endl;
//std::cout << " -T : the wire/vertex have to be translated to assume contact"<< std::endl;
//std::cout << " with the spine" <<std::endl;
//std::cout << " -R : the wire have to be rotated to assume orthogonality"<<std::endl;
//std::cout << " with the spine's tangent" << std::endl;
di << "addsweep wire/vertex [Vertex] [-T] [-R] [u0 v0 u1 v1 [...[uN vN]]] : options are :\n";
di << " -T : the wire/vertex have to be translated to assume contact\n";
di << " with the spine\n";
@@ -677,7 +655,6 @@ static Standard_Integer addsweep(Draw_Interpretor& di,
}
if (Sweep == 0) {
//std::cout << "You have forgotten the <<mksweep>> command !"<< std::endl;
di << "You have forgotten the <<mksweep>> command !\n";
return 1;
}
@@ -691,7 +668,6 @@ static Standard_Integer addsweep(Draw_Interpretor& di,
(Section.ShapeType() != TopAbs_WIRE &&
Section.ShapeType() != TopAbs_VERTEX))
{
//std::cout << a[1] <<"is not a wire and is not a vertex!" << std::endl;
di << a[1] << " is not a wire and is not a vertex!\n";
return 1;
}
@@ -705,7 +681,6 @@ static Standard_Integer addsweep(Draw_Interpretor& di,
// Reading of Vertex
TopoDS_Shape InputVertex(DBRep::Get(a[cur], TopAbs_VERTEX));
Vertex = TopoDS::Vertex(InputVertex);
// Vertex = TopoDS::Vertex(DBRep::Get(a[cur],TopAbs_VERTEX));
if (!Vertex.IsNull()) {
cur++;
HasVertex = Standard_True;
@@ -768,15 +743,12 @@ static Standard_Integer deletesweep(Draw_Interpretor& di,
TopoDS_Wire Section;
TopoDS_Shape InputShape(DBRep::Get(a[1], TopAbs_SHAPE));
Section = TopoDS::Wire(InputShape);
// Section = TopoDS::Wire(DBRep::Get(a[1],TopAbs_SHAPE));
if (Section.IsNull()) {
//std::cout << a[1] <<"is not a wire !" << std::endl;
di << a[1] << "is not a wire !\n";
return 1;
}
Sweep->Delete(Section);
return 0;
}
@@ -787,14 +759,6 @@ static Standard_Integer buildsweep(Draw_Interpretor& di,
Standard_Integer n, const char** a)
{
if (n == 1) {
//std::cout << "build sweep result [-M/-C/-R] [-S] [tol] : options are" << std::endl;
//std::cout << " -M : Discontinuities are treated by Modfication of"<< std::endl;
//std::cout << " the sweeping mode : it is the default" <<std::endl;
//std::cout << " -C : Discontinuities are treated like Right Corner" << std::endl;
//std::cout << " Treatement is Extent && Intersect" << std::endl;
//std::cout << " -R : Discontinuities are treated like Round Corner" << std::endl;
//std::cout << " Treatement is Intersect and Fill" << std::endl;
//std::cout << " -S : To build a Solid" << std::endl;
di << "build sweep result [-M/-C/-R] [-S] [tol] : options are\n";
di << " -M : Discontinuities are treated by Modfication of\n";
di << " the sweeping mode : it is the default\n";
@@ -808,13 +772,11 @@ static Standard_Integer buildsweep(Draw_Interpretor& di,
Standard_Boolean mksolid = Standard_False;
if (Sweep == 0) {
//std::cout << "You have forgotten the <<mksweep>> command !"<< std::endl;
di << "You have forgotten the <<mksweep>> command !\n";
return 1;
}
if (!Sweep->IsReady()) {
//std::cout << "You have forgotten the <<addsweep>> command !"<< std::endl;
di << "You have forgotten the <<addsweep>> command !\n";
return 1;
}
@@ -841,15 +803,12 @@ static Standard_Integer buildsweep(Draw_Interpretor& di,
// Calcul le resultat
Sweep->Build();
if (!Sweep->IsDone()) {
//std::cout << "Buildsweep : Not Done" << std::endl;
di << "Buildsweep : Not Done\n";
BRepBuilderAPI_PipeError Stat = Sweep->GetStatus();
if (Stat == BRepBuilderAPI_PlaneNotIntersectGuide) {
//std::cout << "Buildsweep : One Plane not intersect the guide" << std::endl;
di << "Buildsweep : One Plane not intersect the guide\n";
}
if (Stat == BRepBuilderAPI_ImpossibleContact) {
//std::cout << "BuildSweep : One section can not be in contact with the guide" << std::endl;
di << "BuildSweep : One section can not be in contact with the guide\n";
}
}
@@ -857,7 +816,6 @@ static Standard_Integer buildsweep(Draw_Interpretor& di,
if (mksolid) {
Standard_Boolean B;
B = Sweep->MakeSolid();
//if (!B) std::cout << " BuildSweep : It is impossible to make a solid !" << std::endl;
if (!B) di << " BuildSweep : It is impossible to make a solid !\n";
}
result = Sweep->Shape();
@@ -903,13 +861,11 @@ static Standard_Integer simulsweep(Draw_Interpretor& di,
if ((n != 3) && (n != 4)) return 1;
if (Sweep == 0) {
//std::cout << "You have forgotten the <<mksweep>> command !"<< std::endl;
di << "You have forgotten the <<mksweep>> command !\n";
return 1;
}
if (!Sweep->IsReady()) {
//std::cout << "You have forgotten the <<addsweep>> command !"<< std::endl;
di << "You have forgotten the <<addsweep>> command !\n";
return 1;
}

View File

@@ -42,6 +42,7 @@
#include <TopOpeBRepDS_HDataStructure.hxx>
#include <gp.hxx>
#include <gp_Pln.hxx>
#include <Message.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopExp.hxx>
@@ -118,7 +119,7 @@ static Standard_Integer section(Draw_Interpretor& , Standard_Integer n, const ch
Sec.Approximation(Standard_True);
else if (strcasecmp(a[i], "-p"))
{
std::cout << "Unknown option: " << a[i] << std::endl;
Message::SendFail() << "Unknown option: " << a[i];
return 1;
}
}
@@ -170,7 +171,6 @@ static Standard_Integer halfspace(Draw_Interpretor& di,
if ( Face.IsNull()) {
TopoDS_Shape Shell = DBRep::Get(a[2],TopAbs_SHELL);
if (Shell.IsNull()) {
//std::cout << a[2] << " must be a face or a shell" << std::endl;
di << a[2] << " must be a face or a shell\n";
return 1;
}
@@ -180,7 +180,6 @@ static Standard_Integer halfspace(Draw_Interpretor& di,
DBRep::Set(a[1],Half.Solid());
}
else {
//std::cout << " HalfSpace NotDone" << std::endl;
di << " HalfSpace NotDone\n";
return 1;
}
@@ -192,7 +191,6 @@ static Standard_Integer halfspace(Draw_Interpretor& di,
DBRep::Set(a[1],Half.Solid());
}
else {
//std::cout << " HalfSpace NotDone" << std::endl;
di << " HalfSpace NotDone\n";
return 1;
}
@@ -211,14 +209,12 @@ static Standard_Integer buildfaces(Draw_Interpretor& , Standard_Integer narg, co
TopoDS_Shape InputShape(DBRep::Get( a[2] ,TopAbs_FACE));
TopoDS_Face F = TopoDS::Face(InputShape);
// TopoDS_Face F = TopoDS::Face(DBRep::Get(a[2],TopAbs_FACE));
BRepAlgo_FaceRestrictor FR;
FR.Init(F);
for (Standard_Integer i = 3 ; i < narg ; i++) {
TopoDS_Shape InputWire(DBRep::Get(a[i],TopAbs_WIRE));
TopoDS_Wire W = TopoDS::Wire(InputWire);
// TopoDS_Wire W = TopoDS::Wire(DBRep::Get(a[i],TopAbs_WIRE));
FR.Add(W);
}
FR.Perform();

View File

@@ -66,18 +66,6 @@ public: //! @name Adding elements in BVH
BVH_Object<NumType, Dimension>::myIsDirty = Standard_True;
}
//! Allows to update the box of the element while the tree is not yet built
virtual void UpdateBox (const Standard_Integer theId, const BVH_Box<NumType, Dimension>& theNewBox)
{
if (BVH_Object<NumType, Dimension>::myIsDirty)
{
if (theId >= 0 && theId < Size())
{
myBoxes[theId] = theNewBox;
}
}
}
public: //! @name BVH construction
//! BVH construction

View File

@@ -84,7 +84,7 @@ public: //! @name Necessary overrides for BVH construction
//! Returns the bounding box with the given index.
virtual BVH_Box <NumType, Dimension> Box (const Standard_Integer theIndex) const Standard_OVERRIDE
{
return this->myBoxes[myIndices[theIndex]];
return myBoxes[myIndices[theIndex]];
}
//! Swaps indices of two specified boxes.
@@ -95,9 +95,9 @@ public: //! @name Necessary overrides for BVH construction
}
//! Returns the Element with the index theIndex.
virtual DataType Element (const Standard_Integer theIndex) const Standard_OVERRIDE
virtual DataType Element (const Standard_Integer theIndex) const
{
return this->myElements[myIndices[theIndex]];
return myElements[myIndices[theIndex]];
}
protected: //! @name Fields

View File

@@ -88,24 +88,6 @@ public: //! @name Point-Box Square distance
return aDist;
}
//! Computes Max square distance between point and bounding box
static T PointBoxMaxSquareDistance (const BVH_VecNt& thePoint,
const BVH_VecNt& theCMin,
const BVH_VecNt& theCMax)
{
T aDist = 0;
for (int i = 0; i < N; ++i)
{
T dmin = 0, dmax = 0;
if (thePoint[i] > theCMin[i]) { dmin = thePoint[i] - theCMin[i]; }
if (thePoint[i] < theCMax[i]) { dmax = theCMax[i] - thePoint[i]; }
T d = dmin > dmax ? dmin : dmax;
d *= d;
aDist += d;
}
return aDist;
}
public: //! @name Point-Box projection
//! Computes projection of point on bounding box
@@ -128,6 +110,7 @@ public: //! @name Point-Box projection
{
return thePoint.cwiseMax (theCMin).cwiseMin (theCMax);
}
public: //! @name Point-Triangle Square distance
//! Computes square distance between point and triangle

View File

@@ -23,6 +23,7 @@
#include <Draw_Appli.hxx>
#include <Draw_Drawable3D.hxx>
#include <Draw_Interpretor.hxx>
#include <Message.hxx>
#include <TDF_Label.hxx>
#include <TDF_ChildIterator.hxx>
@@ -50,14 +51,14 @@ static Standard_Integer DFBrowse (Draw_Interpretor& di,
{
if (n<2)
{
std::cout << "Use: " << a[0] << " document [brower_name]" << std::endl;
Message::SendFail() << "Use: " << a[0] << " document [brower_name]";
return 1;
}
Handle(TDF_Data) DF;
if (!DDF::GetDF (a[1], DF))
{
std::cout << "Error: document " << a[1] << " is not found" << std::endl;
Message::SendFail() << "Error: document " << a[1] << " is not found";
return 1;
}
@@ -78,8 +79,8 @@ static Standard_Integer DFBrowse (Draw_Interpretor& di,
}
else
{
std::cout << "Error: Could not load script " << aTclScript << std::endl;
std::cout << "Check environment variable CSF_DrawPluginDefaults" << std::endl;
Message::SendFail() << "Error: Could not load script " << aTclScript << "\n"
<< "Check environment variable CSF_DrawPluginDefaults";
}
// Call command dftree defined in dftree.tcl
@@ -106,7 +107,7 @@ static Standard_Integer DFOpenLabel (Draw_Interpretor& di,
Handle(DDF_Browser) browser = Handle(DDF_Browser)::DownCast (Draw::GetExisting (a[1]));
if (browser.IsNull())
{
std::cout << "Syntax error: browser '" << a[1] << "' not found\n";
Message::SendFail() << "Syntax error: browser '" << a[1] << "' not found";
return 1;
}
@@ -135,7 +136,7 @@ static Standard_Integer DFOpenAttributeList(Draw_Interpretor& di,
Handle(DDF_Browser) browser = Handle(DDF_Browser)::DownCast (Draw::GetExisting (a[1]));
if (browser.IsNull())
{
std::cout << "Syntax error: browser '" << a[1] << "' not found\n";
Message::SendFail() << "Syntax error: browser '" << a[1] << "' not found";
return 1;
}
@@ -168,7 +169,7 @@ static Standard_Integer DFOpenAttribute (Draw_Interpretor& di,
Handle(DDF_Browser) browser = Handle(DDF_Browser)::DownCast (Draw::GetExisting (a[1]));
if (browser.IsNull())
{
std::cout << "Syntax error: browser '" << a[1] << "' not found\n";
Message::SendFail() << "Syntax error: browser '" << a[1] << "' not found";
return 1;
}

View File

@@ -24,6 +24,7 @@
#include <DrawTrSurf.hxx>
#include <DDF.hxx>
#include <Message.hxx>
#include <TDF_Data.hxx>
#include <TDF_Label.hxx>
@@ -614,7 +615,6 @@ static Standard_Integer DDataStd_GetIntArray (Draw_Interpretor& di,
}
for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
//std::cout << A->Value(i) << std::endl;
di << A->Value(i);
if(i<A->Upper())
di<<" ";
@@ -1425,7 +1425,7 @@ static Standard_Integer DDataStd_KeepUTF (Draw_Interpretor& di,
#endif
if (!anIS) {
// Can not open file
std::cout << "Error: can't open file " << aFileName <<std::endl;
Message::SendFail() << "Error: can't open file " << aFileName;
return 1;
}
char buf[1024];
@@ -1484,7 +1484,7 @@ static Standard_Integer DDataStd_GetUTFtoFile (Draw_Interpretor& di,
}
if(!aES.Length()) {
std::cout << "Data is not found in the Document" <<std::endl;
Message::SendFail() << "Data is not found in the Document";
return 1;
}
@@ -1560,7 +1560,7 @@ static Standard_Integer DDataStd_SetByteArray (Draw_Interpretor& di,
for(Standard_Integer i = From; i<=To; ++i) {
Standard_Integer ival = Draw::Atoi(arg[j]);
if(ival < 0 || 255 < ival) {
std::cout << "Bad value = " << ival<< std::endl;
Message::SendFail() << "Bad value = " << ival;
return 1;
}
A->SetValue(i, (Standard_Byte)ival);
@@ -1596,7 +1596,7 @@ static Standard_Integer DDataStd_SetByteArrayValue (Draw_Interpretor&,
// Check the value.
if(value < 0 || 255 < value) {
std::cout << "Bad value = " << value << std::endl;
Message::SendFail() << "Bad value = " << value;
return 1;
}
@@ -1661,7 +1661,7 @@ static Standard_Integer DDataStd_SetBooleanArray (Draw_Interpretor& di,
Standard_Integer ival = Draw::Atoi(arg[j]);
if(ival > 1)
{
std::cout << "Bad value (" <<i <<") = " << ival<< ". 0 or 1 is expected." << std::endl;
Message::SendFail() << "Bad value (" <<i <<") = " << ival<< ". 0 or 1 is expected.";
return 1;
}
A->SetValue(i, ival != 0);
@@ -1856,7 +1856,7 @@ static Standard_Integer DDataStd_SetBooleanList (Draw_Interpretor& di,
Standard_Integer ival = Draw::Atoi(arg[i]);
if(ival > 1)
{
std::cout << "Bad value = " << ival<< ". 0 or 1 is expected." << std::endl;
Message::SendFail() << "Bad value = " << ival<< ". 0 or 1 is expected.";
return 1;
}
A->Append (ival != 0);
@@ -2479,7 +2479,6 @@ static Standard_Integer DDataStd_GetByteArray (Draw_Interpretor& di,
}
for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
//std::cout << A->Value(i) << std::endl;
di << A->Value(i);
if(i<A->Upper())
di<<" ";
@@ -3242,7 +3241,7 @@ static Standard_Integer DDataStd_SetNDataIntAr2 (Draw_Interpretor& di,
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
anAtt = TDataStd_NamedData::Set(aLabel);
if(anAtt.IsNull()) {
std::cout<< "NamedData attribute is not found or not set" << std::endl;
Message::SendFail() << "NamedData attribute is not found or not set";
return 1;}
j = 15;
@@ -3322,7 +3321,7 @@ static Standard_Integer DDataStd_GetAsciiString (Draw_Interpretor& di,
}
Handle(TDataStd_AsciiString) anAtt;
if( !aLabel.FindAttribute(aGuid, anAtt) ) {
std::cout << "AsciiString attribute is not found or not set" << std::endl;
Message::SendFail() << "AsciiString attribute is not found or not set";
return 1;
}
@@ -3399,9 +3398,12 @@ static Standard_Integer DDataStd_GetNDIntegers (Draw_Interpretor& di,
Handle(TDataStd_NamedData) anAtt;
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
std::cout << "NamedData attribute is not found or not set" << std::endl;
return 1;}
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
{
Message::SendFail() << "NamedData attribute is not found or not set";
return 1;
}
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
@@ -3436,9 +3438,11 @@ static Standard_Integer DDataStd_GetNDInteger (Draw_Interpretor& di,
Handle(TDataStd_NamedData) anAtt;
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
std::cout << "NamedData attribute is not found or not set" << std::endl;
return 1;}
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
{
Message::SendFail() << "NamedData attribute is not found or not set";
return 1;
}
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
@@ -3477,9 +3481,11 @@ static Standard_Integer DDataStd_SetNDataReals (Draw_Interpretor& di,
Handle(TDataStd_NamedData) anAtt;
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
anAtt = TDataStd_NamedData::Set(aLabel);
if(anAtt.IsNull()) {
std::cout << "NamedData attribute is not found or not set" << std::endl;
return 1;}
if(anAtt.IsNull())
{
Message::SendFail() << "NamedData attribute is not found or not set";
return 1;
}
j = 4;
anAtt->LoadDeferredData();
@@ -3512,9 +3518,11 @@ static Standard_Integer DDataStd_GetNDReals (Draw_Interpretor& di,
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
Handle(TDataStd_NamedData) anAtt;
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
std::cout << "NamedData attribute is not found or not set" << std::endl;
return 1;}
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
{
Message::SendFail() << "NamedData attribute is not found or not set";
return 1;
}
anAtt->LoadDeferredData();
const TDataStd_DataMapOfStringReal& aMap = anAtt->GetRealsContainer();
@@ -3547,15 +3555,17 @@ static Standard_Integer DDataStd_GetNDReal (Draw_Interpretor& di,
Handle(TDataStd_NamedData) anAtt;
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
std::cout << "NamedData attribute is not found or not set" << std::endl;
return 1;}
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
{
Message::SendFail() << "NamedData attribute is not found or not set";
return 1;
}
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
if(!anAtt->HasReal(arg[3])) {
std::cout << "There is no data specified by Key = "<< arg[3] << std::endl;
Message::SendFail() << "There is no data specified by Key = " << arg[3];
return 1;
} else {
std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetReal(arg[3])<<std::endl;
@@ -3635,9 +3645,12 @@ static Standard_Integer DDataStd_GetNDStrings (Draw_Interpretor& di,
Handle(TDataStd_NamedData) anAtt;
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
std::cout << "NamedData attribute is not found or not set" << std::endl;
return 1;}
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
{
Message::SendFail() << "NamedData attribute is not found or not set";
return 1;
}
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
@@ -3684,10 +3697,13 @@ static Standard_Integer DDataStd_GetNDString (Draw_Interpretor& di,
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
if(!anAtt->HasString(arg[3])) {
std::cout << "There is no data specified by Key = "<< arg[3] << std::endl;
if (!anAtt->HasString(arg[3]))
{
Message::SendFail() << "There is no data specified by Key = " << arg[3];
return 1;
} else {
}
else
{
TCollection_AsciiString aValue (anAtt->GetString(arg[3]), '?');
std::cout << "Key = " << arg[3] << " Value = " << aValue.ToCString() << std::endl;
if(nb == 5)
@@ -3719,9 +3735,11 @@ static Standard_Integer DDataStd_SetNDataBytes (Draw_Interpretor& di,
Handle(TDataStd_NamedData) anAtt;
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
anAtt = TDataStd_NamedData::Set(aLabel);
if(anAtt.IsNull()) {
std::cout << "NamedData attribute is not found or not set" << std::endl;
return 1;}
if(anAtt.IsNull())
{
Message::SendFail() << "NamedData attribute is not found or not set";
return 1;
}
j = 4;
anAtt->LoadDeferredData();
@@ -3753,9 +3771,12 @@ static Standard_Integer DDataStd_GetNDBytes (Draw_Interpretor& di,
Handle(TDataStd_NamedData) anAtt;
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
std::cout << "NamedData attribute is not found or not set" << std::endl;
return 1;}
if (!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
{
Message::SendFail() << "NamedData attribute is not found or not set";
return 1;
}
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
@@ -3789,17 +3810,22 @@ static Standard_Integer DDataStd_GetNDByte (Draw_Interpretor& di,
Handle(TDataStd_NamedData) anAtt;
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
std::cout << "NamedData attribute is not found or not set" << std::endl;
return 1;}
if (!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
{
Message::SendFail() << "NamedData attribute is not found or not set";
return 1;
}
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
if(!anAtt->HasByte(arg[3])) {
std::cout << "There is no data specified by Key = "<< arg[3] << std::endl;
if (!anAtt->HasByte(arg[3]))
{
Message::SendFail() << "There is no data specified by Key = " << arg[3];
return 1;
} else {
}
else
{
std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetByte(arg[3])<< std::endl;
if(nb == 5)
Draw::Set(arg[4], anAtt->GetByte(arg[3]));
@@ -3832,9 +3858,11 @@ static Standard_Integer DDataStd_SetNDataIntAr (Draw_Interpretor& di,
Handle(TDataStd_NamedData) anAtt;
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
anAtt = TDataStd_NamedData::Set(aLabel);
if(anAtt.IsNull()) {
std::cout<< "NamedData attribute is not found or not set" << std::endl;
return 1;}
if (anAtt.IsNull())
{
Message::SendFail() << "NamedData attribute is not found or not set";
return 1;
}
j = 5;
Handle(TColStd_HArray1OfInteger) anArr = new TColStd_HArray1OfInteger(1, aNum);
@@ -3868,9 +3896,12 @@ static Standard_Integer DDataStd_GetNDIntArrays (Draw_Interpretor& di,
Handle(TDataStd_NamedData) anAtt;
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
std::cout << "NamedData attribute is not found or not set" << std::endl;
return 1;}
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
{
Message::SendFail() << "NamedData attribute is not found or not set";
return 1;
}
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
@@ -3913,17 +3944,22 @@ static Standard_Integer DDataStd_GetNDIntArray (Draw_Interpretor& di,
Handle(TDataStd_NamedData) anAtt;
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
std::cout << "NamedData attribute is not found or not set" << std::endl;
return 1;}
if (!aLabel.FindAttribute (TDataStd_NamedData::GetID(), anAtt))
{
Message::SendFail() << "NamedData attribute is not found or not set";
return 1;
}
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
if(!anAtt->HasArrayOfIntegers(arg[3])) {
std::cout << "There is no data specified by Key = "<< arg[3] << std::endl;
if (!anAtt->HasArrayOfIntegers(arg[3]))
{
Message::SendFail() << "There is no data specified by Key = " << arg[3];
return 1;
} else {
}
else
{
std::cout << "Key = " << arg[3] <<std::endl;
Handle(TColStd_HArray1OfInteger) anArrValue = anAtt->GetArrayOfIntegers(arg[3]);
@@ -3965,10 +4001,12 @@ static Standard_Integer DDataStd_SetNDataRealAr (Draw_Interpretor& di,
Handle(TDataStd_NamedData) anAtt;
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
anAtt = TDataStd_NamedData::Set(aLabel);
if(anAtt.IsNull()) {
std::cout << "NamedData attribute is not found or not set" << std::endl;
return 1;}
if (anAtt.IsNull())
{
Message::SendFail() << "NamedData attribute is not found or not set";
return 1;
}
j = 5;
Handle(TColStd_HArray1OfReal) anArr = new TColStd_HArray1OfReal(1, aNum);
for(Standard_Integer i = 1; i<=aNum; i++) {
@@ -4001,9 +4039,12 @@ static Standard_Integer DDataStd_GetNDRealArrays (Draw_Interpretor& di,
Handle(TDataStd_NamedData) anAtt;
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
std::cout << "NamedData attribute is not found or not set" << std::endl;
return 1;}
if (!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
{
Message::SendFail() << "NamedData attribute is not found or not set";
return 1;
}
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();

View File

@@ -51,6 +51,7 @@
#include <DDataStd_DrawPresentation.hxx>
#include <DDataStd_DrawDriver.hxx>
#include <Message.hxx>
#ifndef _WIN32
extern Draw_Viewer dout;
@@ -92,7 +93,7 @@ static Standard_Integer DDataStd_Rmdraw (Draw_Interpretor& ,
{
if (nb != 2)
{
std::cout << "Syntax error: wrong number of arguments\n";
Message::SendFail() << "Syntax error: wrong number of arguments";
return 1;
}
@@ -103,7 +104,7 @@ static Standard_Integer DDataStd_Rmdraw (Draw_Interpretor& ,
}
else
{
std::cout << "Syntax error: variable '" << arg[1] << "' not found\n";
Message::SendFail() << "Syntax error: variable '" << arg[1] << "' not found";
return 1;
}
}
@@ -291,14 +292,3 @@ void DDataStd::DrawDisplayCommands (Draw_Interpretor& theCommands)
"update the draw viewer",
__FILE__, DDataStd_DrawRepaint, g);
}

View File

@@ -97,8 +97,9 @@ static Standard_Integer DDataStd_GetName (Draw_Interpretor& di,
aGuid = Standard_GUID(arg[3]);
}
Handle(TDataStd_Name) N;
if( !L.FindAttribute(aGuid, N) ) {
std::cout << "Name attribute is not found or not set" << std::endl;
if( !L.FindAttribute(aGuid, N) )
{
di << "Name attribute is not found or not set";
return 1;
}
#ifdef DEB_DDataStd

View File

@@ -22,6 +22,7 @@
#include <Draw_Appli.hxx>
#include <Draw_Drawable3D.hxx>
#include <Draw_Interpretor.hxx>
#include <Message.hxx>
#include <Standard_GUID.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
@@ -350,7 +351,7 @@ static Standard_Integer DDataStd_OpenNode (Draw_Interpretor& di,
Handle(DDataStd_TreeBrowser) browser = Handle(DDataStd_TreeBrowser)::DownCast (Draw::GetExisting (a[1]));
if (browser.IsNull())
{
std::cout << "Syntax error: browser '" << a[1] << "' not found\n";
Message::SendFail() << "Syntax error: browser '" << a[1] << "' not found";
return 1;
}
@@ -461,11 +462,9 @@ static Standard_Integer DDataStd_ChildNodeMore (Draw_Interpretor& di,
const char** /*a*/)
{
if (cni.More()) {
//std::cout<<"TRUE"<<std::endl;
di<<"TRUE\n";
}
else {
//std::cout<<"FALSE"<<std::endl;
di<<"FALSE\n";
}
return 0;
@@ -508,7 +507,6 @@ static Standard_Integer DDataStd_ChildNodeValue (Draw_Interpretor& di,
{
TCollection_AsciiString entry;
TDF_Tool::Entry(cni.Value()->Label(), entry);
//std::cout<<entry<<std::endl;
di <<entry<<"\n";
return 0;
}

View File

@@ -326,13 +326,13 @@ static Standard_Integer DDocStd_SaveAs (Draw_Interpretor& di,
//purpose :
//=======================================================================
static Standard_Integer DDocStd_Close (Draw_Interpretor& /*theDI*/,
static Standard_Integer DDocStd_Close (Draw_Interpretor& theDI,
Standard_Integer theArgNb,
const char** theArgVec)
{
if (theArgNb != 2)
{
std::cout << "DDocStd_Close : Error\n";
theDI << "DDocStd_Close : Error\n";
return 1;
}

View File

@@ -461,7 +461,7 @@ static Standard_Integer DNaming_ImportShape (Draw_Interpretor& di,
DDF::ReturnLabel(di, L);
return 0;
}
std::cout << "DNaming_NewShape : Error" << std::endl;
di << "DNaming_NewShape : Error";
return 1;
}
//=======================================================================

View File

@@ -22,6 +22,7 @@
#include <BRepTools.hxx>
#include <BRep_Builder.hxx>
#include <gp_Trsf.hxx>
#include <Message.hxx>
#include <TopAbs.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
@@ -333,7 +334,7 @@ static Standard_Integer DNaming_AddBox (Draw_Interpretor& theDI,
DDF::ReturnLabel(theDI, anObj->Label());
return 0;
}
std::cout << "DNaming_AddBox : Error" << std::endl;
Message::SendFail() << "DNaming_AddBox : Error";
return 1;
}
@@ -385,7 +386,7 @@ static Standard_Integer DNaming_BoxDX (Draw_Interpretor& theDI,
return 0;
}
}
std::cout << "DNaming_BoxDX : Error" << std::endl;
Message::SendFail() << "DNaming_BoxDX : Error";
return 1;
}
@@ -418,7 +419,7 @@ static Standard_Integer DNaming_BoxDY (Draw_Interpretor& theDI,
return 0;
}
}
std::cout << "DNaming_BoxDY : Error" << std::endl;
Message::SendFail() << "DNaming_BoxDY : Error";
return 1;
}
@@ -451,7 +452,7 @@ static Standard_Integer DNaming_BoxDZ (Draw_Interpretor& theDI,
return 0;
}
}
std::cout << "DNaming_BoxDZ : Error" << std::endl;
Message::SendFail() << "DNaming_BoxDZ : Error";
return 1;
}
@@ -525,7 +526,7 @@ static Standard_Integer DNaming_SolveFlatFrom (Draw_Interpretor& /*theDI*/,
logbook->Clear();
Standard_Integer aRes = ComputeFunction(aFun, logbook);
if(aRes != 0) {
std::cout << "DNaming_SolveFlatFrom: Driver failed at label = " << entry << std::endl;
Message::SendFail() << "DNaming_SolveFlatFrom: Driver failed at label = " << entry;
return 1;
}
#ifdef OCCT_DEBUG
@@ -539,7 +540,7 @@ static Standard_Integer DNaming_SolveFlatFrom (Draw_Interpretor& /*theDI*/,
return 0;
}
ERR:
std::cout << "DNaming_SolveFlatFrom : Error" << std::endl;
Message::SendFail() << "DNaming_SolveFlatFrom : Error";
return 1;
}
@@ -569,7 +570,7 @@ static Standard_Integer DNaming_InitLogBook (Draw_Interpretor& /*theDI*/,
}
return 0;
}
std::cout << "DNaming_InitLogBook : Error - No document ==> " <<theNb <<std::endl;
Message::SendFail() << "DNaming_InitLogBook : Error - No document ==> " << theNb;
return 1;
}
@@ -600,7 +601,7 @@ static Standard_Integer DNaming_CheckLogBook (Draw_Interpretor& /*theDI*/,
}
return 0;
}
std::cout << "DNaming_CheckLogBook : Error - No document ==> " <<theNb <<std::endl;
Message::SendFail() << "DNaming_CheckLogBook : Error - No document ==> " << theNb;
return 1;
}
@@ -625,17 +626,18 @@ static Standard_Integer DNaming_ComputeFun (Draw_Interpretor& /*theDI*/,
if(!aFun.IsNull()) {
Handle(TFunction_Logbook) logbook = TFunction_Logbook::Set(funLabel);
Standard_Integer aRes = ComputeFunction(aFun, logbook);
if(aRes != 0) {
std::cout << "DNaming_ComputeFun : No Driver or Driver failed" << std::endl;
return 1;
}
if(aRes != 0)
{
Message::SendFail() << "DNaming_ComputeFun : No Driver or Driver failed";
return 1;
}
#ifdef OCCT_DEBUG
std::cout <<"DNaming_ComputeFun : function from label " << theArg[2] << " is recomputed" << std::endl;
#endif
return 0;
}
}
std::cout << "DNaming_ComputeFun : Error" << std::endl;
Message::SendFail() << "DNaming_ComputeFun : Error";
return 1;
}
@@ -723,7 +725,7 @@ static Standard_Integer DNaming_AttachShape (Draw_Interpretor& di,
}
} //###
}
std::cout << "DNaming_AttachShape : Error" << std::endl;
Message::SendFail() << "DNaming_AttachShape : Error";
return 1;
}
@@ -788,7 +790,7 @@ static Standard_Integer DNaming_XAttachShape (Draw_Interpretor& di,
}
}
}
std::cout << "DNaming_XAttachShape : Error" << std::endl;
Message::SendFail() << "DNaming_XAttachShape : Error";
return 1;
}
@@ -829,7 +831,7 @@ static Standard_Integer DNaming_AddCylinder (Draw_Interpretor& theDI,
DDF::ReturnLabel(theDI, anObj->Label());
return 0;
}
std::cout << "DNaming_AddCylinder : Error" << std::endl;
Message::SendFail() << "DNaming_AddCylinder : Error";
return 1;
}
@@ -862,7 +864,7 @@ static Standard_Integer DNaming_CylRad (Draw_Interpretor& theDI,
return 0;
}
}
std::cout << "DNaming_CylRadius : Error" << std::endl;
Message::SendFail() << "DNaming_CylRadius : Error";
return 1;
}
@@ -895,7 +897,7 @@ static Standard_Integer DNaming_CylRad (Draw_Interpretor& theDI,
DDF::ReturnLabel(theDI, aFun->Label());
return 0;
}
std::cout << "DModel_AddFuse : Error" << std::endl;
Message::SendFail() << "DModel_AddFuse : Error";
return 1;
}
@@ -929,7 +931,7 @@ static Standard_Integer DNaming_CylRad (Draw_Interpretor& theDI,
DDF::ReturnLabel(theDI, aFun->Label());
return 0;
}
std::cout << "DModel_AddCut : Error" << std::endl;
Message::SendFail() << "DModel_AddCut : Error";
return 1;
}
@@ -962,7 +964,7 @@ static Standard_Integer DNaming_CylRad (Draw_Interpretor& theDI,
DDF::ReturnLabel(theDI, aFun->Label());
return 0;
}
std::cout << "DModel_AddComm : Error" << std::endl;
Message::SendFail() << "DModel_AddComm : Error";
return 1;
}
@@ -994,7 +996,7 @@ static Standard_Integer DNaming_CylRad (Draw_Interpretor& theDI,
DDF::ReturnLabel(theDI, aFun->Label());
return 0;
}
std::cout << "DModel_AddSection : Error" << std::endl;
Message::SendFail() << "DModel_AddSection : Error";
return 1;
}
@@ -1007,7 +1009,7 @@ static Standard_Integer DNaming_AddFillet (Draw_Interpretor& theDI,
const char** theArg)
{
if (theNb < 5) {
std::cout<<"DNaming_AddFillet(): Wrong number of arguments"<<std::endl;
Message::SendFail() << "DNaming_AddFillet(): Wrong number of arguments";
return 1;
}
@@ -1079,7 +1081,7 @@ static Standard_Integer DNaming_PTranslateDXYZ (Draw_Interpretor& di,
DDF::ReturnLabel(di, aFun->Label());
return 0;
}
std::cout << "DNaming_Translate : Error" << std::endl;
Message::SendFail() << "DNaming_Translate : Error";
return 1;
}
//=======================================================================
@@ -1118,7 +1120,7 @@ static Standard_Integer DNaming_PTranslateLine (Draw_Interpretor& di,
DDF::ReturnLabel(di, aFun->Label());
return 0;
}
std::cout << "DNaming_PTranslateAlongLine : Error" << std::endl;
Message::SendFail() << "DNaming_PTranslateAlongLine : Error";
return 1;
}
@@ -1157,7 +1159,7 @@ static Standard_Integer DNaming_PRotateLine(Draw_Interpretor& di,
DDF::ReturnLabel(di, aFun->Label());
return 0;
}
std::cout << "DNaming_PRotateRoundLine : Error" << std::endl;
Message::SendFail() << "DNaming_PRotateRoundLine : Error";
return 1;
}
@@ -1190,7 +1192,7 @@ static Standard_Integer DNaming_PMirrorObject(Draw_Interpretor& di,
DDF::ReturnLabel(di, aFun->Label());
return 0;
}
std::cout << "DNaming_PMirrorObject : Error" << std::endl;
Message::SendFail() << "DNaming_PMirrorObject : Error";
return 1;
}
//=======================================================================
@@ -1202,7 +1204,7 @@ static Standard_Integer DNaming_AddPrism (Draw_Interpretor& theDI,
const char** theArg)
{
if (theNb < 5 ) {
std::cout<<"DNaming_AddPrism(): Wrong number of arguments"<<std::endl;
Message::SendFail() << "DNaming_AddPrism(): Wrong number of arguments";
return 1;
}
//
@@ -1260,7 +1262,7 @@ static Standard_Integer DNaming_PrismHeight (Draw_Interpretor& theDI,
}
}
std::cout << "DNaming_PrismHeight : Error" << std::endl;
Message::SendFail() << "DNaming_PrismHeight : Error";
return 1;
}
@@ -1275,7 +1277,7 @@ static Standard_Integer DNaming_AddRevol (Draw_Interpretor& theDI,
const char** theArg)
{
if (theNb < 4 ) {
std::cout<<"DNaming_AddRevol(): Wrong number of arguments"<<std::endl;
Message::SendFail() << "DNaming_AddRevol(): Wrong number of arguments";
return 1;
}
@@ -1352,7 +1354,7 @@ static Standard_Integer DNaming_RevolutionAngle (Draw_Interpretor& theDI,
return 0;
}
}
std::cout << "DNaming_RevolutionAngle : Error" << std::endl;
Message::SendFail() << "DNaming_RevolutionAngle : Error";
return 1;
}
@@ -1365,7 +1367,7 @@ static Standard_Integer DNaming_AddSphere (Draw_Interpretor& theDI,
const char** theArg)
{
if (theNb != 4) {
std::cout<<"DNaming_AddSphere(): Wrong number of arguments"<<std::endl;
Message::SendFail() << "DNaming_AddSphere(): Wrong number of arguments";
return 1;
}
Handle(TDocStd_Document) aDocument;
@@ -1421,7 +1423,7 @@ static Standard_Integer DNaming_SphereRadius (Draw_Interpretor& theDI,
}
}
std::cout << "DNaming_SphRadius : Error" << std::endl;
Message::SendFail() << "DNaming_SphRadius : Error";
return 1;
}
//=======================================================================
@@ -1459,7 +1461,8 @@ static Standard_Integer DNaming_AddPoint (Draw_Interpretor& theDI,
DDF::ReturnLabel(theDI, anObj->Label());
return 0;
}
std::cout << "DNaming_AddPoint : Error" << std::endl;
Message::SendFail() << "DNaming_AddPoint : Error";
return 1;
}
@@ -1504,7 +1507,8 @@ static Standard_Integer DNaming_AddPointRlt (Draw_Interpretor& theDI,
DDF::ReturnLabel(theDI, anObj->Label());
return 0;
}
std::cout << "DNaming_AddPoint : Error" << std::endl;
Message::SendFail() << "DNaming_AddPoint : Error";
return 1;
}
@@ -1558,7 +1562,8 @@ static Standard_Integer DNaming_PntOffset (Draw_Interpretor& theDI,
return 0;
}
}
std::cout << "DNaming_PntOffset : Error" << std::endl;
Message::SendFail() << "DNaming_PntOffset : Error";
return 1;
}
@@ -1572,7 +1577,7 @@ static Standard_Integer DNaming_Line3D (Draw_Interpretor& theDI,
const char** theArg)
{
if (theNb < 5) {
std::cout<<"DNaming_AddLine3D: Wrong number of arguments"<<std::endl;
Message::SendFail() << "DNaming_AddLine3D: Wrong number of arguments";
return 1;
}
Handle(TDocStd_Document) aDocument;
@@ -1992,7 +1997,7 @@ static Standard_Integer DNaming_TestSingle (Draw_Interpretor& theDI,
}
}
std::cout << "DNaming_TestSingle : Error" << std::endl;
Message::SendFail() << "DNaming_TestSingle : Error";
return 1;
}
@@ -2118,7 +2123,7 @@ static Standard_Integer DNaming_Multiple (Draw_Interpretor& theDI,
}
}
std::cout << "DNaming_TestMultiple : Error" << std::endl;
Message::SendFail() << "DNaming_TestMultiple : Error";
return 1;
}

View File

@@ -59,7 +59,7 @@ extern Standard_Boolean Draw_ParseFailed;
Standard_EXPORT Draw_Viewer dout;
Standard_EXPORT Draw_Interpretor theCommands;
Standard_EXPORT Standard_Boolean Draw_Batch;
Standard_EXPORT Standard_Boolean Draw_Batch = Standard_False;
Standard_EXPORT Standard_Boolean Draw_Spying = Standard_False;
Standard_EXPORT Standard_Boolean Draw_Chrono = Standard_False;
Standard_EXPORT Standard_Boolean Draw_VirtualWindows = Standard_False;
@@ -504,14 +504,7 @@ void Draw_Appli(int argc, char** argv, const FDraw_InitAppli Draw_InitAppli)
if (!isInteractiveForced)
{
// disable console messages colorization to avoid spoiling log with color codes
for (Message_SequenceOfPrinters::Iterator aPrinterIter (Message::DefaultMessenger()->Printers());
aPrinterIter.More(); aPrinterIter.Next())
{
if (Handle(Message_PrinterOStream) aPrinter = Handle(Message_PrinterOStream)::DownCast (aPrinterIter.Value()))
{
aPrinter->SetToColorize (Standard_False);
}
}
theCommands.SetToColorize (Standard_False);
}
ReadInitFile (aRunFile);
// provide a clean exit, this is useful for some analysis tools
@@ -637,7 +630,15 @@ Standard_Boolean Draw_Interprete(const char* com)
if (*theCommands.Result())
{
if (c > 0 && theCommands.ToColorize())
{
Message_PrinterOStream::SetConsoleTextColor (&std::cout, Message_ConsoleColor_Red, true);
}
std::cout << theCommands.Result() << std::endl;
if (c > 0 && theCommands.ToColorize())
{
Message_PrinterOStream::SetConsoleTextColor (&std::cout, Message_ConsoleColor_Default, false);
}
}
if (Draw_Chrono && hadchrono) {

View File

@@ -259,9 +259,9 @@ static Standard_Integer dlog(Draw_Interpretor& di, Standard_Integer n, const cha
{
if (n != 2 && n != 3)
{
std::cout << "Enable or disable logging: " << a[0] << " {on|off}" << std::endl;
std::cout << "Reset log: " << a[0] << " reset" << std::endl;
std::cout << "Get log content: " << a[0] << " get" << std::endl;
Message::SendFail() << "Enable or disable logging: " << a[0] << " {on|off}\n"
<< "Reset log: " << a[0] << " reset\n"
<< "Get log content: " << a[0] << " get";
return 1;
}
@@ -292,7 +292,7 @@ static Standard_Integer dlog(Draw_Interpretor& di, Standard_Integer n, const cha
di << (di.GetDoLog() ? "on" : "off");
}
else {
std::cout << "Unrecognized option(s): " << a[1] << std::endl;
Message::SendFail() << "Unrecognized option(s): " << a[1];
return 1;
}
return 0;
@@ -302,7 +302,7 @@ static Standard_Integer decho(Draw_Interpretor& di, Standard_Integer n, const ch
{
if (n != 2)
{
std::cout << "Enable or disable echoing: " << a[0] << " {on|off}" << std::endl;
Message::SendFail() << "Enable or disable echoing: " << a[0] << " {on|off}";
return 1;
}
@@ -315,7 +315,7 @@ static Standard_Integer decho(Draw_Interpretor& di, Standard_Integer n, const ch
di.SetDoEcho (Standard_False);
}
else {
std::cout << "Unrecognized option: " << a[1] << std::endl;
Message::SendFail() << "Unrecognized option: " << a[1];
return 1;
}
return 0;
@@ -762,7 +762,7 @@ static int dlocale (Draw_Interpretor& di, Standard_Integer n, const char** argv)
else if ( ! strcmp (cat, "LC_TIME") ) category = LC_TIME;
else
{
std::cout << "Error: cannot recognize argument " << cat << " as one of LC_ macros" << std::endl;
Message::SendFail() << "Error: cannot recognize argument " << cat << " as one of LC_ macros";
return 1;
}
}
@@ -884,7 +884,7 @@ static int dparallel (Draw_Interpretor& theDI,
const Standard_Integer aVal = Draw::Atoi (theArgVec[++anIter]);
if (aVal <= 0 || aVal > aDefPool->NbThreads())
{
std::cout << "Syntax error: maximum number of threads to use should be <= of threads in the pool\n";
Message::SendFail() << "Syntax error: maximum number of threads to use should be <= of threads in the pool";
return 1;
}
aDefPool->SetNbDefaultThreadsToLaunch (aVal);
@@ -915,7 +915,7 @@ static int dparallel (Draw_Interpretor& theDI,
}
else
{
std::cout << "Syntax error: unknown argument '" << anArg << "'\n";
Message::SendFail() << "Syntax error: unknown argument '" << anArg << "'";
return 1;
}
}
@@ -989,7 +989,7 @@ static int dsetsignal (Draw_Interpretor& theDI, Standard_Integer theArgNb, const
}
else
{
std::cout << "Syntax error: unknown argument '" << anArg << "'\n";
Message::SendFail() << "Syntax error: unknown argument '" << anArg << "'";
return 1;
}
}
@@ -1023,7 +1023,7 @@ static int dtracelevel (Draw_Interpretor& theDI,
Message_Gravity aLevel = Message_Info;
if (theArgNb < 1 || theArgNb > 2)
{
std::cout << "Error: wrong number of arguments! See usage:\n";
Message::SendFail() << "Error: wrong number of arguments! See usage:";
theDI.PrintHelp (theArgVec[0]);
return 1;
}
@@ -1054,7 +1054,7 @@ static int dtracelevel (Draw_Interpretor& theDI,
}
else
{
std::cout << "Error: unknown gravity '" << theArgVec[1] << "'!\n";
Message::SendFail() << "Error: unknown gravity '" << theArgVec[1] << "'";
return 1;
}
}
@@ -1062,14 +1062,14 @@ static int dtracelevel (Draw_Interpretor& theDI,
Handle(Message_Messenger) aMessenger = Message::DefaultMessenger();
if (aMessenger.IsNull())
{
std::cout << "Error: default messenger is unavailable!\n";
Message::SendFail() << "Error: default messenger is unavailable";
return 1;
}
Message_SequenceOfPrinters& aPrinters = aMessenger->ChangePrinters();
if (aPrinters.Length() < 1)
{
std::cout << "Error: no printers registered in default Messenger!\n";
Message::SendFail() << "Error: no printers registered in default Messenger";
return 0;
}
@@ -1108,7 +1108,7 @@ static int dtracelevel (Draw_Interpretor& theDI,
//function : dputs
//purpose :
//==============================================================================
static int dputs (Draw_Interpretor& ,
static int dputs (Draw_Interpretor& theDI,
Standard_Integer theArgNb,
const char** theArgVec)
{
@@ -1169,6 +1169,11 @@ static int dputs (Draw_Interpretor& ,
}
else if (anArgIter + 1 == theArgNb)
{
if (!theDI.ToColorize())
{
toIntense = false;
aColor = Message_ConsoleColor_Default;
}
if (toIntense || aColor != Message_ConsoleColor_Default)
{
Message_PrinterOStream::SetConsoleTextColor (aStream, aColor, toIntense);

View File

@@ -18,10 +18,6 @@
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Bnd_OBB.hxx>
#include <Bnd_Box.hxx>
#include <Draw_Box.hxx>
// This file defines global functions not declared in any public header,
// intended for use from debugger prompt (Command Window in Visual Studio)
@@ -44,47 +40,3 @@ Standard_EXPORT const char* Draw_Eval (const char *theCommandStr)
return anException.GetMessageString();
}
}
//=======================================================================
//function : DBRep_SetOBB
//purpose : Draw OBB
//=======================================================================
Standard_EXPORT const char* Draw_SetOBB(const char* theNameStr, void* theBox)
{
if (theNameStr == 0 || theBox == 0)
{
return "Error: name or box is null";
}
try {
Bnd_OBB B = *(Bnd_OBB*)theBox;
Handle(Draw_Box) DB = new Draw_Box (B, Draw_orange);
Draw::Set (theNameStr, DB);
return theNameStr;
}
catch (Standard_Failure const& anException)
{
return anException.GetMessageString();
}
}
//=======================================================================
//function : DBRep_SetBox
//purpose : Draw Box
//=======================================================================
Standard_EXPORT const char* Draw_SetBox(const char* theNameStr, void* theBox)
{
if (theNameStr == 0 || theBox == 0)
{
return "Error: name or box is null";
}
try {
Bnd_Box B = *(Bnd_Box*)theBox;
Handle(Draw_Box) DB = new Draw_Box (B, Draw_orange);
Draw::Set (theNameStr, DB);
return theNameStr;
}
catch (Standard_Failure const& anException)
{
return anException.GetMessageString();
}
}

View File

@@ -25,6 +25,7 @@
#include <Draw_ProgressIndicator.hxx>
#include <Draw_Text2D.hxx>
#include <Draw_Text3D.hxx>
#include <Message.hxx>
#include <Standard_Stream.hxx>
#include <TCollection_AsciiString.hxx>
@@ -195,12 +196,12 @@ static Standard_Integer wzoom(Draw_Interpretor& di, Standard_Integer argc, const
id = atoi(argv[1]);
if ((id < 0) || (id >= MAXVIEW))
{
std::cout << "Incorrect view-id, must be in 0.."<<MAXVIEW-1<<std::endl;
Message::SendFail() << "Incorrect view-id, must be in 0.." << (MAXVIEW-1);
return 1;
}
if (!dout.HasView(id))
{
std::cout <<"View "<<id<<" does not exist."<<std::endl;
Message::SendFail() << "View " << id << " does not exist";
return 1;
}
X1 = atoi (argv [2]);

View File

@@ -15,18 +15,20 @@
// commercial license or contractual agreement.
#include <Draw_Interpretor.hxx>
#include <Draw_Appli.hxx>
#include <Message.hxx>
#include <Message_PrinterOStream.hxx>
#include <OSD.hxx>
#include <OSD_File.hxx>
#include <OSD_Path.hxx>
#include <OSD_Process.hxx>
#include <Standard_SStream.hxx>
#include <Standard_RangeError.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Macro.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <OSD_Process.hxx>
#include <OSD_Path.hxx>
#include <OSD.hxx>
#include <OSD_File.hxx>
#include <string.h>
#include <tcl.h>
@@ -114,8 +116,7 @@ namespace {
static Standard_Integer CommandCmd (ClientData theClientData, Tcl_Interp* interp, Standard_Integer argc, const char* argv[])
{
static Standard_Integer code;
code = TCL_OK;
Standard_Integer code = TCL_OK;
Draw_Interpretor::CallBackData* aCallback = (Draw_Interpretor::CallBackData* )theClientData;
Draw_Interpretor& di = *(aCallback->myDI);
@@ -143,24 +144,26 @@ static Standard_Integer CommandCmd (ClientData theClientData, Tcl_Interp* interp
dumpArgs (std::cout, argc, argv);
// run command
try {
try
{
OCC_CATCH_SIGNALS
// get exception if control-break has been pressed
OSD::ControlBreak();
// OCC680: Transfer UTF-8 directly to OCC commands without locale usage
Standard_Integer fres = aCallback->Invoke ( di, argc, argv /*anArgs.GetArgv()*/ );
if (fres != 0)
if (fres != 0)
{
code = TCL_ERROR;
}
}
catch (Standard_Failure const& anException) {
catch (Standard_Failure const& anException)
{
// fail if Draw_ExitOnCatch is set
std::cout << "An exception was caught " << anException << std::endl;
const char* toExitOnCatch = Tcl_GetVar (interp, "Draw_ExitOnCatch", TCL_GLOBAL_ONLY);
if (toExitOnCatch != NULL && Draw::Atoi (toExitOnCatch))
{
Message::SendFail() << "An exception was caught " << anException;
#ifdef _WIN32
Tcl_Exit(0);
#else
@@ -168,18 +171,17 @@ static Standard_Integer CommandCmd (ClientData theClientData, Tcl_Interp* interp
#endif
}
// get the error message
Standard_SStream ss;
ss << "** Exception ** " << anException << std::ends;
ss << "An exception was caught " << anException << std::ends;
Tcl_SetResult(interp,(char*)(ss.str().c_str()),TCL_VOLATILE);
code = TCL_ERROR;
}
catch (std::exception const& theStdException)
{
std::cout << "An exception was caught " << theStdException.what() << " [" << typeid(theStdException).name() << "]" << std::endl;
const char* toExitOnCatch = Tcl_GetVar (interp, "Draw_ExitOnCatch", TCL_GLOBAL_ONLY);
if (toExitOnCatch != NULL && Draw::Atoi (toExitOnCatch))
{
Message::SendFail() << "An exception was caught " << theStdException.what() << " [" << typeid(theStdException).name() << "]";
#ifdef _WIN32
Tcl_Exit (0);
#else
@@ -187,18 +189,17 @@ static Standard_Integer CommandCmd (ClientData theClientData, Tcl_Interp* interp
#endif
}
// get the error message
Standard_SStream ss;
ss << "** Exception ** " << theStdException.what() << " [" << typeid(theStdException).name() << "]" << std::ends;
Tcl_SetResult (interp, (char*)(ss.str().c_str()), TCL_VOLATILE);
ss << "An exception was caught " << theStdException.what() << " [" << typeid(theStdException).name() << "]" << std::ends;
Tcl_SetResult(interp,(char*)(ss.str().c_str()),TCL_VOLATILE);
code = TCL_ERROR;
}
catch (...)
{
std::cout << "UNKNOWN exception was caught " << std::endl;
const char* toExitOnCatch = Tcl_GetVar (interp, "Draw_ExitOnCatch", TCL_GLOBAL_ONLY);
if (toExitOnCatch != NULL && Draw::Atoi (toExitOnCatch))
{
Message::SendFail() << "UNKNOWN exception was caught ";
#ifdef _WIN32
Tcl_Exit (0);
#else
@@ -206,10 +207,9 @@ static Standard_Integer CommandCmd (ClientData theClientData, Tcl_Interp* interp
#endif
}
// get the error message
Standard_SStream ss;
ss << "** Exception ** UNKNOWN" << std::ends;
Tcl_SetResult (interp, (char* )(ss.str().c_str()), TCL_VOLATILE);
ss << "UNKNOWN exception was caught " << std::ends;
Tcl_SetResult(interp,(char*)(ss.str().c_str()),TCL_VOLATILE);
code = TCL_ERROR;
}
@@ -244,15 +244,34 @@ static void CommandDelete (ClientData theClientData)
//=======================================================================
//function : Draw_Interpretor
//purpose :
//purpose :
//=======================================================================
Draw_Interpretor::Draw_Interpretor() :
isAllocated(Standard_False), myDoLog(Standard_False), myDoEcho(Standard_False), myFDLog(-1)
Draw_Interpretor::Draw_Interpretor()
: // the tcl interpreter is not created immediately as it is kept
// by a global variable and created and deleted before the main()
myInterp (NULL),
isAllocated (Standard_False),
myDoLog (Standard_False),
myDoEcho (Standard_False),
myToColorize (Standard_True),
myFDLog (-1)
{
// The tcl interpreter is not created immediately as it is kept
// by a global variable and created and deleted before the main().
myInterp = NULL;
//
}
//=======================================================================
//function : Draw_Interpretor
//purpose :
//=======================================================================
Draw_Interpretor::Draw_Interpretor (const Draw_PInterp& theInterp)
: myInterp (theInterp),
isAllocated (Standard_False),
myDoLog (Standard_False),
myDoEcho (Standard_False),
myToColorize (Standard_True),
myFDLog (-1)
{
//
}
//=======================================================================
@@ -269,17 +288,20 @@ void Draw_Interpretor::Init()
}
//=======================================================================
//function : Draw_Interpretor
//purpose :
//function : SetToColorize
//purpose :
//=======================================================================
Draw_Interpretor::Draw_Interpretor(const Draw_PInterp& p) :
isAllocated(Standard_False),
myInterp(p),
myDoLog(Standard_False),
myDoEcho(Standard_False),
myFDLog(-1)
void Draw_Interpretor::SetToColorize (Standard_Boolean theToColorize)
{
myToColorize = theToColorize;
for (Message_SequenceOfPrinters::Iterator aPrinterIter (Message::DefaultMessenger()->Printers());
aPrinterIter.More(); aPrinterIter.Next())
{
if (Handle(Message_PrinterOStream) aPrinter = Handle(Message_PrinterOStream)::DownCast (aPrinterIter.Value()))
{
aPrinter->SetToColorize (theToColorize);
}
}
}
//=======================================================================

View File

@@ -251,6 +251,12 @@ public:
//! Returns current value of the log file descriptor
Standard_Integer GetLogFileDescriptor() { return myFDLog; }
//! Return TRUE if console output should be colorized; TRUE by default.
Standard_Boolean ToColorize() const { return myToColorize; }
//! Set if console output should be colorized.
Standard_EXPORT void SetToColorize (Standard_Boolean theToColorize);
protected:
Standard_EXPORT void add (Standard_CString theCommandName,
@@ -261,10 +267,11 @@ protected:
private:
Standard_Boolean isAllocated;
Draw_PInterp myInterp;
Standard_Boolean isAllocated;
Standard_Boolean myDoLog;
Standard_Boolean myDoEcho;
Standard_Boolean myToColorize;
Standard_Integer myFDLog; //!< file descriptor of log file
public:

View File

@@ -258,7 +258,7 @@ static Standard_Integer dtryload (Draw_Interpretor& di, Standard_Integer n, cons
{
if (n != 2)
{
std::cout << "Error: specify path to library to be loaded" << std::endl;
Message::SendFail() << "Error: specify path to library to be loaded";
return 1;
}

View File

@@ -25,6 +25,7 @@
#include <Draw_Number.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <Draw_SequenceOfDrawable3D.hxx>
#include <Message.hxx>
#include <NCollection_Map.hxx>
#include <Standard_SStream.hxx>
#include <Standard_Stream.hxx>
@@ -388,7 +389,7 @@ static Standard_Integer draw(Draw_Interpretor& , Standard_Integer n, const char*
if (n < 3) return 1;
Standard_Integer id = Draw::Atoi(a[1]);
if (!dout.HasView(id)) {
std::cout << "bad view number in draw"<<std::endl;
Message::SendFail() << "bad view number in draw";
return 1;
}
Standard_Integer mo = Draw::Atoi(a[2]);
@@ -587,7 +588,7 @@ static Standard_Integer set(Draw_Interpretor& di, Standard_Integer n, const char
static Standard_Integer dsetenv(Draw_Interpretor& /*di*/, Standard_Integer argc, const char** argv)
{
if (argc < 2) {
std::cout << "Use: " << argv[0] << " {varname} [value]" << std::endl;
Message::SendFail() << "Use: " << argv[0] << " {varname} [value]";
return 1;
}
@@ -610,7 +611,7 @@ static Standard_Integer dsetenv(Draw_Interpretor& /*di*/, Standard_Integer argc,
static Standard_Integer dgetenv(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc < 2) {
std::cout << "Use: " << argv[0] << " {varname}" << std::endl;
Message::SendFail() << "Use: " << argv[0] << " {varname}";
return 1;
}

View File

@@ -1319,6 +1319,7 @@ proc _run_test {scriptsdir group gridname casefile echo} {
# evaluate test case
set tmp_imagedir 0
set anExcep ""
if [catch {
# set variables identifying test case
uplevel set casename [file tail $casefile]
@@ -1368,13 +1369,15 @@ proc _run_test {scriptsdir group gridname casefile echo} {
uplevel source -encoding utf-8 $scriptsdir/$group/end
}
} res] {
puts "Tcl Exception: $res"
set anExcep $res
if { "$res" == "" } { set anExcep "EMPTY" }
}
# stop logging
if { $dlog_exists } {
if { $echo } {
decho off
if { "$anExcep" != "" } { dputs -red -intense "Tcl Exception: $res" }
} else {
rename puts {}
rename puts-saved puts

View File

@@ -42,7 +42,6 @@
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Root.hxx>
#include <Quantity_Color.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
@@ -109,7 +108,7 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
aPresentation->CurrentGroup()->AddPrimitiveArray (anArrayOfPoints);
}
break;
}
@@ -119,7 +118,7 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
// On dessine un rond
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt2.X(), pt2.Y(), pt2.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
aPresentation->CurrentGroup()->AddPrimitiveArray (anArrayOfPoints);
break;
}

View File

@@ -161,7 +161,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(12);
for( i = 0; i <= 11; i++ )
aPrims->AddVertex(ElCLib::Value(param + angle/11 * i, aCircle2));
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
DsgPrs::ComputeSymbol(aPresentation, aDimensionAspect, AttachmentPnt,
AttachmentPnt, aDir, aDir, DsgPrs_AS_LASTAR);
@@ -171,7 +171,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
param = ElCLib::Parameter(aCircle2, tmpPnt);
tmpPnt = ElCLib::Value(param, aCircle2);
tmpPnt = tmpPnt.Translated(gp_Vec(0, 0, -2));
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (aPresentation), aDimensionAspect->TextAspect(), txt, tmpPnt);
Prs3d_Text::Draw (aPresentation->CurrentGroup(), aDimensionAspect->TextAspect(), txt, tmpPnt);
angle = 2. * M_PI - param ;
if( param > OppParam )
@@ -180,7 +180,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
aPrims = new Graphic3d_ArrayOfPolylines(12);
for( i = 11; i >= 0; i-- )
aPrims->AddVertex(ElCLib::Value(-angle/11 * i, aCircle2));
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
}
if( AboveInBelowCone( VmaxCircle, VminCircle, myCircle ) == 1 && !IsConeTrimmed ) //above
@@ -204,7 +204,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
aPrims->AddVertex(OppositePnt);
aPrims->AddVertex(( aPnt.Distance(P1) < aPnt.Distance(P2) )? P11 : P12);
}
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
}
@@ -230,7 +230,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
sprintf(valcar,"%5.2f",theval);
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPresentation);
Handle(Graphic3d_Group) aGroup = aPresentation->CurrentGroup();
aGroup->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Ax2 ax(CenterPoint,axisdir,dir1);
@@ -343,7 +343,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
sprintf(valcar,"%5.2f",theval);
Handle( Prs3d_DimensionAspect ) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup( aPresentation )->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
aPresentation->CurrentGroup()->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
gp_Circ AngleCirc, AttachCirc;
Standard_Real FirstParAngleCirc, LastParAngleCirc, FirstParAttachCirc, LastParAttachCirc;
@@ -385,7 +385,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
for (Standard_Integer i = 0; i < NodeNumber; i++, FirstParAngleCirc += delta)
aPrims->AddVertex(ElCLib::Value( FirstParAngleCirc, AngleCirc ));
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
aPrims = new Graphic3d_ArrayOfSegments(4);
}
else // null angle
@@ -399,7 +399,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
DsgPrs::ComputeSymbol( aPresentation, LA, EndOfArrow1, EndOfArrow2, DirOfArrow1, DirOfArrow2, ArrowPrs );
// Drawing the text
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (aPresentation), LA->TextAspect(), aText, OffsetPoint);
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, OffsetPoint);
// Line from AttachmentPoint1 to end of Arrow1
aPrims->AddVertex(AttachmentPoint1);
@@ -408,7 +408,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
aPrims->AddVertex(ProjAttachPoint2);
aPrims->AddVertex(EndOfArrow2);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
// Line or arc from AttachmentPoint2 to its "projection"
if (AttachmentPoint2.Distance( ProjAttachPoint2 ) > Precision::Confusion())
@@ -431,7 +431,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
for (Standard_Integer i = 0; i < NodeNumber; i++, FirstParAttachCirc += delta)
aPrims->AddVertex(ElCLib::Value( FirstParAttachCirc, AttachCirc ));
}
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
}
}
@@ -457,7 +457,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
sprintf(valcar,"%5.2f",theval);
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Dir Norm;
if (!dir1.IsParallel(dir2, Precision::Angular())) {
@@ -515,7 +515,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
for (Standard_Integer i = 1; i<=nbp; i++)
aPrims->AddVertex(ElCLib::Value(udeb+ dteta*(i-1),cer));
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (aPresentation), LA->TextAspect(), aText,OffsetPoint);
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText,OffsetPoint);
Standard_Real length = LA->ArrowAspect()->Length();
if (length < Precision::Confusion()) length = 1.e-04;
@@ -534,7 +534,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
gp_Vec v2(ptarr,ptarr3);
const Standard_Real beta = v1.Angle(v2);
dirarr.Rotate(ax1, beta);
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation), ptarr, dirarr, LA->ArrowAspect()->Angle(), length);
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), ptarr, dirarr, LA->ArrowAspect()->Angle(), length);
aPrims->AddBound(2);
aPrims->AddVertex(AttachmentPoint1);
@@ -545,13 +545,13 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
ax1.SetLocation(ptarr);
gp_Dir dirarr2(vecarr);
dirarr2.Rotate(ax1, - beta);
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation), ptarr, dirarr2, LA->ArrowAspect()->Angle(), length);
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), ptarr, dirarr2, LA->ArrowAspect()->Angle(), length);
aPrims->AddBound(2);
aPrims->AddVertex(AttachmentPoint2);
aPrims->AddVertex(ptarr);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
}
@@ -576,7 +576,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
sprintf(valcar,"%5.2f",theval);
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Dir Norm = dir1.Crossed(dir2);
if (Abs(theval) > M_PI) Norm.Reverse();
@@ -626,7 +626,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
for (Standard_Integer i = 1; i<=nbp; i++)
aPrims->AddVertex(ElCLib::Value(udeb+ dteta*(i-1),cer));
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (aPresentation), LA->TextAspect(), aText, OffsetPoint);
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, OffsetPoint);
Standard_Real length = LA->ArrowAspect()->Length();
if (length < Precision::Confusion()) length = 1.e-04;
@@ -662,7 +662,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
aPrims->AddVertex(AttachmentPoint2);
aPrims->AddVertex(ptarr1);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
// One traces the arrows
DsgPrs::ComputeSymbol(aPresentation,LA,ptarr,ptarr1,dirarr,dirarr2,ArrowPrs);
@@ -692,7 +692,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
TCollection_ExtendedString aText(valas);
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Dir Norm = dir1.Crossed(dir2);
if (Abs(theval) > M_PI) Norm.Reverse();
@@ -742,7 +742,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
for (Standard_Integer i = 1; i<=nbp; i++)
aPrims->AddVertex(ElCLib::Value(udeb+ dteta*(i-1),cer));
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (aPresentation), LA->TextAspect(), aText, OffsetPoint);
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, OffsetPoint);
Standard_Real length = LA->ArrowAspect()->Length();
if (length < Precision::Confusion()) length = 1.e-04;
@@ -762,7 +762,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
const Standard_Real beta = v1.Angle(v2);
dirarr.Rotate(ax1, beta);
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation), ptarr, dirarr, LA->ArrowAspect()->Angle(), length);
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), ptarr, dirarr, LA->ArrowAspect()->Angle(), length);
aPrims->AddBound(2);
aPrims->AddVertex(AttachmentPoint1);
@@ -773,13 +773,13 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
gp_Dir dirarr2(vecarr);
dirarr2.Rotate(ax1, -beta);
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation), ptarr, dirarr2, LA->ArrowAspect()->Angle(), length);
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), ptarr, dirarr2, LA->ArrowAspect()->Angle(), length);
aPrims->AddBound(2);
aPrims->AddVertex(AttachmentPoint2);
aPrims->AddVertex(ptarr);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
}
void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
@@ -791,7 +791,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
const DsgPrs_ArrowSide ArrowSide)
{
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Dir dir1(gp_Vec(CenterPoint, AttachmentPoint1));
gp_Ax2 ax(CenterPoint,theAxe.Direction(),dir1);
@@ -803,7 +803,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp);
for (Standard_Integer i = 1; i<=nbp; i++)
aPrims->AddVertex(ElCLib::Value(dteta*(i-1),cer));
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
Standard_Real uc1 = 0.;
Standard_Real uc2 = ElCLib::Parameter(cer,AttachmentPoint1.Rotated(theAxe,theval));
@@ -818,21 +818,21 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
case DsgPrs_AS_FIRSTAR:
{
ElCLib::D1(uc1,cer,ptarr,vecarr);
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation), ptarr, gp_Dir(-vecarr), LA->ArrowAspect()->Angle(), length);
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), ptarr, gp_Dir(-vecarr), LA->ArrowAspect()->Angle(), length);
break;
}
case DsgPrs_AS_LASTAR:
{
ElCLib::D1(uc2,cer,ptarr,vecarr);
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation), ptarr, gp_Dir(vecarr), LA->ArrowAspect()->Angle(), length);
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), ptarr, gp_Dir(vecarr), LA->ArrowAspect()->Angle(), length);
break;
}
case DsgPrs_AS_BOTHAR:
{
ElCLib::D1(uc1,cer,ptarr,vecarr);
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation), ptarr, gp_Dir(-vecarr), LA->ArrowAspect()->Angle(), length);
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), ptarr, gp_Dir(-vecarr), LA->ArrowAspect()->Angle(), length);
ElCLib::D1(uc2,cer,ptarr,vecarr);
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation), ptarr, gp_Dir(vecarr), LA->ArrowAspect()->Angle(), length);
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), ptarr, gp_Dir(vecarr), LA->ArrowAspect()->Angle(), length);
break;
}
default: break;

View File

@@ -38,17 +38,17 @@ void DsgPrs_Chamf2dPresentation::Add(
{
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
aPrims->AddVertex(aPntAttach);
aPrims->AddVertex(aPntEnd);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
gp_Dir ArrowDir(aPntAttach.XYZ()-aPntEnd.XYZ());
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation), aPntAttach, ArrowDir, LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), aPntAttach, ArrowDir, LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (aPresentation), LA->TextAspect(), aText, aPntEnd);
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, aPntEnd);
}
@@ -67,14 +67,14 @@ void DsgPrs_Chamf2dPresentation::Add(
{
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
aPrims->AddVertex(aPntAttach);
aPrims->AddVertex(aPntEnd);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (aPresentation), LA->TextAspect(), aText, aPntEnd);
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, aPntEnd);
gp_Dir ArrowDir(aPntAttach.XYZ()-aPntEnd.XYZ());
gp_Dir ArrowDir1 = ArrowDir;

View File

@@ -14,7 +14,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <DsgPrs_ConcentricPresentation.hxx>
#include <ElCLib.hxx>
#include <gp_Circ.hxx>
@@ -26,7 +25,6 @@
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Root.hxx>
void DsgPrs_ConcentricPresentation::Add(
const Handle(Prs3d_Presentation)& aPresentation,
@@ -43,7 +41,7 @@ void DsgPrs_ConcentricPresentation::Add(
const Standard_Integer nbp = 50;
const Standard_Real dteta = (2. * M_PI)/nbp;
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(2*nbp+6,4);
@@ -90,5 +88,5 @@ void DsgPrs_ConcentricPresentation::Add(
aPrims->AddVertex(p1);
aPrims->AddVertex(p2);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
}

Some files were not shown because too many files have changed in this diff Show More