1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
dpasukhi
f5b7a266ca 0032186: PMI Visualization - PMIImportSavedView ignores assigned pmi
Fixed invalid setting View
Annotations & Notes links were ignored by XCAF
2021-04-22 22:45:26 +03:00
8353 changed files with 153715 additions and 154812 deletions

4
.gitattributes vendored
View File

@@ -1,8 +1,6 @@
.gitattributes eol=lf .gitattributes eol=lf
.gitignore eol=lf .gitignore eol=lf
*.txt eol=lf *.txt eol=lf
*.htm eol=lf
*.html eol=lf
*.h eol=lf *.h eol=lf
*.c eol=lf *.c eol=lf
*.inl eol=lf *.inl eol=lf
@@ -31,7 +29,6 @@
*.xib eol=lf *.xib eol=lf
*.plist eol=lf *.plist eol=lf
*.java eol=lf *.java eol=lf
*.js eol=lf
*.igs eol=lf *.igs eol=lf
*.iges eol=lf *.iges eol=lf
*.stp eol=lf *.stp eol=lf
@@ -47,7 +44,6 @@
FILES eol=lf FILES eol=lf
PACKAGES eol=lf PACKAGES eol=lf
EXTERNLIB eol=lf EXTERNLIB eol=lf
EXTERNLIB_STATIC eol=lf
UDLIST eol=lf UDLIST eol=lf
tests/* eol=lf tests/* eol=lf
tests/*/* eol=lf tests/*/* eol=lf

View File

@@ -56,20 +56,6 @@ set_property (GLOBAL PROPERTY OCC_VERSION_MAJOR ${OCC_VERSION_MAJOR})
set_property (GLOBAL PROPERTY OCC_VERSION_MINOR ${OCC_VERSION_MINOR}) set_property (GLOBAL PROPERTY OCC_VERSION_MINOR ${OCC_VERSION_MINOR})
set_property (GLOBAL PROPERTY OCC_VERSION_MAINTENANCE ${OCC_VERSION_MAINTENANCE}) set_property (GLOBAL PROPERTY OCC_VERSION_MAINTENANCE ${OCC_VERSION_MAINTENANCE})
# set soversion variable determining compatibility version on platforms with symlinks
# 0 - for empty, 1 - for major, 2 - for major.minor, 3 - for major.minor.maintenance
if (NOT BUILD_SOVERSION_NUMBERS)
set (BUILD_SOVERSION_NUMBERS "0" CACHE STRING "${BUILD_SOVERSION_NUMBERS_DESCR}" FORCE)
SET_PROPERTY(CACHE BUILD_SOVERSION_NUMBERS PROPERTY STRINGS 0 1 2 3)
# update default state of soversion on different platforms
if (WIN32 OR ANDROID OR EMSCRIPTEN)
set (BUILD_SOVERSION_NUMBERS 0)
else()
set (BUILD_SOVERSION_NUMBERS 2)
endif()
endif()
set (INSTALL_TEST_CASES OFF CACHE BOOL "${INSTALL_TEST_CASES_DESCR}") set (INSTALL_TEST_CASES OFF CACHE BOOL "${INSTALL_TEST_CASES_DESCR}")
# Regeneration of OCCT resource files # Regeneration of OCCT resource files
@@ -105,16 +91,6 @@ if (NOT DEFINED BUILD_RELEASE_DISABLE_EXCEPTIONS)
set (BUILD_RELEASE_DISABLE_EXCEPTIONS ON CACHE BOOL "${BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR}") set (BUILD_RELEASE_DISABLE_EXCEPTIONS ON CACHE BOOL "${BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR}")
endif() endif()
if (MSVC)
set (BUILD_FORCE_RelWithDebInfo OFF CACHE BOOL "${BUILD_FORCE_RelWithDebInfo_DESCR}")
else()
set (BUILD_FORCE_RelWithDebInfo OFF)
endif()
if (BUILD_FORCE_RelWithDebInfo)
set (CMAKE_CONFIGURATION_TYPES Release Debug CACHE INTERNAL "" FORCE)
endif()
# option to enable or disable use of precompiled headers # option to enable or disable use of precompiled headers
if (NOT DEFINED BUILD_USE_PCH) if (NOT DEFINED BUILD_USE_PCH)
set (BUILD_USE_PCH OFF CACHE BOOL "${BUILD_USE_PCH_DESCR}") set (BUILD_USE_PCH OFF CACHE BOOL "${BUILD_USE_PCH_DESCR}")
@@ -394,16 +370,13 @@ set (USE_FREEIMAGE OFF CACHE BOOL "${USE_FREEIMAGE_DESCR}")
set (USE_FFMPEG OFF CACHE BOOL "${USE_FFMPEG_DESCR}") set (USE_FFMPEG OFF CACHE BOOL "${USE_FFMPEG_DESCR}")
set (USE_OPENVR OFF CACHE BOOL "${USE_OPENVR_DESCR}") set (USE_OPENVR OFF CACHE BOOL "${USE_OPENVR_DESCR}")
set (USE_RAPIDJSON OFF CACHE BOOL "${USE_RAPIDJSON_DESCR}") set (USE_RAPIDJSON OFF CACHE BOOL "${USE_RAPIDJSON_DESCR}")
set (USE_DRACO OFF CACHE BOOL "${USE_DRACO_DESCR}")
set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}") set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}")
set (USE_EIGEN OFF CACHE BOOL "${USE_EIGEN_DESCR}") set (USE_EIGEN OFF CACHE BOOL "${USE_EIGEN_DESCR}")
if (WIN32 OR ANDROID OR IOS OR EMSCRIPTEN) if (APPLE)
# no Xlib set (USE_GLX OFF CACHE BOOL "${USE_GLX_DESCR}")
elseif (APPLE)
set (USE_XLIB OFF CACHE BOOL "${USE_XLIB_DESCR}")
else() else()
set (USE_XLIB ON CACHE BOOL "${USE_XLIB_DESCR}") set (USE_GLX OFF)
endif() endif()
if (WIN32) if (WIN32)
@@ -472,6 +445,12 @@ foreach (OCCT_MODULE ${OCCT_MODULES})
endif() endif()
endforeach() endforeach()
# DRAWEXE excluded when library build is static
if (NOT BUILD_SHARED_LIBS)
list (REMOVE_ITEM BUILD_TOOLKITS DRAWEXE)
message (STATUS "Info: DRAWEXE is not included due to ${BUILD_LIBRARY_TYPE} build library type")
endif()
# accumulate all used toolkits # accumulate all used toolkits
list (REMOVE_DUPLICATES BUILD_TOOLKITS) list (REMOVE_DUPLICATES BUILD_TOOLKITS)
set (RAW_BUILD_TOOLKITS) set (RAW_BUILD_TOOLKITS)
@@ -524,7 +503,6 @@ endif()
OCCT_IS_PRODUCT_REQUIRED (CSF_FreeImagePlus CAN_USE_FREEIMAGE) OCCT_IS_PRODUCT_REQUIRED (CSF_FreeImagePlus CAN_USE_FREEIMAGE)
OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL) OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL)
OCCT_IS_PRODUCT_REQUIRED (CSF_TclTkLibs CAN_USE_TK) OCCT_IS_PRODUCT_REQUIRED (CSF_TclTkLibs CAN_USE_TK)
OCCT_IS_PRODUCT_REQUIRED (CSF_XwLibs CAN_USE_XLIB)
OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE CAN_USE_FREETYPE) OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE CAN_USE_FREETYPE)
OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlLibs CAN_USE_OPENGL) OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlLibs CAN_USE_OPENGL)
OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlesLibs CAN_USE_GLES2) OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlesLibs CAN_USE_GLES2)
@@ -559,19 +537,6 @@ else()
OCCT_CHECK_AND_UNSET ("INSTALL_TK") OCCT_CHECK_AND_UNSET ("INSTALL_TK")
endif() endif()
# Xlib
if (CAN_USE_XLIB)
if (USE_XLIB)
message (STATUS "Info: Xlib is used by OCCT")
add_definitions (-DHAVE_XLIB)
if (APPLE)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/glx")
endif()
endif()
else()
OCCT_CHECK_AND_UNSET ("USE_XLIB")
endif()
# FreeType # FreeType
if (CAN_USE_FREETYPE) if (CAN_USE_FREETYPE)
if (USE_FREETYPE) if (USE_FREETYPE)
@@ -606,6 +571,12 @@ else()
endif() endif()
endif() endif()
# GLX
if (USE_GLX)
add_definitions (-DMACOSX_USE_GLX)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/glx")
endif()
# FREEIMAGE # FREEIMAGE
if (CAN_USE_FREEIMAGE) if (CAN_USE_FREEIMAGE)
if (USE_FREEIMAGE) if (USE_FREEIMAGE)
@@ -675,10 +646,8 @@ endif()
if (CAN_USE_GLES2) if (CAN_USE_GLES2)
if (USE_GLES2) if (USE_GLES2)
add_definitions (-DHAVE_GLES2_EXT) add_definitions (-DHAVE_GLES2_EXT)
if (NOT IOS) OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl") OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
endif()
else() else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL") OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2") OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2")
@@ -743,24 +712,6 @@ else()
OCCT_CHECK_AND_UNSET ("INSTALL_RAPIDJSON") OCCT_CHECK_AND_UNSET ("INSTALL_RAPIDJSON")
endif() endif()
# Draco library
# search for CSF_Draco variable in EXTERNLIB of each being used toolkit
OCCT_IS_PRODUCT_REQUIRED (CSF_Draco CAN_USE_DRACO)
if (CAN_USE_DRACO)
if (USE_DRACO)
add_definitions (-DHAVE_DRACO)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/draco")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_DRACO")
OCCT_CHECK_AND_UNSET ("INSTALL_DRACO")
endif()
else()
OCCT_CHECK_AND_UNSET ("USE_DRACO")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_DRACO")
OCCT_CHECK_AND_UNSET ("INSTALL_DRACO")
endif()
# EIGEN # EIGEN
if (CAN_USE_EIGEN) if (CAN_USE_EIGEN)
if (USE_EIGEN) if (USE_EIGEN)
@@ -1140,8 +1091,14 @@ if (BUILD_SAMPLES_MFC)
add_subdirectory(samples/mfc/standard/mfcsample) add_subdirectory(samples/mfc/standard/mfcsample)
add_subdirectory(samples/mfc/standard/01_Geometry) add_subdirectory(samples/mfc/standard/01_Geometry)
add_subdirectory(samples/mfc/standard/02_Modeling) add_subdirectory(samples/mfc/standard/02_Modeling)
add_subdirectory(samples/mfc/standard/03_ImportExport) add_subdirectory(samples/mfc/standard/03_Viewer2d)
add_subdirectory(samples/mfc/standard/04_HLR) add_subdirectory(samples/mfc/standard/04_Viewer3d)
add_subdirectory(samples/mfc/standard/05_ImportExport)
add_subdirectory(samples/mfc/standard/06_Ocaf)
add_subdirectory(samples/mfc/standard/07_Triangulation)
add_subdirectory(samples/mfc/standard/08_HLR)
add_subdirectory(samples/mfc/standard/09_Animation)
add_subdirectory(samples/mfc/standard/10_Convert)
message (STATUS "Info: \(${CURRENT_TIME}\) MFC Sample projects added") message (STATUS "Info: \(${CURRENT_TIME}\) MFC Sample projects added")
endif() endif()
@@ -1239,7 +1196,7 @@ foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
endforeach() endforeach()
# install OpenCASCADE config file with compile definitions and C/C++ flags ONLY for current configuration # install OpenCASCADE config file with compile definitions and C/C++ flags ONLY for current configuration
install (CODE "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)") install (CODE "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)")
install (CODE "file(INSTALL FILES \"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" DESTINATION \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/\" TYPE FILE)") install (CODE "configure_file(\"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" COPYONLY)")
foreach (OCCT_MODULE ${OCCT_MODULES}) foreach (OCCT_MODULE ${OCCT_MODULES})
if (BUILD_MODULE_${OCCT_MODULE}) if (BUILD_MODULE_${OCCT_MODULE})
@@ -1275,7 +1232,7 @@ if (WIN32)
set (SET_OpenCASCADE_WITH_D3D "set (OpenCASCADE_WITH_D3D ${USE_D3D})") set (SET_OpenCASCADE_WITH_D3D "set (OpenCASCADE_WITH_D3D ${USE_D3D})")
endif() endif()
if (APPLE) if (APPLE)
set (SET_OpenCASCADE_WITH_GLX "set (OpenCASCADE_WITH_GLX ${USE_XLIB})") set (SET_OpenCASCADE_WITH_GLX "set (OpenCASCADE_WITH_GLX ${USE_GLX})")
endif() endif()
# Configure and install cmake config file # Configure and install cmake config file

View File

@@ -1,4 +1,4 @@
TModelingData TKShapeView TKMessageModel TKMessageView TModelingData TKShapeView
TVisualization TKView TKVInspector TVisualization TKView TKVInspector
TApplicationFramework TKTreeModel TKTInspectorAPI TKDFBrowser TApplicationFramework TKTreeModel TKTInspectorAPI TKDFBrowser
TTool TKTInspector TKToolsDraw TInspectorEXE TTool TKTInspector TKToolsDraw TInspectorEXE

View File

@@ -197,6 +197,7 @@ t TKPrim
t TKShHealing t TKShHealing
t TKTopAlgo t TKTopAlgo
t TKXMesh t TKXMesh
n InterfaceGraphic
n AIS n AIS
n Aspect n Aspect
n DsgPrs n DsgPrs
@@ -216,7 +217,6 @@ n SelectMgr
n StdPrs n StdPrs
n StdSelect n StdSelect
n V3d n V3d
n Wasm
n WNT n WNT
n Xw n Xw
n Cocoa n Cocoa
@@ -328,7 +328,6 @@ n RWStepDimTol
n RWStepElement n RWStepElement
n RWStepFEA n RWStepFEA
n RWStepGeom n RWStepGeom
n RWStepKinematics
n RWStepRepr n RWStepRepr
n RWStepShape n RWStepShape
n RWStepVisual n RWStepVisual
@@ -348,7 +347,6 @@ n StepDimTol
n StepElement n StepElement
n StepFEA n StepFEA
n StepGeom n StepGeom
n StepKinematics
n StepRepr n StepRepr
n StepSelect n StepSelect
n StepShape n StepShape
@@ -454,7 +452,6 @@ t TKRWMesh
n RWGltf n RWGltf
n RWMesh n RWMesh
n RWObj n RWObj
n RWPly
n DFBrowser n DFBrowser
n DFBrowserPane n DFBrowserPane
n DFBrowserPaneXDE n DFBrowserPaneXDE

View File

@@ -1,4 +0,0 @@
# Draco - a library for a lossy vertex data compression, used as extension to glTF format.
# https://github.com/google/draco
THIRDPARTY_PRODUCT("DRACO" "draco/compression/decode.h" "CSF_Draco" "")

View File

@@ -191,13 +191,13 @@ foreach (LIBRARY_NAME ${CSF_FFmpeg})
else() else()
install (FILES "${3RDPARTY_FFMPEG_DLL_${LIBRARY_NAME}}" install (FILES "${3RDPARTY_FFMPEG_DLL_${LIBRARY_NAME}}"
CONFIGURATIONS Release CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/${INSTALL_DIR_BIN}") DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
install (FILES "${3RDPARTY_FFMPEG_DLL_${LIBRARY_NAME}}" install (FILES "${3RDPARTY_FFMPEG_DLL_${LIBRARY_NAME}}"
CONFIGURATIONS RelWithDebInfo CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/${INSTALL_DIR_BIN}i") DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bini")
install (FILES "${3RDPARTY_FFMPEG_DLL_${LIBRARY_NAME}}" install (FILES "${3RDPARTY_FFMPEG_DLL_${LIBRARY_NAME}}"
CONFIGURATIONS Debug CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/${INSTALL_DIR_BIN}d") DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
endif() endif()
else() else()
get_filename_component(3RDPARTY_FFMPEG_LIBRARY_ABS ${3RDPARTY_FFMPEG_LIBRARY_${LIBRARY_NAME}} REALPATH) get_filename_component(3RDPARTY_FFMPEG_LIBRARY_ABS ${3RDPARTY_FFMPEG_LIBRARY_${LIBRARY_NAME}} REALPATH)

View File

@@ -75,13 +75,6 @@ if (USE_TK)
endif() endif()
endif() endif()
# Draco
if (USE_DRACO)
set (CSF_Draco "draco")
else()
set (CSF_Draco)
endif()
if (WIN32) if (WIN32)
set (CSF_advapi32 "advapi32.lib") set (CSF_advapi32 "advapi32.lib")
set (CSF_gdi32 "gdi32.lib") set (CSF_gdi32 "gdi32.lib")
@@ -116,32 +109,24 @@ else()
find_library (OpenGlesLibs_LIB NAMES OpenGLES) find_library (OpenGlesLibs_LIB NAMES OpenGLES)
set (CSF_OpenGlesLibs ${OpenGlesLibs_LIB}) set (CSF_OpenGlesLibs ${OpenGlesLibs_LIB})
OCCT_CHECK_AND_UNSET (OpenGlesLibs_LIB) OCCT_CHECK_AND_UNSET (OpenGlesLibs_LIB)
elseif (USE_XLIB) elseif (USE_GLX)
set (CSF_OpenGlLibs "GL") set (CSF_OpenGlLibs GL)
set (CSF_XwLibs "X11") set (CSF_XwLibs "X11 Xext Xmu Xi")
else() else()
find_library (OpenGlLibs_LIB NAMES OpenGL) find_library (OpenGlLibs_LIB NAMES OpenGL)
set (CSF_OpenGlLibs ${OpenGlLibs_LIB}) set (CSF_OpenGlLibs ${OpenGlLibs_LIB})
OCCT_CHECK_AND_UNSET (OpenGlLibs_LIB) OCCT_CHECK_AND_UNSET (OpenGlLibs_LIB)
endif() endif()
elseif (EMSCRIPTEN)
set (CSF_ThreadLibs "pthread rt stdc++")
set (CSF_OpenGlesLibs "EGL GLESv2")
set (CSF_dl "dl")
elseif (ANDROID) elseif (ANDROID)
set (CSF_ThreadLibs "c") set (CSF_ThreadLibs "c")
set (CSF_OpenGlesLibs "EGL GLESv2") set (CSF_OpenGlesLibs "EGL GLESv2")
set (CSF_androidlog "log") set (CSF_androidlog "log")
elseif (UNIX) elseif (UNIX)
set (CSF_ThreadLibs "pthread rt stdc++") set (CSF_ThreadLibs "pthread rt stdc++")
if (USE_XLIB) set (CSF_OpenGlLibs "GL")
set (CSF_OpenGlLibs "GL")
set (CSF_XwLibs "X11")
else()
set (CSF_OpenGlLibs "GL EGL")
endif()
set (CSF_OpenGlesLibs "EGL GLESv2") set (CSF_OpenGlesLibs "EGL GLESv2")
set (CSF_XwLibs "X11 Xext Xmu Xi")
set (CSF_dl "dl") set (CSF_dl "dl")
if (USE_FREETYPE) if (USE_FREETYPE)
set (CSF_fontconfig "fontconfig") set (CSF_fontconfig "fontconfig")

View File

@@ -25,9 +25,6 @@ if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
endif() endif()
if (MSVC) if (MSVC)
# suppress C26812 on VS2019/C++20 (prefer 'enum class' over 'enum')
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise /wd\"26812\"")
# suppress warning on using portable non-secure functions in favor of non-portable secure ones
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
else() else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC")
@@ -43,19 +40,6 @@ elseif (MSVC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa")
endif() endif()
if (MSVC)
# string pooling (GF), function-level linking (Gy)
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GF /Gy")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /GF /Gy")
if (BUILD_FORCE_RelWithDebInfo)
# generate debug info (Zi), inline expansion level (Ob1)
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /Ob1")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zi /Ob1")
# generate debug info (debug), OptimizeReferences=true (OPT:REF), EnableCOMDATFolding=true (OPT:ICF)
set (CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /debug /OPT:REF /OPT:ICF")
endif()
endif()
# remove _WINDOWS flag if it exists # remove _WINDOWS flag if it exists
string (REGEX MATCH "/D_WINDOWS" IS_WINDOWSFLAG "${CMAKE_CXX_FLAGS}") string (REGEX MATCH "/D_WINDOWS" IS_WINDOWSFLAG "${CMAKE_CXX_FLAGS}")
if (IS_WINDOWSFLAG) if (IS_WINDOWSFLAG)
@@ -118,9 +102,6 @@ if (MSVC)
endif() endif()
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshorten-64-to-32")
endif()
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
if (APPLE) if (APPLE)
set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}") set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
@@ -142,9 +123,7 @@ if ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
# Optimize size of binaries # Optimize size of binaries
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,-s ${CMAKE_SHARED_LINKER_FLAGS}") set (CMAKE_SHARED_LINKER_FLAGS "-Wl,-s ${CMAKE_SHARED_LINKER_FLAGS}")
elseif(MINGW) elseif(MINGW)
add_definitions(-D_WIN32_WINNT=0x0601) add_definitions(-D_WIN32_WINNT=0x0501)
# _WIN32_WINNT=0x0601 (use Windows 7 SDK)
#set (CMAKE_SYSTEM_VERSION "6.1")
# workaround bugs in mingw with vtable export # workaround bugs in mingw with vtable export
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols") set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols")

View File

@@ -22,7 +22,7 @@ if ("${OCCT_TOOLKITS_NAME_SUFFIX}" STREQUAL "")
set (OCCT_TOOLKITS_NAME_SUFFIX "TOOLKITS") set (OCCT_TOOLKITS_NAME_SUFFIX "TOOLKITS")
endif() endif()
# parse PACKAGES file # parce PACKAGES file
FILE_TO_LIST ("${RELATIVE_SOURCES_DIR}/${PROJECT_NAME}/PACKAGES" USED_PACKAGES) FILE_TO_LIST ("${RELATIVE_SOURCES_DIR}/${PROJECT_NAME}/PACKAGES" USED_PACKAGES)
if ("${USED_PACKAGES}" STREQUAL "") if ("${USED_PACKAGES}" STREQUAL "")
set (USED_PACKAGES ${PROJECT_NAME}) set (USED_PACKAGES ${PROJECT_NAME})
@@ -39,7 +39,7 @@ set (PRECOMPILED_DEFS)
if (NOT BUILD_SHARED_LIBS) if (NOT BUILD_SHARED_LIBS)
list (APPEND PRECOMPILED_DEFS "-DOCCT_NO_PLUGINS") list (APPEND PRECOMPILED_DEFS "-DOCCT_NO_PLUGINS")
if (WIN32 AND NOT EXECUTABLE_PROJECT) if (WIN32)
list (APPEND PRECOMPILED_DEFS "-DOCCT_STATIC_BUILD") list (APPEND PRECOMPILED_DEFS "-DOCCT_STATIC_BUILD")
endif() endif()
endif() endif()
@@ -228,21 +228,12 @@ if (EXECUTABLE_PROJECT)
install (TARGETS ${PROJECT_NAME} install (TARGETS ${PROJECT_NAME}
DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}") DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
if (EMSCRIPTEN)
install(FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.wasm DESTINATION "${INSTALL_DIR_BIN}/${OCCT_INSTALL_BIN_LETTER}")
endif()
else() else()
add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES}) add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
if (MSVC) if (MSVC)
if (BUILD_FORCE_RelWithDebInfo)
set (aReleasePdbConf "Release")
else()
set (aReleasePdbConf)
endif()
install (FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.pdb install (FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.pdb
CONFIGURATIONS Debug ${aReleasePdbConf} RelWithDebInfo CONFIGURATIONS Debug RelWithDebInfo
DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}") DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
endif() endif()
@@ -255,8 +246,7 @@ else()
EXPORT OpenCASCADE${CURRENT_MODULE}Targets EXPORT OpenCASCADE${CURRENT_MODULE}Targets
RUNTIME DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}" RUNTIME DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}"
ARCHIVE DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}" ARCHIVE DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}" LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}")
INCLUDES DESTINATION ${INSTALL_DIR_INCLUDE})
if (NOT WIN32) if (NOT WIN32)
if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "") if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
@@ -281,27 +271,20 @@ get_property (OCC_VERSION_MAJOR GLOBAL PROPERTY OCC_VERSION_MAJOR)
get_property (OCC_VERSION_MINOR GLOBAL PROPERTY OCC_VERSION_MINOR) get_property (OCC_VERSION_MINOR GLOBAL PROPERTY OCC_VERSION_MINOR)
get_property (OCC_VERSION_MAINTENANCE GLOBAL PROPERTY OCC_VERSION_MAINTENANCE) get_property (OCC_VERSION_MAINTENANCE GLOBAL PROPERTY OCC_VERSION_MAINTENANCE)
set (OCC_SOVERSION "") if (ANDROID)
if (BUILD_SOVERSION_NUMBERS GREATER 2) # do not append version to the filename
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}") set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}")
elseif (BUILD_SOVERSION_NUMBERS GREATER 1) else()
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}") set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}"
elseif (BUILD_SOVERSION_NUMBERS GREATER 0) SOVERSION "${OCC_VERSION_MAJOR}"
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}") VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
endif() endif()
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}"
SOVERSION "${OCC_SOVERSION}"
VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
set (USED_TOOLKITS_BY_CURRENT_PROJECT) set (USED_TOOLKITS_BY_CURRENT_PROJECT)
set (USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT) set (USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT)
# parse EXTERNLIB file # parce EXTERNLIB file
if (CUSTOM_EXTERNLIB) FILE_TO_LIST ("${RELATIVE_SOURCES_DIR}/${PROJECT_NAME}/EXTERNLIB" USED_EXTERNLIB_AND_TOOLKITS)
set (USED_EXTERNLIB_AND_TOOLKITS ${CUSTOM_EXTERNLIB})
else()
FILE_TO_LIST ("${RELATIVE_SOURCES_DIR}/${PROJECT_NAME}/EXTERNLIB" USED_EXTERNLIB_AND_TOOLKITS)
endif()
foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS}) foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
string (REGEX MATCH "^ *#" COMMENT_FOUND ${USED_ITEM}) string (REGEX MATCH "^ *#" COMMENT_FOUND ${USED_ITEM})
if (NOT COMMENT_FOUND) if (NOT COMMENT_FOUND)
@@ -368,7 +351,7 @@ endforeach()
if (APPLE) if (APPLE)
list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT X11 IS_X11_FOUND) list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT X11 IS_X11_FOUND)
if (NOT ${IS_X11_FOUND} EQUAL -1) if (NOT ${IS_X11_FOUND} EQUAL -1)
find_package (X11 COMPONENTS X11) find_package (X11 COMPONENTS X11 Xext Xmu Xi)
if (NOT X11_FOUND) if (NOT X11_FOUND)
message (STATUS "Warning: X11 is not found. It's required to install The XQuartz project: http://www.xquartz.org") message (STATUS "Warning: X11 is not found. It's required to install The XQuartz project: http://www.xquartz.org")
endif() endif()
@@ -400,7 +383,7 @@ else()
endif() endif()
endif() endif()
if (BUILD_SHARED_LIBS OR EXECUTABLE_PROJECT) if (BUILD_SHARED_LIBS)
if(IS_VTK_9XX) if(IS_VTK_9XX)
string (REGEX REPLACE "vtk" "VTK::" USED_TOOLKITS_BY_CURRENT_PROJECT "${USED_TOOLKITS_BY_CURRENT_PROJECT}") string (REGEX REPLACE "vtk" "VTK::" USED_TOOLKITS_BY_CURRENT_PROJECT "${USED_TOOLKITS_BY_CURRENT_PROJECT}")
endif() endif()

View File

@@ -1,6 +1,6 @@
# tcl # tcl
if (NOT DEFINED INSTALL_TCL) if (NOT DEFINED INSTALL_TCL AND BUILD_SHARED_LIBS)
set (INSTALL_TCL OFF CACHE BOOL "${INSTALL_TCL_DESCR}") set (INSTALL_TCL OFF CACHE BOOL "${INSTALL_TCL_DESCR}")
endif() endif()
@@ -14,30 +14,30 @@ if (NOT DEFINED 3RDPARTY_TCL_INCLUDE_DIR)
set (3RDPARTY_TCL_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tcl") set (3RDPARTY_TCL_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tcl")
endif() endif()
if (BUILD_SHARED_LIBS)
# tcl library file (with absolute path)
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY OR NOT 3RDPARTY_TCL_LIBRARY_DIR)
set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "tcl library" FORCE)
endif()
# tcl library file (with absolute path) # tcl library directory
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY OR NOT 3RDPARTY_TCL_LIBRARY_DIR) if (NOT DEFINED 3RDPARTY_TCL_LIBRARY_DIR)
set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "tcl library" FORCE) set (3RDPARTY_TCL_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tcl library")
endif() endif()
# tcl library directory # tcl shared library (with absolute path)
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY_DIR) if (WIN32)
set (3RDPARTY_TCL_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tcl library") if (NOT DEFINED 3RDPARTY_TCL_DLL OR NOT 3RDPARTY_TCL_DLL_DIR)
endif() set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "tcl shared library" FORCE)
endif()
endif()
# tcl shared library (with absolute path) # tcl shared library directory
if (WIN32) if (WIN32 AND NOT DEFINED 3RDPARTY_TCL_DLL_DIR)
if (NOT DEFINED 3RDPARTY_TCL_DLL OR NOT 3RDPARTY_TCL_DLL_DIR) set (3RDPARTY_TCL_DLL_DIR "" CACHE FILEPATH "The directory containing tcl shared library")
set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "tcl shared library" FORCE)
endif() endif()
endif() endif()
# tcl shared library directory
if (WIN32 AND NOT DEFINED 3RDPARTY_TCL_DLL_DIR)
set (3RDPARTY_TCL_DLL_DIR "" CACHE FILEPATH "The directory containing tcl shared library")
endif()
# search for tcl in user defined directory # search for tcl in user defined directory
if (NOT 3RDPARTY_TCL_DIR AND 3RDPARTY_DIR) if (NOT 3RDPARTY_TCL_DIR AND 3RDPARTY_DIR)
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" tcl TCL_DIR_NAME) FIND_PRODUCT_DIR("${3RDPARTY_DIR}" tcl TCL_DIR_NAME)
@@ -64,197 +64,203 @@ if (NOT 3RDPARTY_TCL_INCLUDE_DIR)
endif() endif()
endif() endif()
# tcl dir and library if (BUILD_SHARED_LIBS)
if (NOT 3RDPARTY_TCL_LIBRARY) # tcl dir and library
if (TCL_LIBRARY AND EXISTS "${TCL_LIBRARY}") if (NOT 3RDPARTY_TCL_LIBRARY)
set (3RDPARTY_TCL_LIBRARY "${TCL_LIBRARY}" CACHE FILEPATH "TCL library" FORCE) if (TCL_LIBRARY AND EXISTS "${TCL_LIBRARY}")
set (3RDPARTY_TCL_LIBRARY "${TCL_LIBRARY}" CACHE FILEPATH "TCL library" FORCE)
if (NOT 3RDPARTY_TCL_LIBRARY_DIR) if (NOT 3RDPARTY_TCL_LIBRARY_DIR)
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH) get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE) set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
endif()
endif() endif()
endif() endif()
endif()
if (WIN32)
if (NOT 3RDPARTY_TCL_DLL)
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll .a)
set (DLL_FOLDER_FOR_SEARCH "") if (WIN32)
if (3RDPARTY_TCL_DLL_DIR) if (NOT 3RDPARTY_TCL_DLL)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}") set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll .a)
elseif (3RDPARTY_TCL_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin") set (DLL_FOLDER_FOR_SEARCH "")
elseif (3RDPARTY_TCL_LIBRARY_DIR) if (3RDPARTY_TCL_DLL_DIR)
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH) set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin") elseif (3RDPARTY_TCL_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
elseif (3RDPARTY_TCL_LIBRARY_DIR)
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
endif()
set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
find_library (3RDPARTY_TCL_DLL NAMES ${CSF_TclLibs}
PATHS "${DLL_FOLDER_FOR_SEARCH}"
NO_DEFAULT_PATH)
endif() endif()
set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
find_library (3RDPARTY_TCL_DLL NAMES ${CSF_TclLibs}
PATHS "${DLL_FOLDER_FOR_SEARCH}"
NO_DEFAULT_PATH)
endif() endif()
endif() endif()
COMPLIANCE_PRODUCT_CONSISTENCY(TCL) COMPLIANCE_PRODUCT_CONSISTENCY(TCL)
# tcl dir and library if (BUILD_SHARED_LIBS)
if (NOT 3RDPARTY_TCL_LIBRARY) # tcl dir and library
set (3RDPARTY_TCL_LIBRARY "3RDPARTY_TCL_LIBRARY-NOTFOUND" CACHE FILEPATH "TCL library" FORCE) if (NOT 3RDPARTY_TCL_LIBRARY)
find_library (3RDPARTY_TCL_LIBRARY NAMES ${CSF_TclLibs} set (3RDPARTY_TCL_LIBRARY "3RDPARTY_TCL_LIBRARY-NOTFOUND" CACHE FILEPATH "TCL library" FORCE)
PATHS "${3RDPARTY_TCL_LIBRARY_DIR}" find_library (3RDPARTY_TCL_LIBRARY NAMES ${CSF_TclLibs}
NO_DEFAULT_PATH) PATHS "${3RDPARTY_TCL_LIBRARY_DIR}"
NO_DEFAULT_PATH)
# search in another place if previous search doesn't find anything # search in another place if previous search doesn't find anything
find_library (3RDPARTY_TCL_LIBRARY NAMES ${CSF_TclLibs} find_library (3RDPARTY_TCL_LIBRARY NAMES ${CSF_TclLibs}
PATHS "${3RDPARTY_TCL_DIR}/lib" PATHS "${3RDPARTY_TCL_DIR}/lib"
NO_DEFAULT_PATH) NO_DEFAULT_PATH)
if (NOT 3RDPARTY_TCL_LIBRARY OR NOT EXISTS "${3RDPARTY_TCL_LIBRARY}")
set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "TCL library" FORCE)
endif()
if (NOT 3RDPARTY_TCL_LIBRARY_DIR AND 3RDPARTY_TCL_LIBRARY) if (NOT 3RDPARTY_TCL_LIBRARY OR NOT EXISTS "${3RDPARTY_TCL_LIBRARY}")
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH) set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "TCL library" FORCE)
set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
endif()
endif()
set (3RDPARTY_TCL_LIBRARY_VERSION "")
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
get_filename_component (TCL_LIBRARY_NAME "${3RDPARTY_TCL_LIBRARY}" NAME)
string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY_NAME}")
if (NOT "${TCL_LIBRARY_VERSION}" STREQUAL "${TCL_LIBRARY_NAME}")
set (3RDPARTY_TCL_LIBRARY_VERSION "${TCL_LIBRARY_VERSION}")
else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
message (STATUS "Info: TCL version isn't found")
endif()
endif()
set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "")
if (3RDPARTY_TCL_LIBRARY_VERSION)
string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TCL_MAJOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TCL_MINOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TCL_MAJOR_VERSION}.${3RDPARTY_TCL_MINOR_VERSION}")
endif()
if (WIN32)
if (NOT 3RDPARTY_TCL_DLL)
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll .a)
set (DLL_FOLDER_FOR_SEARCH "")
if (3RDPARTY_TCL_DLL_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
elseif (3RDPARTY_TCL_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
else()
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
endif() endif()
set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE) if (NOT 3RDPARTY_TCL_LIBRARY_DIR AND 3RDPARTY_TCL_LIBRARY)
find_library (3RDPARTY_TCL_DLL NAMES tcl${3RDPARTY_TCL_LIBRARY_VERSION} get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
PATHS "${DLL_FOLDER_FOR_SEARCH}" set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
NO_DEFAULT_PATH)
if (NOT 3RDPARTY_TCL_DLL OR NOT EXISTS "${3RDPARTY_TCL_DLL}")
set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "TCL shared library" FORCE)
endif() endif()
endif() endif()
if (NOT 3RDPARTY_TCL_DLL_DIR AND 3RDPARTY_TCL_DLL)
get_filename_component (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH) set (3RDPARTY_TCL_LIBRARY_VERSION "")
set (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL_DIR}" CACHE FILEPATH "The directory containing TCL shared library" FORCE) if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
get_filename_component (TCL_LIBRARY_NAME "${3RDPARTY_TCL_LIBRARY}" NAME)
string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY_NAME}")
if (NOT "${TCL_LIBRARY_VERSION}" STREQUAL "${TCL_LIBRARY_NAME}")
set (3RDPARTY_TCL_LIBRARY_VERSION "${TCL_LIBRARY_VERSION}")
else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
message (STATUS "Info: TCL version isn't found")
endif()
endif() endif()
endif()
# include found paths to common variables set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "")
if (3RDPARTY_TCL_INCLUDE_DIR AND EXISTS "${3RDPARTY_TCL_INCLUDE_DIR}") if (3RDPARTY_TCL_LIBRARY_VERSION)
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TCL_INCLUDE_DIR}") string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TCL_MAJOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
else() string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TCL_MINOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_INCLUDE_DIR) set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TCL_MAJOR_VERSION}.${3RDPARTY_TCL_MINOR_VERSION}")
endif()
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TCL_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_TCL_LIBRARY_DIR)
endif()
if (WIN32)
if (3RDPARTY_TCL_DLL OR EXISTS "${3RDPARTY_TCL_DLL}")
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TCL_DLL_DIR}")
else()
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_TCL_DLL_DIR)
endif() endif()
endif()
# install tcl
if (INSTALL_TCL)
# include occt macros. compiler_bitness, os_wiht_bit, compiler
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
if (WIN32) if (WIN32)
# tcl 8.6 requires zlib. install all dlls from tcl bin folder that may contain zlib also if (NOT 3RDPARTY_TCL_DLL)
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll .a)
# collect and install all dlls from tcl dll dirs set (DLL_FOLDER_FOR_SEARCH "")
file (GLOB TCL_DLLS "${3RDPARTY_TCL_DLL_DIR}/*.dll") if (3RDPARTY_TCL_DLL_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
elseif (3RDPARTY_TCL_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
else()
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
endif()
if (SINGLE_GENERATOR) set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
install (FILES ${TCL_DLLS} DESTINATION "${INSTALL_DIR_BIN}") find_library (3RDPARTY_TCL_DLL NAMES tcl${3RDPARTY_TCL_LIBRARY_VERSION}
else() PATHS "${DLL_FOLDER_FOR_SEARCH}"
install (FILES ${TCL_DLLS} NO_DEFAULT_PATH)
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR_BIN}") if (NOT 3RDPARTY_TCL_DLL OR NOT EXISTS "${3RDPARTY_TCL_DLL}")
install (FILES ${TCL_DLLS} set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "TCL shared library" FORCE)
CONFIGURATIONS RelWithDebInfo endif()
DESTINATION "${INSTALL_DIR_BIN}i")
install (FILES ${TCL_DLLS}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_BIN}d")
endif() endif()
else() if (NOT 3RDPARTY_TCL_DLL_DIR AND 3RDPARTY_TCL_DLL)
get_filename_component(3RDPARTY_TCL_LIBRARY_REALPATH ${3RDPARTY_TCL_LIBRARY} REALPATH) get_filename_component (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH)
set (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL_DIR}" CACHE FILEPATH "The directory containing TCL shared library" FORCE)
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR_LIB}")
else()
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR_LIB}")
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR_LIB}i")
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_LIB}d")
endif() endif()
endif() endif()
if (TCL_TCLSH_VERSION) # include found paths to common variables
# tcl is required to install in lib folder (without) if (3RDPARTY_TCL_INCLUDE_DIR AND EXISTS "${3RDPARTY_TCL_INCLUDE_DIR}")
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl8" DESTINATION "${INSTALL_DIR_LIB}") list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TCL_INCLUDE_DIR}")
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR_LIB}")
else() else()
message (STATUS "\nWarning: tclX.X subdir won't be copied during the installation process.") list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_INCLUDE_DIR)
message (STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.") endif()
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TCL_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_TCL_LIBRARY_DIR)
endif() endif()
set (USED_3RDPARTY_TCL_DIR "")
else()
# the library directory for using by the executable
if (WIN32) if (WIN32)
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_DLL_DIR}) if (3RDPARTY_TCL_DLL OR EXISTS "${3RDPARTY_TCL_DLL}")
else() list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TCL_DLL_DIR}")
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_LIBRARY_DIR}) else()
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_TCL_DLL_DIR)
endif()
endif() endif()
endif()
mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TCL_DLL) # install tcl
if (INSTALL_TCL)
# include occt macros. compiler_bitness, os_wiht_bit, compiler
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
if (WIN32)
# tcl 8.6 requires zlib. install all dlls from tcl bin folder that may contain zlib also
# collect and install all dlls from tcl dll dirs
file (GLOB TCL_DLLS "${3RDPARTY_TCL_DLL_DIR}/*.dll")
if (SINGLE_GENERATOR)
install (FILES ${TCL_DLLS} DESTINATION "${INSTALL_DIR_BIN}")
else()
install (FILES ${TCL_DLLS}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR_BIN}")
install (FILES ${TCL_DLLS}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR_BIN}i")
install (FILES ${TCL_DLLS}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_BIN}d")
endif()
else()
get_filename_component(3RDPARTY_TCL_LIBRARY_REALPATH ${3RDPARTY_TCL_LIBRARY} REALPATH)
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR_LIB}")
else()
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR_LIB}")
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR_LIB}i")
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_LIB}d")
endif()
endif()
if (TCL_TCLSH_VERSION)
# tcl is required to install in lib folder (without)
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl8" DESTINATION "${INSTALL_DIR_LIB}")
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR_LIB}")
else()
message (STATUS "\nWarning: tclX.X subdir won't be copied during the installation process.")
message (STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.")
endif()
set (USED_3RDPARTY_TCL_DIR "")
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_DLL_DIR})
else()
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_LIBRARY_DIR})
endif()
endif()
mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TCL_DLL)
endif()
if (TK_FOUND AND 3RDPARTY_TCL_DIR) if (TK_FOUND AND 3RDPARTY_TCL_DIR)
@@ -279,3 +285,10 @@ OCCT_CHECK_AND_UNSET (TK_LIBRARY)
OCCT_CHECK_AND_UNSET (TK_INCLUDE_PATH) OCCT_CHECK_AND_UNSET (TK_INCLUDE_PATH)
OCCT_CHECK_AND_UNSET (TK_WISH) OCCT_CHECK_AND_UNSET (TK_WISH)
if (NOT BUILD_SHARED_LIBS)
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_LIBRARY)
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_LIBRARY_DIR)
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_DLL)
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_DLL_DIR)
OCCT_CHECK_AND_UNSET (INSTALL_TCL)
endif()

View File

@@ -28,9 +28,6 @@ Applies only for Debug configuration.")
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR
"Append the postfix to names of output libraries") "Append the postfix to names of output libraries")
set (BUILD_SOVERSION_NUMBERS_DESCR
"Version numbers to put into SONAME: 0 - for empty, 1 - for major, 2 - for major.minor, 3 - for major.minor.maintenance")
set (BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR set (BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR
"Disables exceptions like Standard_OutOfRange in Release builds. "Disables exceptions like Standard_OutOfRange in Release builds.
Defines No_Exception macros for Release builds when enabled (default). Defines No_Exception macros for Release builds when enabled (default).
@@ -41,9 +38,6 @@ set (BUILD_ENABLE_FPE_SIGNAL_HANDLER_DESCR
Corresponding environment variable (CSF_FPE) can be changed manually Corresponding environment variable (CSF_FPE) can be changed manually
in custom.bat/sh scripts without regeneration by CMake.") in custom.bat/sh scripts without regeneration by CMake.")
set (BUILD_FORCE_RelWithDebInfo_DESCR
"Generate PDB files within normal Release build.")
set (BUILD_USE_PCH_DESCR set (BUILD_USE_PCH_DESCR
"Use precompiled headers to accelerate the build. "Use precompiled headers to accelerate the build.
Precompiled headers are generated automatically by Cotire tool.") Precompiled headers are generated automatically by Cotire tool.")
@@ -182,9 +176,6 @@ set (USE_RAPIDJSON_DESCR
"Indicates whether RapidJSON product should be used in OCCT DataExchange "Indicates whether RapidJSON product should be used in OCCT DataExchange
module for support of JSON-based formats like glTF") module for support of JSON-based formats like glTF")
set (USE_DRACO_DESCR
"Indicates whether Draco mesh decoding library should be used by glTF reader")
set (USE_EGL_DESCR set (USE_EGL_DESCR
"Indicates whether EGL should be used in OCCT visualization "Indicates whether EGL should be used in OCCT visualization
module instead of conventional OpenGL context creation APIs") module instead of conventional OpenGL context creation APIs")
@@ -205,7 +196,7 @@ ToolKit, the technology of Kitware Inc intended for general-purpose scientific
visualization. OCCT comes with a bridge between CAD data representation and visualization. OCCT comes with a bridge between CAD data representation and
VTK by means of its dedicated VIS component (VTK Integration Services).") VTK by means of its dedicated VIS component (VTK Integration Services).")
set (USE_XLIB_DESCR "Indicates whether X11 is used or not") set (USE_GLX_DESCR "Indicates whether X11 OpenGl on OSX is used or not")
set (USE_D3D_DESCR "Indicates whether optional Direct3D wrapper in OCCT visualization module should be build or not") set (USE_D3D_DESCR "Indicates whether optional Direct3D wrapper in OCCT visualization module should be build or not")

View File

@@ -56,52 +56,36 @@ lappend ::SYS_PRJNAME_LIST "Qt Creator (.pro)"
set aPrjIndex [lsearch $::SYS_PRJFMT_LIST $::PRJFMT] set aPrjIndex [lsearch $::SYS_PRJFMT_LIST $::PRJFMT]
set ::PRJNAME [lindex $::SYS_PRJNAME_LIST $aPrjIndex] set ::PRJNAME [lindex $::SYS_PRJNAME_LIST $aPrjIndex]
set ::CONFIG "Release"
set SYS_VS_LIST {} set SYS_VS_LIST {}
set SYS_VC_LIST {} set SYS_VC_LIST {}
set SYS_VCVARS_LIST {} set SYS_VCVARS_LIST {}
# detect installed Visual Studio 2017+ instances by running vswhere.exe # detect installed Visual Studio 2017+ instances by running vswhere.exe
if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] && "$res" != "" } { if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] } {
lappend ::SYS_VS_LIST "Visual Studio 2017 (15, toolset v141)" lappend ::SYS_VS_LIST "Visual Studio 2017 (15, toolset v141)"
lappend ::SYS_VC_LIST "vc141" lappend ::SYS_VC_LIST "vc141"
lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat" lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
} }
if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] && "$res" != "" } { if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] } {
lappend ::SYS_VS_LIST "Visual Studio 2017 (15, toolset v141) UWP" lappend ::SYS_VS_LIST "Visual Studio 2017 (15, toolset v141) UWP"
lappend ::SYS_VC_LIST "vc141-uwp" lappend ::SYS_VC_LIST "vc141-uwp"
lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat" lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
} }
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] && "$res" != "" } { if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] } {
lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset v142)" lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset v142)"
lappend ::SYS_VC_LIST "vc142" lappend ::SYS_VC_LIST "vc142"
lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat" lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
} }
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] && "$res" != "" } { if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] } {
lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset v142) UWP" lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset v142) UWP"
lappend ::SYS_VC_LIST "vc142-uwp" lappend ::SYS_VC_LIST "vc142-uwp"
lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat" lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
} }
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Component.VC.ClangCL -property installationPath} res] && "$res" != "" } { if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Component.VC.ClangCL -property installationPath} res] } {
lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset ClangCL)" lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset ClangCL)"
lappend ::SYS_VC_LIST "vclang" lappend ::SYS_VC_LIST "vclang"
lappend ::SYS_VCVARS_LIST "$res\\VC\Auxiliary\\Build\\vcvarsall.bat" lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
}
if { ! [catch {exec vswhere.exe -version "\[17.0,17.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] && "$res" != "" } {
lappend ::SYS_VS_LIST "Visual Studio 2022 (17, toolset v143)"
lappend ::SYS_VC_LIST "vc143"
lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
}
if { ! [catch {exec vswhere.exe -version "\[17.0,17.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] && "$res" != "" } {
lappend ::SYS_VS_LIST "Visual Studio 2022 (17, toolset v143) UWP"
lappend ::SYS_VC_LIST "vc143-uwp"
lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
}
if { ! [catch {exec vswhere.exe -version "\[17.0,17.99\]" -latest -requires Microsoft.VisualStudio.Component.VC.ClangCL -property installationPath} res] && "$res" != "" } {
lappend ::SYS_VS_LIST "Visual Studio 2022 (17, toolset ClangCL)"
lappend ::SYS_VC_LIST "vclang"
lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
} }
# detect installed Visual Studio instances from global environment # detect installed Visual Studio instances from global environment
@@ -154,13 +138,6 @@ proc wokdep:gui:Close {} {
exit exit
} }
proc wokdep:gui:configSuffix {} {
if { "$::CONFIG" == "Debug" } {
return "D"
}
return ""
}
proc wokdep:gui:SwitchConfig {} { proc wokdep:gui:SwitchConfig {} {
set ::PRJFMT [lindex $::SYS_PRJFMT_LIST [.myFrame.myPrjFrame.myPrjCombo current]] set ::PRJFMT [lindex $::SYS_PRJFMT_LIST [.myFrame.myPrjFrame.myPrjCombo current]]
set ::VCVER [lindex $::SYS_VC_LIST [.myFrame.myVsFrame.myVsCombo current]] set ::VCVER [lindex $::SYS_VC_LIST [.myFrame.myVsFrame.myVsCombo current]]
@@ -171,15 +148,16 @@ proc wokdep:gui:SwitchConfig {} {
set ::CSF_OPT_LIB64 {} set ::CSF_OPT_LIB64 {}
set ::CSF_OPT_BIN32 {} set ::CSF_OPT_BIN32 {}
set ::CSF_OPT_BIN64 {} set ::CSF_OPT_BIN64 {}
set ::CSF_OPT_LIB32D {}
set ::CSF_OPT_LIB64D {}
set ::CSF_OPT_BIN32D {}
set ::CSF_OPT_BIN64D {}
wokdep:gui:UpdateList wokdep:gui:UpdateList
} }
proc wokdep:gui:SwitchArch {} { proc wokdep:gui:SwitchArch {} {
wokdep:gui:Show3264Bitness ::aRowIter if { "$::ARCH" == "32" } {
wokdep:gui:Show32Bitness ::aRowIter
}
if { "$::ARCH" == "64" } {
wokdep:gui:Show64Bitness ::aRowIter
}
if { [llength [grid info .myFrame.mySave]] != 0 } { if { [llength [grid info .myFrame.mySave]] != 0 } {
grid forget .myFrame.mySave .myFrame.myClose grid forget .myFrame.mySave .myFrame.myClose
@@ -190,16 +168,6 @@ proc wokdep:gui:SwitchArch {} {
grid .myFrame.myClose -row $::aRowIter -column 6 -columnspan 2 grid .myFrame.myClose -row $::aRowIter -column 6 -columnspan 2
} }
# update label text and visibility
font create wokdep:gui:EmptyFont -size -1
proc wokdep:gui:SetLabelText {theLabel theText} {
set aFont TkDefaultFont
if { $theText == "" } {
set aFont wokdep:gui:EmptyFont
}
$theLabel configure -text $theText -font $aFont
}
proc wokdep:gui:UpdateList {} { proc wokdep:gui:UpdateList {} {
set anIncErrs {} set anIncErrs {}
set anLib32Errs {} set anLib32Errs {}
@@ -259,10 +227,6 @@ proc wokdep:gui:UpdateList {} {
if { "$::HAVE_RAPIDJSON" == "true" } { if { "$::HAVE_RAPIDJSON" == "true" } {
wokdep:SearchRapidJson anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs wokdep:SearchRapidJson anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
} }
if { "$::HAVE_DRACO" == "true" } {
set aDummy {}
wokdep:SearchStandardLibrary anIncErrs anLib32Errs anLib64Errs aDummy aDummy "draco" "draco/compression/decode.h" "draco" {"draco"}
}
if {"$::BUILD_Inspector" == "true" } { if {"$::BUILD_Inspector" == "true" } {
set ::CHECK_QT "true" set ::CHECK_QT "true"
@@ -276,28 +240,11 @@ proc wokdep:gui:UpdateList {} {
wokdep:SearchJDK anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs wokdep:SearchJDK anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
} }
wokdep:gui:SetLabelText .myFrame.myIncErrLbl [join $anIncErrs "\n"] .myFrame.myIncErrLbl configure -text [join $anIncErrs "\n"]
.myFrame.myLib32ErrLbl configure -text [join $anLib32Errs "\n"]
wokdep:gui:SetLabelText .myFrame.myIncErrLbl [join $anIncErrs "\n"] .myFrame.myLib64ErrLbl configure -text [join $anLib64Errs "\n"]
wokdep:gui:SetLabelText .myFrame.myLib32_ErrLbl [join $anLib32Errs "\n"] .myFrame.myBin32ErrLbl configure -text [join $anBin32Errs "\n"]
wokdep:gui:SetLabelText .myFrame.myLib64_ErrLbl [join $anLib64Errs "\n"] .myFrame.myBin64ErrLbl configure -text [join $anBin64Errs "\n"]
wokdep:gui:SetLabelText .myFrame.myBin32_ErrLbl [join $anBin32Errs "\n"]
wokdep:gui:SetLabelText .myFrame.myBin64_ErrLbl [join $anBin64Errs "\n"]
wokdep:gui:SetLabelText .myFrame.myLib32D_ErrLbl [join $anLib32Errs "\n"]
wokdep:gui:SetLabelText .myFrame.myLib64D_ErrLbl [join $anLib64Errs "\n"]
wokdep:gui:SetLabelText .myFrame.myBin32D_ErrLbl [join $anBin32Errs "\n"]
wokdep:gui:SetLabelText .myFrame.myBin64D_ErrLbl [join $anBin64Errs "\n"]
# merge duplicates
set ::CSF_OPT_LIB32 [lsort -unique $::CSF_OPT_LIB32]
set ::CSF_OPT_LIB64 [lsort -unique $::CSF_OPT_LIB64]
set ::CSF_OPT_BIN32 [lsort -unique $::CSF_OPT_BIN32]
set ::CSF_OPT_BIN64 [lsort -unique $::CSF_OPT_BIN64]
set ::CSF_OPT_LIB32D [lsort -unique $::CSF_OPT_LIB32D]
set ::CSF_OPT_LIB64D [lsort -unique $::CSF_OPT_LIB64D]
set ::CSF_OPT_BIN32D [lsort -unique $::CSF_OPT_BIN32D]
set ::CSF_OPT_BIN64D [lsort -unique $::CSF_OPT_BIN64D]
} }
proc wokdep:gui:BrowseVcVars {} { proc wokdep:gui:BrowseVcVars {} {
@@ -323,20 +270,34 @@ proc wokdep:gui:AddIncPath {} {
} }
} }
proc wokdep:gui:AddLibPath {} { proc wokdep:gui:AddLib32Path {} {
set aCfg [wokdep:gui:configSuffix]
set aResult [tk_chooseDirectory -title "Choose a directory"] set aResult [tk_chooseDirectory -title "Choose a directory"]
if { "$aResult" != "" } { if { "$aResult" != "" } {
lappend ::CSF_OPT_LIB${::ARCH}${aCfg} "$aResult" lappend ::CSF_OPT_LIB32 "$aResult"
wokdep:gui:UpdateList wokdep:gui:UpdateList
} }
} }
proc wokdep:gui:AddBinPath {} { proc wokdep:gui:AddLib64Path {} {
set aCfg [wokdep:gui:configSuffix]
set aResult [tk_chooseDirectory -title "Choose a directory"] set aResult [tk_chooseDirectory -title "Choose a directory"]
if { "$aResult" != "" } { if { "$aResult" != "" } {
lappend ::CSF_OPT_BIN${::ARCH}${aCfg} "$aResult" lappend ::CSF_OPT_LIB64 "$aResult"
wokdep:gui:UpdateList
}
}
proc wokdep:gui:AddBin32Path {} {
set aResult [tk_chooseDirectory -title "Choose a directory"]
if { "$aResult" != "" } {
lappend ::CSF_OPT_BIN32 "$aResult"
wokdep:gui:UpdateList
}
}
proc wokdep:gui:AddBin64Path {} {
set aResult [tk_chooseDirectory -title "Choose a directory"]
if { "$aResult" != "" } {
lappend ::CSF_OPT_BIN64 "$aResult"
wokdep:gui:UpdateList wokdep:gui:UpdateList
} }
} }
@@ -349,20 +310,34 @@ proc wokdep:gui:RemoveIncPath {} {
wokdep:gui:UpdateList wokdep:gui:UpdateList
} }
proc wokdep:gui:RemoveLibPath {} { proc wokdep:gui:RemoveLib32Path {} {
set aCfg [wokdep:gui:configSuffix] set aSelIndices [.myFrame.myLib32List curselection]
set aSelIndices [.myFrame.myLib${::ARCH}${aCfg}_List curselection]
if { [llength $aSelIndices] != 0 } { if { [llength $aSelIndices] != 0 } {
.myFrame.myLib${::ARCH}${aCfg}_List delete [lindex $aSelIndices 0] .myFrame.myLib32List delete [lindex $aSelIndices 0]
} }
wokdep:gui:UpdateList wokdep:gui:UpdateList
} }
proc wokdep:gui:RemoveBinPath {} { proc wokdep:gui:RemoveLib64Path {} {
set aCfg [wokdep:gui:configSuffix] set aSelIndices [.myFrame.myLib64List curselection]
set aSelIndices [.myFrame.myBin${::ARCH}${aCfg}_List curselection]
if { [llength $aSelIndices] != 0 } { if { [llength $aSelIndices] != 0 } {
.myFrame.myBin${::ARCH}${aCfg}_List delete [lindex $aSelIndices 0] .myFrame.myLib64List delete [lindex $aSelIndices 0]
}
wokdep:gui:UpdateList
}
proc wokdep:gui:RemoveBin32Path {} {
set aSelIndices [.myFrame.myBin32List curselection]
if { [llength $aSelIndices] != 0 } {
.myFrame.myBin32List delete [lindex $aSelIndices 0]
}
wokdep:gui:UpdateList
}
proc wokdep:gui:RemoveBin64Path {} {
set aSelIndices [.myFrame.myBin64List curselection]
if { [llength $aSelIndices] != 0 } {
.myFrame.myBin64List delete [lindex $aSelIndices 0]
} }
wokdep:gui:UpdateList wokdep:gui:UpdateList
} }
@@ -372,73 +347,109 @@ proc wokdep:gui:ResetIncPath {} {
wokdep:gui:UpdateList wokdep:gui:UpdateList
} }
proc wokdep:gui:ResetLibPath {} { proc wokdep:gui:ResetLib32Path {} {
set ::CSF_OPT_LIB${::ARCH} {} set ::CSF_OPT_LIB32 {}
set ::CSF_OPT_LIB${::ARCH}D {}
set ::CSF_OPT_BIN${::ARCH} {}
set ::CSF_OPT_BIN${::ARCH}D {}
wokdep:gui:UpdateList wokdep:gui:UpdateList
} }
proc wokdep:gui:Show3264Bitness { theRowIter } { proc wokdep:gui:ResetLib64Path {} {
set ::CSF_OPT_LIB64 {}
wokdep:gui:UpdateList
}
proc wokdep:gui:ResetBin32Path {} {
set ::CSF_OPT_BIN32 {}
wokdep:gui:UpdateList
}
proc wokdep:gui:ResetBin64Path {} {
set ::CSF_OPT_BIN64 {}
wokdep:gui:UpdateList
}
proc wokdep:gui:Show32Bitness { theRowIter } {
upvar $theRowIter aRowIter upvar $theRowIter aRowIter
set aArchOld "" if { [llength [grid info .myFrame.myLib64Lbl]] != 0 } {
set aCfg [wokdep:gui:configSuffix] grid forget .myFrame.myLib64Lbl .myFrame.myLib64List .myFrame.myLib64Scrl
if { "$::ARCH" == "32" } { grid forget .myFrame.myLib64Add .myFrame.myLib64Remove .myFrame.myLib64Clear .myFrame.myLib64ErrLbl
set aArchOld "64" grid forget .myFrame.myBin64Lbl .myFrame.myBin64List .myFrame.myBin64Scrl
} else { grid forget .myFrame.myBin64Add .myFrame.myBin64Remove .myFrame.myBin64Clear .myFrame.myBin64ErrLbl
set aArchOld "32"
} }
set aCfgOld "D" # Additional libraries (32-bit) search paths
if { "$::CONFIG" == "Debug" } { set aCfgOld "" } grid .myFrame.myLib32Lbl -row $aRowIter -column 0 -columnspan 10 -sticky w
set aDelArch ${aArchOld}${aCfg}
if { [llength [grid info .myFrame.myLib${aDelArch}_Lbl]] != 0 } {
grid forget .myFrame.myLib${aDelArch}_Lbl .myFrame.myLib${aDelArch}_List .myFrame.myLib${aDelArch}_Scrl
grid forget .myFrame.myLib${aDelArch}_Add .myFrame.myLib${aDelArch}_Remove .myFrame.myLib${aDelArch}_Clear .myFrame.myLib${aDelArch}_ErrLbl
grid forget .myFrame.myBin${aDelArch}_Lbl .myFrame.myBin${aDelArch}_List .myFrame.myBin${aDelArch}_Scrl
grid forget .myFrame.myBin${aDelArch}_Add .myFrame.myBin${aDelArch}_Remove .myFrame.myBin${aDelArch}_Clear .myFrame.myBin${aDelArch}_ErrLbl
}
set aDelCfg ${::ARCH}${aCfgOld}
if { [llength [grid info .myFrame.myLib${aDelCfg}_Lbl]] != 0 } {
grid forget .myFrame.myLib${aDelCfg}_Lbl .myFrame.myLib${aDelCfg}_List .myFrame.myLib${aDelCfg}_Scrl
grid forget .myFrame.myLib${aDelCfg}_Add .myFrame.myLib${aDelCfg}_Remove .myFrame.myLib${aDelCfg}_Clear .myFrame.myLib${aDelCfg}_ErrLbl
grid forget .myFrame.myBin${aDelCfg}_Lbl .myFrame.myBin${aDelCfg}_List .myFrame.myBin${aDelCfg}_Scrl
grid forget .myFrame.myBin${aDelCfg}_Add .myFrame.myBin${aDelCfg}_Remove .myFrame.myBin${aDelCfg}_Clear .myFrame.myBin${aDelCfg}_ErrLbl
}
set aNewCfg ${::ARCH}${aCfg}
# Additional libraries search paths
grid .myFrame.myLib${aNewCfg}_Lbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter incr aRowIter
grid .myFrame.myLib${aNewCfg}_List -row $aRowIter -column 0 -rowspan 4 -columnspan 5 grid .myFrame.myLib32List -row $aRowIter -column 0 -rowspan 4 -columnspan 5
grid .myFrame.myLib${aNewCfg}_Scrl -row $aRowIter -column 5 -rowspan 4 grid .myFrame.myLib32Scrl -row $aRowIter -column 5 -rowspan 4
grid .myFrame.myLib${aNewCfg}_Add -row $aRowIter -column 6 grid .myFrame.myLib32Add -row $aRowIter -column 6
incr aRowIter incr aRowIter
#grid .myFrame.myLib${aNewCfg}_Edit -row $aRowIter -column 6 #grid .myFrame.myLib32Edit -row $aRowIter -column 6
incr aRowIter incr aRowIter
grid .myFrame.myLib${aNewCfg}_Remove -row $aRowIter -column 6 grid .myFrame.myLib32Remove -row $aRowIter -column 6
incr aRowIter incr aRowIter
grid .myFrame.myLib${aNewCfg}_Clear -row $aRowIter -column 6 grid .myFrame.myLib32Clear -row $aRowIter -column 6
incr aRowIter incr aRowIter
grid .myFrame.myLib${aNewCfg}_ErrLbl -row $aRowIter -column 0 -columnspan 10 -sticky w grid .myFrame.myLib32ErrLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter incr aRowIter
# Additional executables search paths # Additional executables (32-bit) search paths
grid .myFrame.myBin${aNewCfg}_Lbl -row $aRowIter -column 0 -columnspan 10 -sticky w grid .myFrame.myBin32Lbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter incr aRowIter
grid .myFrame.myBin${aNewCfg}_List -row $aRowIter -column 0 -rowspan 4 -columnspan 5 grid .myFrame.myBin32List -row $aRowIter -column 0 -rowspan 4 -columnspan 5
grid .myFrame.myBin${aNewCfg}_Scrl -row $aRowIter -column 5 -rowspan 4 grid .myFrame.myBin32Scrl -row $aRowIter -column 5 -rowspan 4
grid .myFrame.myBin${aNewCfg}_Add -row $aRowIter -column 6 grid .myFrame.myBin32Add -row $aRowIter -column 6
incr aRowIter incr aRowIter
#grid .myFrame.myBin${aNewCfg}_Edit -row $aRowIter -column 6 #grid .myFrame.myBin32Edit -row $aRowIter -column 6
incr aRowIter incr aRowIter
grid .myFrame.myBin${aNewCfg}_Remove -row $aRowIter -column 6 grid .myFrame.myBin32Remove -row $aRowIter -column 6
incr aRowIter incr aRowIter
grid .myFrame.myBin${aNewCfg}_Clear -row $aRowIter -column 6 grid .myFrame.myBin32Clear -row $aRowIter -column 6
incr aRowIter incr aRowIter
grid .myFrame.myBin${aNewCfg}_ErrLbl -row $aRowIter -column 0 -columnspan 10 -sticky w grid .myFrame.myBin32ErrLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter
}
proc wokdep:gui:Show64Bitness { theRowIter } {
upvar $theRowIter aRowIter
if { [llength [grid info .myFrame.myLib32Lbl]] != 0 } {
grid forget .myFrame.myLib32Lbl .myFrame.myLib32List .myFrame.myLib32Scrl
grid forget .myFrame.myLib32Add .myFrame.myLib32Remove .myFrame.myLib32Clear .myFrame.myLib32ErrLbl
grid forget .myFrame.myBin32Lbl .myFrame.myBin32List .myFrame.myBin32Scrl
grid forget .myFrame.myBin32Add .myFrame.myBin32Remove .myFrame.myBin32Clear .myFrame.myBin32ErrLbl
}
# Additional libraries (64-bit) search paths
grid .myFrame.myLib64Lbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter
grid .myFrame.myLib64List -row $aRowIter -column 0 -rowspan 4 -columnspan 5
grid .myFrame.myLib64Scrl -row $aRowIter -column 5 -rowspan 4
grid .myFrame.myLib64Add -row $aRowIter -column 6
incr aRowIter
#grid .myFrame.myLib64Edit -row $aRowIter -column 6
incr aRowIter
grid .myFrame.myLib64Remove -row $aRowIter -column 6
incr aRowIter
grid .myFrame.myLib64Clear -row $aRowIter -column 6
incr aRowIter
grid .myFrame.myLib64ErrLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter
# Additional executables (64-bit) search paths
grid .myFrame.myBin64Lbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter
grid .myFrame.myBin64List -row $aRowIter -column 0 -rowspan 4 -columnspan 5
grid .myFrame.myBin64Scrl -row $aRowIter -column 5 -rowspan 4
grid .myFrame.myBin64Add -row $aRowIter -column 6
incr aRowIter
#grid .myFrame.myBin64Edit -row $aRowIter -column 6
incr aRowIter
grid .myFrame.myBin64Remove -row $aRowIter -column 6
incr aRowIter
grid .myFrame.myBin64Clear -row $aRowIter -column 6
incr aRowIter
grid .myFrame.myBin64ErrLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter incr aRowIter
} }
@@ -448,7 +459,6 @@ ttk::combobox .myFrame.myPrjFrame.myPrjCombo -values $SYS_PRJNAME_LIST -state
ttk::label .myFrame.myVsFrame.myVsLbl -text "Visual Studio configuration:" -padding {5 5 20 5} ttk::label .myFrame.myVsFrame.myVsLbl -text "Visual Studio configuration:" -padding {5 5 20 5}
ttk::combobox .myFrame.myVsFrame.myVsCombo -values $SYS_VS_LIST -state readonly -textvariable VSVER -width 40 ttk::combobox .myFrame.myVsFrame.myVsCombo -values $SYS_VS_LIST -state readonly -textvariable VSVER -width 40
ttk::combobox .myFrame.myVsFrame.myArchCombo -values { {32} {64} } -textvariable ARCH -state readonly -width 6 ttk::combobox .myFrame.myVsFrame.myArchCombo -values { {32} {64} } -textvariable ARCH -state readonly -width 6
ttk::combobox .myFrame.myVsFrame.myConfigCombo -values { {Release} {Debug} } -textvariable CONFIG -state readonly -width 6
entry .myFrame.myVcEntry -textvariable VCVER -width 10 entry .myFrame.myVcEntry -textvariable VCVER -width 10
entry .myFrame.myVcVarsEntry -textvariable VCVARS -width 70 entry .myFrame.myVcVarsEntry -textvariable VCVARS -width 70
ttk::button .myFrame.myVcBrowseBtn -text "Browse" -command wokdep:gui:BrowseVcVars ttk::button .myFrame.myVcBrowseBtn -text "Browse" -command wokdep:gui:BrowseVcVars
@@ -485,11 +495,9 @@ ttk::label .myFrame.myChecks.myFFmpegLbl -text "Use FFmpeg"
#ttk::label .myFrame.myChecks.myOpenClLbl -text "Use OpenCL" #ttk::label .myFrame.myChecks.myOpenClLbl -text "Use OpenCL"
checkbutton .myFrame.myChecks.myRapidJsonCheck -offvalue "false" -onvalue "true" -variable HAVE_RAPIDJSON -command wokdep:gui:UpdateList checkbutton .myFrame.myChecks.myRapidJsonCheck -offvalue "false" -onvalue "true" -variable HAVE_RAPIDJSON -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myRapidJsonLbl -text "Use RapidJSON" ttk::label .myFrame.myChecks.myRapidJsonLbl -text "Use RapidJSON"
checkbutton .myFrame.myChecks.myDracoCheck -offvalue "false" -onvalue "true" -variable HAVE_DRACO -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myDracoLbl -text "Use Draco"
checkbutton .myFrame.myChecks.myXLibCheck -offvalue "false" -onvalue "true" -variable HAVE_XLIB checkbutton .myFrame.myChecks.myMacGLXCheck -offvalue "false" -onvalue "true" -variable MACOSX_USE_GLX
ttk::label .myFrame.myChecks.myXLibLbl -text "Use X11 for windows drawing" ttk::label .myFrame.myChecks.myMacGLXLbl -text "Use X11 for windows drawing"
ttk::label .myFrame.myChecks.myVtkLbl -text "Use VTK" ttk::label .myFrame.myChecks.myVtkLbl -text "Use VTK"
checkbutton .myFrame.myChecks.myVtkCheck -offvalue "false" -onvalue "true" -variable HAVE_VTK -command wokdep:gui:UpdateList checkbutton .myFrame.myChecks.myVtkCheck -offvalue "false" -onvalue "true" -variable HAVE_VTK -command wokdep:gui:UpdateList
@@ -521,84 +529,44 @@ ttk::button .myFrame.myIncClear -text "Reset" -command wokdep:gui:ResetIncP
ttk::label .myFrame.myIncErrLbl -text "Error: " -foreground red -padding {5 5 5 5} ttk::label .myFrame.myIncErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional libraries (32-bit) search paths # Additional libraries (32-bit) search paths
ttk::label .myFrame.myLib32_Lbl -text "Additional libraries (32-bit) search paths:" -padding {5 5 80 5} ttk::label .myFrame.myLib32Lbl -text "Additional libraries (32-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myLib32_Scrl -command ".myFrame.myLib32_List yview" scrollbar .myFrame.myLib32Scrl -command ".myFrame.myLib32List yview"
listbox .myFrame.myLib32_List -listvariable CSF_OPT_LIB32 -width 80 -height 5 -yscrollcommand ".myFrame.myLib32_Scrl set" listbox .myFrame.myLib32List -listvariable CSF_OPT_LIB32 -width 80 -height 5 -yscrollcommand ".myFrame.myLib32Scrl set"
ttk::button .myFrame.myLib32_Add -text "Add" -command wokdep:gui:AddLibPath ttk::button .myFrame.myLib32Add -text "Add" -command wokdep:gui:AddLib32Path
ttk::button .myFrame.myLib32_Edit -text "Edit" ttk::button .myFrame.myLib32Edit -text "Edit"
ttk::button .myFrame.myLib32_Remove -text "Remove" -command wokdep:gui:RemoveLibPath ttk::button .myFrame.myLib32Remove -text "Remove" -command wokdep:gui:RemoveLib32Path
ttk::button .myFrame.myLib32_Clear -text "Reset" -command wokdep:gui:ResetLibPath ttk::button .myFrame.myLib32Clear -text "Reset" -command wokdep:gui:ResetLib32Path
ttk::label .myFrame.myLib32_ErrLbl -text "Error: " -foreground red -padding {5 5 5 5} ttk::label .myFrame.myLib32ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional debug libraries (32-bit) search paths
ttk::label .myFrame.myLib32D_Lbl -text "Additional debug libraries (32-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myLib32D_Scrl -command ".myFrame.myLib32D_List yview"
listbox .myFrame.myLib32D_List -listvariable CSF_OPT_LIB32D -width 80 -height 5 -yscrollcommand ".myFrame.myLib32D_Scrl set"
ttk::button .myFrame.myLib32D_Add -text "Add" -command wokdep:gui:AddLibPath
ttk::button .myFrame.myLib32D_Edit -text "Edit"
ttk::button .myFrame.myLib32D_Remove -text "Remove" -command wokdep:gui:RemoveLibPath
ttk::button .myFrame.myLib32D_Clear -text "Reset" -command wokdep:gui:ResetLibPath
ttk::label .myFrame.myLib32D_ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional libraries (64-bit) search paths # Additional libraries (64-bit) search paths
ttk::label .myFrame.myLib64_Lbl -text "Additional libraries (64-bit) search paths:" -padding {5 5 80 5} ttk::label .myFrame.myLib64Lbl -text "Additional libraries (64-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myLib64_Scrl -command ".myFrame.myLib64_List yview" scrollbar .myFrame.myLib64Scrl -command ".myFrame.myLib64List yview"
listbox .myFrame.myLib64_List -listvariable CSF_OPT_LIB64 -width 80 -height 5 -yscrollcommand ".myFrame.myLib64_Scrl set" listbox .myFrame.myLib64List -listvariable CSF_OPT_LIB64 -width 80 -height 5 -yscrollcommand ".myFrame.myLib64Scrl set"
ttk::button .myFrame.myLib64_Add -text "Add" -command wokdep:gui:AddLibPath ttk::button .myFrame.myLib64Add -text "Add" -command wokdep:gui:AddLib64Path
ttk::button .myFrame.myLib64_Edit -text "Edit" ttk::button .myFrame.myLib64Edit -text "Edit"
ttk::button .myFrame.myLib64_Remove -text "Remove" -command wokdep:gui:RemoveLibPath ttk::button .myFrame.myLib64Remove -text "Remove" -command wokdep:gui:RemoveLib64Path
ttk::button .myFrame.myLib64_Clear -text "Reset" -command wokdep:gui:ResetLibPath ttk::button .myFrame.myLib64Clear -text "Reset" -command wokdep:gui:ResetLib64Path
ttk::label .myFrame.myLib64_ErrLbl -text "Error: " -foreground red -padding {5 5 5 5} ttk::label .myFrame.myLib64ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional debug libraries (64-bit) search paths
ttk::label .myFrame.myLib64D_Lbl -text "Additional debug libraries (64-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myLib64D_Scrl -command ".myFrame.myLib64D_List yview"
listbox .myFrame.myLib64D_List -listvariable CSF_OPT_LIB64D -width 80 -height 5 -yscrollcommand ".myFrame.myLib64D_Scrl set"
ttk::button .myFrame.myLib64D_Add -text "Add" -command wokdep:gui:AddLibPath
ttk::button .myFrame.myLib64D_Edit -text "Edit"
ttk::button .myFrame.myLib64D_Remove -text "Remove" -command wokdep:gui:RemoveLibPath
ttk::button .myFrame.myLib64D_Clear -text "Reset" -command wokdep:gui:ResetLibPath
ttk::label .myFrame.myLib64D_ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional executables (32-bit) search paths # Additional executables (32-bit) search paths
ttk::label .myFrame.myBin32_Lbl -text "Additional executables (32-bit) search paths:" -padding {5 5 80 5} ttk::label .myFrame.myBin32Lbl -text "Additional executables (32-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myBin32_Scrl -command ".myFrame.myBin32_List yview" scrollbar .myFrame.myBin32Scrl -command ".myFrame.myBin32List yview"
listbox .myFrame.myBin32_List -listvariable CSF_OPT_BIN32 -width 80 -height 5 -yscrollcommand ".myFrame.myBin32_Scrl set" listbox .myFrame.myBin32List -listvariable CSF_OPT_BIN32 -width 80 -height 5 -yscrollcommand ".myFrame.myBin32Scrl set"
ttk::button .myFrame.myBin32_Add -text "Add" -command wokdep:gui:AddBinPath ttk::button .myFrame.myBin32Add -text "Add" -command wokdep:gui:AddBin32Path
ttk::button .myFrame.myBin32_Edit -text "Edit" ttk::button .myFrame.myBin32Edit -text "Edit"
ttk::button .myFrame.myBin32_Remove -text "Remove" -command wokdep:gui:RemoveBinPath ttk::button .myFrame.myBin32Remove -text "Remove" -command wokdep:gui:RemoveBin32Path
ttk::button .myFrame.myBin32_Clear -text "Reset" -command wokdep:gui:ResetLibPath ttk::button .myFrame.myBin32Clear -text "Reset" -command wokdep:gui:ResetBin32Path
ttk::label .myFrame.myBin32_ErrLbl -text "Error: " -foreground red -padding {5 5 5 5} ttk::label .myFrame.myBin32ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional debug executables (32-bit) search paths
ttk::label .myFrame.myBin32D_Lbl -text "Additional debug executables (32-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myBin32D_Scrl -command ".myFrame.myBin32D_List yview"
listbox .myFrame.myBin32D_List -listvariable CSF_OPT_BIN32D -width 80 -height 5 -yscrollcommand ".myFrame.myBin32D_Scrl set"
ttk::button .myFrame.myBin32D_Add -text "Add" -command wokdep:gui:AddBinPath
ttk::button .myFrame.myBin32D_Edit -text "Edit"
ttk::button .myFrame.myBin32D_Remove -text "Remove" -command wokdep:gui:RemoveBinPath
ttk::button .myFrame.myBin32D_Clear -text "Reset" -command wokdep:gui:ResetLibPath
ttk::label .myFrame.myBin32D_ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional executables (64-bit) search paths # Additional executables (64-bit) search paths
ttk::label .myFrame.myBin64_Lbl -text "Additional executables (64-bit) search paths:" -padding {5 5 80 5} ttk::label .myFrame.myBin64Lbl -text "Additional executables (64-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myBin64_Scrl -command ".myFrame.myBin64_List yview" scrollbar .myFrame.myBin64Scrl -command ".myFrame.myBin64List yview"
listbox .myFrame.myBin64_List -listvariable CSF_OPT_BIN64 -width 80 -height 5 -yscrollcommand ".myFrame.myBin64_Scrl set" listbox .myFrame.myBin64List -listvariable CSF_OPT_BIN64 -width 80 -height 5 -yscrollcommand ".myFrame.myBin64Scrl set"
ttk::button .myFrame.myBin64_Add -text "Add" -command wokdep:gui:AddBinPath ttk::button .myFrame.myBin64Add -text "Add" -command wokdep:gui:AddBin64Path
ttk::button .myFrame.myBin64_Edit -text "Edit" ttk::button .myFrame.myBin64Edit -text "Edit"
ttk::button .myFrame.myBin64_Remove -text "Remove" -command wokdep:gui:RemoveBinPath ttk::button .myFrame.myBin64Remove -text "Remove" -command wokdep:gui:RemoveBin64Path
ttk::button .myFrame.myBin64_Clear -text "Reset" -command wokdep:gui:ResetLibPath ttk::button .myFrame.myBin64Clear -text "Reset" -command wokdep:gui:ResetBin64Path
ttk::label .myFrame.myBin64_ErrLbl -text "Error: " -foreground red -padding {5 5 5 5} ttk::label .myFrame.myBin64ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional debug executables (64-bit) search paths
ttk::label .myFrame.myBin64D_Lbl -text "Additional debug executables (64-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myBin64D_Scrl -command ".myFrame.myBin64D_List yview"
listbox .myFrame.myBin64D_List -listvariable CSF_OPT_BIN64D -width 80 -height 5 -yscrollcommand ".myFrame.myBin64D_Scrl set"
ttk::button .myFrame.myBin64D_Add -text "Add" -command wokdep:gui:AddBinPath
ttk::button .myFrame.myBin64D_Edit -text "Edit"
ttk::button .myFrame.myBin64D_Remove -text "Remove" -command wokdep:gui:RemoveBinPath
ttk::button .myFrame.myBin64D_Clear -text "Reset" -command wokdep:gui:ResetLibPath
ttk::label .myFrame.myBin64D_ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Bottom # Bottom
ttk::button .myFrame.mySave -text "Save" -command wokdep:SaveCustom ttk::button .myFrame.mySave -text "Save" -command wokdep:SaveCustom
@@ -609,22 +577,17 @@ ttk::button .myFrame.myClose -text "Close" -command wokdep:gui:Close
grid .myFrame.myPrjFrame -row $aRowIter -column 0 -columnspan 10 -sticky w grid .myFrame.myPrjFrame -row $aRowIter -column 0 -columnspan 10 -sticky w
grid .myFrame.myPrjFrame.myPrjLbl -row 0 -column 0 grid .myFrame.myPrjFrame.myPrjLbl -row 0 -column 0
grid .myFrame.myPrjFrame.myPrjCombo -row 0 -column 1 grid .myFrame.myPrjFrame.myPrjCombo -row 0 -column 1
incr aRowIter
if { "$tcl_platform(platform)" == "windows" } { if { "$tcl_platform(platform)" == "windows" } {
incr aRowIter
grid .myFrame.myVsFrame -row $aRowIter -column 0 -columnspan 10 -sticky w grid .myFrame.myVsFrame -row $aRowIter -column 0 -columnspan 10 -sticky w
grid .myFrame.myVsFrame.myVsLbl -row 0 -column 0 grid .myFrame.myVsFrame.myVsLbl -row 0 -column 0
grid .myFrame.myVsFrame.myVsCombo -row 0 -column 1 -padx 5 grid .myFrame.myVsFrame.myVsCombo -row 0 -column 1 -padx 5
grid .myFrame.myVsFrame.myArchCombo -row 0 -column 2 grid .myFrame.myVsFrame.myArchCombo -row 0 -column 2
grid .myFrame.myVsFrame.myConfigCombo -row 0 -column 3
incr aRowIter incr aRowIter
grid .myFrame.myVcEntry -row $aRowIter -column 0 grid .myFrame.myVcEntry -row $aRowIter -column 0
grid .myFrame.myVcVarsEntry -row $aRowIter -column 1 -columnspan 4 -sticky w grid .myFrame.myVcVarsEntry -row $aRowIter -column 1 -columnspan 4 -sticky w
grid .myFrame.myVcBrowseBtn -row $aRowIter -column 6 grid .myFrame.myVcBrowseBtn -row $aRowIter -column 6
incr aRowIter incr aRowIter
} else {
grid .myFrame.myVsFrame -row $aRowIter -column 4 -sticky w
grid .myFrame.myVsFrame.myConfigCombo -row 0 -column 0
incr aRowIter
} }
# #
@@ -664,15 +627,14 @@ grid .myFrame.myChecks.myQtLbl -row $aCheckRowIter -column 13 -sticky w
incr aCheckRowIter incr aCheckRowIter
grid .myFrame.myChecks.myFImageCheck -row $aCheckRowIter -column 0 -sticky e grid .myFrame.myChecks.myFImageCheck -row $aCheckRowIter -column 0 -sticky e
grid .myFrame.myChecks.myFImageLbl -row $aCheckRowIter -column 1 -sticky w grid .myFrame.myChecks.myFImageLbl -row $aCheckRowIter -column 1 -sticky w
grid .myFrame.myChecks.myDracoCheck -row $aCheckRowIter -column 2 -sticky e grid .myFrame.myChecks.myTbbCheck -row $aCheckRowIter -column 2 -sticky e
grid .myFrame.myChecks.myDracoLbl -row $aCheckRowIter -column 3 -sticky w grid .myFrame.myChecks.myTbbLbl -row $aCheckRowIter -column 3 -sticky w
if { "$::tcl_platform(platform)" == "windows" } { if { "$::tcl_platform(platform)" == "windows" } {
grid .myFrame.myChecks.myD3dCheck -row $aCheckRowIter -column 4 -sticky e grid .myFrame.myChecks.myD3dCheck -row $aCheckRowIter -column 4 -sticky e
grid .myFrame.myChecks.myD3dLbl -row $aCheckRowIter -column 5 -sticky w grid .myFrame.myChecks.myD3dLbl -row $aCheckRowIter -column 5 -sticky w
} else { } elseif { "$::tcl_platform(os)" == "Darwin" } {
grid .myFrame.myChecks.myXLibCheck -row $aCheckRowIter -column 4 -sticky e grid .myFrame.myChecks.myMacGLXCheck -row $aCheckRowIter -column 4 -sticky e
grid .myFrame.myChecks.myXLibLbl -row $aCheckRowIter -column 5 -sticky w grid .myFrame.myChecks.myMacGLXLbl -row $aCheckRowIter -column 5 -sticky w
} }
grid .myFrame.myChecks.myLzmaCheck -row $aCheckRowIter -column 6 -sticky e grid .myFrame.myChecks.myLzmaCheck -row $aCheckRowIter -column 6 -sticky e
grid .myFrame.myChecks.myLzmaLbl -row $aCheckRowIter -column 7 -sticky w grid .myFrame.myChecks.myLzmaLbl -row $aCheckRowIter -column 7 -sticky w
@@ -696,11 +658,6 @@ if { "$::tcl_platform(platform)" == "windows" } {
incr aCheckRowIter incr aCheckRowIter
grid .myFrame.myChecks.myTbbCheck -row $aCheckRowIter -column 12 -sticky e
grid .myFrame.myChecks.myTbbLbl -row $aCheckRowIter -column 13 -sticky w
incr aCheckRowIter
# Additional headers search paths # Additional headers search paths
grid .myFrame.myIncLbl -row $aRowIter -column 0 -columnspan 10 -sticky w grid .myFrame.myIncLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter incr aRowIter
@@ -717,8 +674,15 @@ incr aRowIter
grid .myFrame.myIncErrLbl -row $aRowIter -column 0 -columnspan 10 -sticky w grid .myFrame.myIncErrLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter incr aRowIter
# Additional search paths # Additional 32-bit search paths
wokdep:gui:Show3264Bitness aRowIter if { "$ARCH" == "32" } {
wokdep:gui:Show32Bitness aRowIter
}
# Additional 64-bit search paths
if { "$ARCH" == "64" } {
wokdep:gui:Show64Bitness aRowIter
}
# Bottom section # Bottom section
grid .myFrame.mySave -row $aRowIter -column 4 -columnspan 2 grid .myFrame.mySave -row $aRowIter -column 4 -columnspan 2
@@ -734,9 +698,6 @@ bind .myFrame.myVsFrame.myVsCombo <<ComboboxSelected>> {
bind .myFrame.myVsFrame.myArchCombo <<ComboboxSelected>> { bind .myFrame.myVsFrame.myArchCombo <<ComboboxSelected>> {
wokdep:gui:SwitchArch wokdep:gui:SwitchArch
} }
bind .myFrame.myVsFrame.myConfigCombo <<ComboboxSelected>> {
wokdep:gui:SwitchArch
}
.myFrame.mySrchEntry configure -validate all -validatecommand { .myFrame.mySrchEntry configure -validate all -validatecommand {
set ::PRODUCTS_PATH [file normalize "$::PRODUCTS_PATH_INPUT"] set ::PRODUCTS_PATH [file normalize "$::PRODUCTS_PATH_INPUT"]

View File

@@ -52,10 +52,6 @@ set CSF_OPT_LIB32 [list]
set CSF_OPT_LIB64 [list] set CSF_OPT_LIB64 [list]
set CSF_OPT_BIN32 [list] set CSF_OPT_BIN32 [list]
set CSF_OPT_BIN64 [list] set CSF_OPT_BIN64 [list]
set CSF_OPT_LIB32D [list]
set CSF_OPT_LIB64D [list]
set CSF_OPT_BIN32D [list]
set CSF_OPT_BIN64D [list]
if { "$tcl_platform(pointerSize)" == "4" } { if { "$tcl_platform(pointerSize)" == "4" } {
set ARCH "32" set ARCH "32"
@@ -72,14 +68,10 @@ if { [info exists ::env(SHORTCUT_HEADERS)] } {
} }
# fetch environment variables (e.g. set by custom.sh or custom.bat) and set them as tcl variables with the same name # fetch environment variables (e.g. set by custom.sh or custom.bat) and set them as tcl variables with the same name
set THE_ENV_VARIABLES { HAVE_TK HAVE_FREETYPE HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK \ set THE_ENV_VARIABLES {HAVE_TK HAVE_FREETYPE HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_E57 HAVE_RAPIDJSON HAVE_OPENVR HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo BUILD_Inspector}
HAVE_ZLIB HAVE_LIBLZMA HAVE_E57 HAVE_RAPIDJSON HAVE_DRACO HAVE_OPENVR HAVE_OPENCL \
CHECK_QT4 CHECK_JDK HAVE_XLIB \
HAVE_RelWithDebInfo BUILD_Inspector }
foreach anEnvIter $THE_ENV_VARIABLES { set ${anEnvIter} "false" } foreach anEnvIter $THE_ENV_VARIABLES { set ${anEnvIter} "false" }
set HAVE_TK "true" set HAVE_TK "true"
set HAVE_FREETYPE "true" set HAVE_FREETYPE "true"
if { "$tcl_platform(os)" != "Darwin" } { set HAVE_XLIB "true" }
foreach anEnvIter $THE_ENV_VARIABLES { foreach anEnvIter $THE_ENV_VARIABLES {
if { [info exists ::env(${anEnvIter})] } { if { [info exists ::env(${anEnvIter})] } {
set ${anEnvIter} "$::env(${anEnvIter})" set ${anEnvIter} "$::env(${anEnvIter})"
@@ -88,12 +80,12 @@ foreach anEnvIter $THE_ENV_VARIABLES {
# do not export platform-specific variables # do not export platform-specific variables
if { "$::tcl_platform(os)" == "Darwin" } { if { "$::tcl_platform(os)" == "Darwin" } {
set HAVE_GLES2 "" set HAVE_GLES2 ""
} else {
set MACOSX_USE_GLX ""
} }
if { "$tcl_platform(platform)" != "windows" } { if { "$tcl_platform(platform)" != "windows" } {
set HAVE_D3D "" set HAVE_D3D ""
set HAVE_RelWithDebInfo "" set HAVE_RelWithDebInfo ""
} else {
set HAVE_XLIB ""
} }
foreach anEnvIter {ARCH VCVER VCVARS PRJFMT } { foreach anEnvIter {ARCH VCVER VCVARS PRJFMT } {
if { [info exists ::env(${anEnvIter})] } { if { [info exists ::env(${anEnvIter})] } {
@@ -120,35 +112,6 @@ if { [info exists ::env(CSF_OPT_BIN64)] } {
set CSF_OPT_BIN64 [split "$::env(CSF_OPT_BIN64)" $::SYS_PATH_SPLITTER] set CSF_OPT_BIN64 [split "$::env(CSF_OPT_BIN64)" $::SYS_PATH_SPLITTER]
} }
if { [info exists ::env(CSF_OPT_LIB32D)] } {
set CSF_OPT_LIB32D [split "$::env(CSF_OPT_LIB32D)" $::SYS_PATH_SPLITTER]
foreach aLibIter $::CSF_OPT_LIB32 {
set aPos [lsearch -exact $::CSF_OPT_LIB32D $aLibIter]
set ::CSF_OPT_LIB32D [lreplace $::CSF_OPT_LIB32D $aPos $aPos]
}
}
if { [info exists ::env(CSF_OPT_LIB64D)] } {
set CSF_OPT_LIB64D [split "$::env(CSF_OPT_LIB64D)" $::SYS_PATH_SPLITTER]
foreach aLibIter $::CSF_OPT_LIB64 {
set aPos [lsearch -exact $::CSF_OPT_LIB64D $aLibIter]
set ::CSF_OPT_LIB64D [lreplace $::CSF_OPT_LIB64D $aPos $aPos]
}
}
if { [info exists ::env(CSF_OPT_BIN32D)] } {
set CSF_OPT_BIN32D [split "$::env(CSF_OPT_BIN32D)" $::SYS_PATH_SPLITTER]
foreach aLibIter $::CSF_OPT_BIN32 {
set aPos [lsearch -exact $::CSF_OPT_BIN32D $aLibIter]
set ::CSF_OPT_BIN32D [lreplace $::CSF_OPT_BIN32D $aPos $aPos]
}
}
if { [info exists ::env(CSF_OPT_BIN64D)] } {
set CSF_OPT_BIN64D [split "$::env(CSF_OPT_BIN64D)" $::SYS_PATH_SPLITTER]
foreach aLibIter $::CSF_OPT_BIN64 {
set aPos [lsearch -exact $::CSF_OPT_BIN64D $aLibIter]
set ::CSF_OPT_BIN64D [lreplace $::CSF_OPT_BIN64D $aPos $aPos]
}
}
# Search header file in $::CSF_OPT_INC and standard paths # Search header file in $::CSF_OPT_INC and standard paths
proc wokdep:SearchHeader {theHeader} { proc wokdep:SearchHeader {theHeader} {
# search in custom paths # search in custom paths
@@ -349,12 +312,6 @@ proc wokdep:SearchStandardLibrary {theErrInc theErrLib32 theErrLib64 theErrBin32
lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
set hasLib true set hasLib true
set aLibDPath [wokdep:SearchLib "$theCheckLib" "$anArchIter" "$aPath/libd"]
if { "$aLibDPath" != "" } {
lappend ::CSF_OPT_LIB${anArchIter}D "$aPath/libd"
lappend ::CSF_OPT_BIN${anArchIter}D "$aPath/bind"
}
break break
} }
} }
@@ -1086,45 +1043,36 @@ proc wokdep:SearchVTK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
} }
} }
} }
}
# Search binary path # Search binary path
if { "$::tcl_platform(platform)" == "windows" } { if { "$::tcl_platform(platform)" == "windows" } {
set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter"] foreach anArchIter {64 32} {
if { "$aVtkBinPath" == "" } { set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter"]
set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*] if { "$aVtkBinPath" == "" } {
set aPath [wokdep:Preferred $aPathList "$::VCVER" "$anArchIter" ] set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*] "$::VCVER" "$anArchIter" ]
set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/bin"] set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/bin"]
if { "$aVtkBinPath" != "" } { if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
} else {
# Try to find in lib path
set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/lib"]
if { "$aVtkBinPath" != "" } {
lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib"
} else { } else {
# We didn't find preferred binary path => search through all available VTK directories set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/lib"]
foreach anIt $aPathList { if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib" }
set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$anIt/bin"]
if { "$aVtkBinPath" != "" } {
lappend ::CSF_OPT_BIN$anArchIter "$anIt/bin"
break
} else {
# Try to find in lib path
set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$anIt/lib"]
if { "$aVtkBinPath" != "" } {
lappend ::CSF_OPT_BIN$anArchIter "$anIt/lib"
}
}
}
if { "$aVtkBinPath" == "" } {
lappend anErrBin$anArchIter "Error: 'vtkCommonCore-${aVtkVer}.dll' not found (VTK)"
set isFound "false"
}
} }
} }
} }
# We didn't find preferred binary path => search through inc path or among all available VTK directories
if { "$aVtkBinPath" == "" } {
# Try to find in lib path
set aPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aVtkLibPath/bin"]
if { "$aPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aVtkLibPath/bin"
} elseif { [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aVtkLibPath/lib"] != "" } {
lappend ::CSF_OPT_BIN$anArchIter "$aVtkLibPath/lib"
} else {
lappend anErrBin$anArchIter "Error: 'vtkCommonCore-${aVtkVer}.dll' not found (VTK)"
set isFound "false"
}
}
} }
}
return "$isFound" return "$isFound"
} }
@@ -1247,17 +1195,17 @@ proc wokdep:SearchX11 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
upvar $theErrBin64 anErrBin64 upvar $theErrBin64 anErrBin64
set isFound "true" set isFound "true"
if { "$::tcl_platform(platform)" == "windows" || ( "$::tcl_platform(os)" == "Darwin" && "$::HAVE_XLIB" != "true" ) } { if { "$::tcl_platform(platform)" == "windows" || ( "$::tcl_platform(os)" == "Darwin" && "$::MACOSX_USE_GLX" != "true" ) } {
return "$isFound" return "$isFound"
} }
set aX11LibPath [wokdep:SearchLib "X11" "$::ARCH"] set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH"]
if { "$aX11LibPath" == "" } { if { "$aXmuLibPath" == "" } {
set aX11LibPath [wokdep:SearchLib "X11" "$::ARCH" "/usr/X11/lib"] set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH" "/usr/X11/lib"]
if { "$aX11LibPath" != "" } { if { "$aXmuLibPath" != "" } {
#lappend ::CSF_OPT_LIB$::ARCH "/usr/X11/lib" #lappend ::CSF_OPT_LIB$::ARCH "/usr/X11/lib"
} else { } else {
lappend anErrLib$::ARCH "Error: '${::SYS_LIB_PREFIX}X11.${::SYS_LIB_SUFFIX}' not found (X11)" lappend anErrLib$::ARCH "Error: '${::SYS_LIB_PREFIX}Xmu.${::SYS_LIB_SUFFIX}' not found (X11)"
set isFound "false" set isFound "false"
} }
} }
@@ -1326,18 +1274,6 @@ proc wokdep:SaveCustom {} {
puts $aFile "rem Additional libraries (32-bit) search paths" puts $aFile "rem Additional libraries (32-bit) search paths"
puts $aFile "set \"CSF_OPT_LIB32=$aStringLib32\"" puts $aFile "set \"CSF_OPT_LIB32=$aStringLib32\""
set aStringLib32d [join $::CSF_OPT_LIB32D $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } {
set aStringLib32d [regsub -all "$::PRODUCTS_PATH" $aStringLib32d "%PRODUCTS_PATH%"]
}
puts $aFile ""
puts $aFile "rem Additional debug libraries (32-bit) search paths"
if { "$aStringLib32d" != "" && "$aStringLib32" != "" } {
puts $aFile "set \"CSF_OPT_LIB32D=$aStringLib32d;%CSF_OPT_LIB32%\""
} else {
puts $aFile "set \"CSF_OPT_LIB32D=$aStringLib32d\""
}
set aStringLib64 [join $::CSF_OPT_LIB64 $::SYS_PATH_SPLITTER] set aStringLib64 [join $::CSF_OPT_LIB64 $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } { if { "$::PRODUCTS_PATH" != "" } {
set aStringLib64 [regsub -all "$::PRODUCTS_PATH" $aStringLib64 "%PRODUCTS_PATH%"] set aStringLib64 [regsub -all "$::PRODUCTS_PATH" $aStringLib64 "%PRODUCTS_PATH%"]
@@ -1346,18 +1282,6 @@ proc wokdep:SaveCustom {} {
puts $aFile "rem Additional libraries (64-bit) search paths" puts $aFile "rem Additional libraries (64-bit) search paths"
puts $aFile "set \"CSF_OPT_LIB64=$aStringLib64\"" puts $aFile "set \"CSF_OPT_LIB64=$aStringLib64\""
set aStringLib64d [join $::CSF_OPT_LIB64D $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } {
set aStringLib64d [regsub -all "$::PRODUCTS_PATH" $aStringLib64d "%PRODUCTS_PATH%"]
}
puts $aFile ""
puts $aFile "rem Additional debug libraries (64-bit) search paths"
if { "$aStringLib64d" != "" && "$aStringLib64" != "" } {
puts $aFile "set \"CSF_OPT_LIB64D=$aStringLib64d;%CSF_OPT_LIB64%\""
} else {
puts $aFile "set \"CSF_OPT_LIB64D=$aStringLib64d\""
}
set aStringBin32 [join $::CSF_OPT_BIN32 $::SYS_PATH_SPLITTER] set aStringBin32 [join $::CSF_OPT_BIN32 $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } { if { "$::PRODUCTS_PATH" != "" } {
set aStringBin32 [regsub -all "$::PRODUCTS_PATH" $aStringBin32 "%PRODUCTS_PATH%"] set aStringBin32 [regsub -all "$::PRODUCTS_PATH" $aStringBin32 "%PRODUCTS_PATH%"]
@@ -1366,18 +1290,6 @@ proc wokdep:SaveCustom {} {
puts $aFile "rem Additional (32-bit) search paths" puts $aFile "rem Additional (32-bit) search paths"
puts $aFile "set \"CSF_OPT_BIN32=$aStringBin32\"" puts $aFile "set \"CSF_OPT_BIN32=$aStringBin32\""
set aStringBin32d [join $::CSF_OPT_BIN32D $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } {
set aStringBin32d [regsub -all "$::PRODUCTS_PATH" $aStringBin32d "%PRODUCTS_PATH%"]
}
puts $aFile ""
puts $aFile "rem Additional debug (32-bit) search paths"
if { "$aStringBin32d" != "" && "$aStringBin32" != "" } {
puts $aFile "set \"CSF_OPT_BIN32D=$aStringBin32d;%CSF_OPT_BIN32%\""
} else {
puts $aFile "set \"CSF_OPT_BIN32D=$aStringBin32d\""
}
set aStringBin64 [join $::CSF_OPT_BIN64 $::SYS_PATH_SPLITTER] set aStringBin64 [join $::CSF_OPT_BIN64 $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } { if { "$::PRODUCTS_PATH" != "" } {
set aStringBin64 [regsub -all "$::PRODUCTS_PATH" $aStringBin64 "%PRODUCTS_PATH%"] set aStringBin64 [regsub -all "$::PRODUCTS_PATH" $aStringBin64 "%PRODUCTS_PATH%"]
@@ -1386,18 +1298,6 @@ proc wokdep:SaveCustom {} {
puts $aFile "rem Additional (64-bit) search paths" puts $aFile "rem Additional (64-bit) search paths"
puts $aFile "set \"CSF_OPT_BIN64=$aStringBin64\"" puts $aFile "set \"CSF_OPT_BIN64=$aStringBin64\""
set aStringBin64d [join $::CSF_OPT_BIN64D $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } {
set aStringBin64d [regsub -all "$::PRODUCTS_PATH" $aStringBin64d "%PRODUCTS_PATH%"]
}
puts $aFile ""
puts $aFile "rem Additional debug (64-bit) search paths"
if { "$aStringBin64d" != "" && "$aStringBin64" != "" } {
puts $aFile "set \"CSF_OPT_BIN64D=$aStringBin64d;%CSF_OPT_BIN64%\""
} else {
puts $aFile "set \"CSF_OPT_BIN64D=$aStringBin64d\""
}
close $aFile close $aFile
} else { } else {
set aCustomFilePath "./custom.sh" set aCustomFilePath "./custom.sh"
@@ -1439,18 +1339,6 @@ proc wokdep:SaveCustom {} {
puts $aFile "# Additional libraries ($::ARCH-bit) search paths" puts $aFile "# Additional libraries ($::ARCH-bit) search paths"
puts $aFile "export CSF_OPT_LIB$::ARCH=\"[set aStringLib]\"" puts $aFile "export CSF_OPT_LIB$::ARCH=\"[set aStringLib]\""
set aStringLibD [join [set ::CSF_OPT_LIB${::ARCH}D] $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } {
set aStringLibD [regsub -all "$::PRODUCTS_PATH" $aStringLibD "\${PRODUCTS_PATH}"]
}
puts $aFile ""
puts $aFile "# Additional debug libraries ($::ARCH-bit) search paths"
if { "$aStringLibD" != "" && "$aStringLib" != "" } {
puts $aFile "export CSF_OPT_LIB${::ARCH}D=\"[set aStringLibD]:\$CSF_OPT_LIB${::ARCH}\""
} else {
puts $aFile "export CSF_OPT_LIB${::ARCH}D=\"[set aStringLibD]\""
}
set aStringBin [join [set ::CSF_OPT_BIN$::ARCH] $::SYS_PATH_SPLITTER] set aStringBin [join [set ::CSF_OPT_BIN$::ARCH] $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } { if { "$::PRODUCTS_PATH" != "" } {
set aStringBin [regsub -all "$::PRODUCTS_PATH" $aStringBin "\${PRODUCTS_PATH}"] set aStringBin [regsub -all "$::PRODUCTS_PATH" $aStringBin "\${PRODUCTS_PATH}"]
@@ -1459,18 +1347,6 @@ proc wokdep:SaveCustom {} {
puts $aFile "# Additional ($::ARCH-bit) search paths" puts $aFile "# Additional ($::ARCH-bit) search paths"
puts $aFile "export CSF_OPT_BIN$::ARCH=\"[set aStringBin]\"" puts $aFile "export CSF_OPT_BIN$::ARCH=\"[set aStringBin]\""
set aStringBinD [join [set ::CSF_OPT_BIN${::ARCH}D] $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } {
set aStringBinD [regsub -all "$::PRODUCTS_PATH" $aStringBinD "\${PRODUCTS_PATH}"]
}
puts $aFile ""
puts $aFile "# Additional debug ($::ARCH-bit) search paths"
if { "$aStringBinD" != "" && "$aStringBin" != "" } {
puts $aFile "export CSF_OPT_BIN${::ARCH}D=\"[set aStringBinD]:\$CSF_OPT_BIN${::ARCH}\""
} else {
puts $aFile "export CSF_OPT_BIN${::ARCH}D=\"[set aStringBinD]\""
}
close $aFile close $aFile
} }
puts "Configuration saved to file '$aCustomFilePath'" puts "Configuration saved to file '$aCustomFilePath'"
@@ -1508,27 +1384,6 @@ proc wokdep:SaveCustom {} {
puts $aFile "INCLUDEPATH += \"${anIncPath}\"" puts $aFile "INCLUDEPATH += \"${anIncPath}\""
} }
puts $aFile ""
puts $aFile "CONFIG(debug, debug|release) {"
puts $aFile " # Additional debug libraries search paths"
foreach aLibPath [set ::CSF_OPT_LIB${::ARCH}D] {
if { "$::PRODUCTS_PATH" != "" } {
set aLibPath [regsub -all "$::PRODUCTS_PATH" $aLibPath "\$\$\{PRODUCTS_PATH\}"]
}
puts $aFile " LIBS += -L\"${aLibPath}\""
}
if { "$::tcl_platform(platform)" == "windows" } {
puts $aFile ""
puts $aFile " # Additional debug DLLs search paths"
foreach aDllPath [set ::CSF_OPT_BIN${::ARCH}D] {
if { "$::PRODUCTS_PATH" != "" } {
set aDllPath [regsub -all "$::PRODUCTS_PATH" $aDllPath "\$\$\{PRODUCTS_PATH\}"]
}
puts $aFile " LIBS += -L\"${aDllPath}\""
}
}
puts $aFile "}"
puts $aFile "" puts $aFile ""
puts $aFile "# Additional libraries search paths" puts $aFile "# Additional libraries search paths"
foreach aLibPath [set ::CSF_OPT_LIB$::ARCH] { foreach aLibPath [set ::CSF_OPT_LIB$::ARCH] {

View File

@@ -237,10 +237,8 @@ proc gendoc {args} {
} }
} elseif {$arg_n == "s"} { } elseif {$arg_n == "s"} {
if { [ lsearch $args_names "pdf" ] != -1 } { if { [ lsearch $args_names "pdf" ] != -1 } {
puts "Warning: search is not used with PDF and will be ignored."
continue continue
} }
if {$args_values(s) != "NULL"} { if {$args_values(s) != "NULL"} {
set SEARCH_MODE $args_values(s) set SEARCH_MODE $args_values(s)
} else { } else {
@@ -249,16 +247,16 @@ proc gendoc {args} {
} }
} elseif {$arg_n == "mathjax"} { } elseif {$arg_n == "mathjax"} {
if { [ lsearch $args_names "pdf" ] != -1 } { if { [ lsearch $args_names "pdf" ] != -1 } {
puts "Warning: MathJax is not used with PDF and will be ignored." set possible_mathjax_loc $args_values(mathjax)
} if {[file exist [file join $possible_mathjax_loc $mathjax_js_name]]} {
set MATHJAX_LOCATION $args_values(mathjax)
set possible_mathjax_loc $args_values(mathjax) puts "$MATHJAX_LOCATION"
if {[file exist [file join $possible_mathjax_loc $mathjax_js_name]]} { } else {
set MATHJAX_LOCATION $args_values(mathjax) puts "Warning: $mathjax_js_name is not found in $possible_mathjax_loc."
puts "$MATHJAX_LOCATION" puts " MathJax will be used from $MATHJAX_LOCATION"
}
} else { } else {
puts "Warning: $mathjax_js_name is not found in $possible_mathjax_loc." puts "Warning: MathJax is not used with pdf and will be ignored."
puts " MathJax will be used from $MATHJAX_LOCATION"
} }
} else { } else {
puts "\nWrong argument: $arg_n" puts "\nWrong argument: $arg_n"
@@ -835,7 +833,6 @@ proc OCCDoc_MakeDoxyfile {docType outDir tagFileDir {doxyFileName} {generatorMod
puts $doxyFile "PROJECT_NUMBER = $occt_version" puts $doxyFile "PROJECT_NUMBER = $occt_version"
puts $doxyFile "OUTPUT_DIRECTORY = $outDir/." puts $doxyFile "OUTPUT_DIRECTORY = $outDir/."
puts $doxyFile "PROJECT_LOGO = [OCCDoc_GetDoxDir]/resources/occ_logo.png" puts $doxyFile "PROJECT_LOGO = [OCCDoc_GetDoxDir]/resources/occ_logo.png"
puts $doxyFile "EXAMPLE_PATH = [OCCDoc_GetSourceDir $productsPath]"
set PARAM_INPUT "INPUT =" set PARAM_INPUT "INPUT ="
set PARAM_IMAGEPATH "IMAGE_PATH = [OCCDoc_GetDoxDir]/resources/ " set PARAM_IMAGEPATH "IMAGE_PATH = [OCCDoc_GetDoxDir]/resources/ "

View File

@@ -260,7 +260,7 @@ proc genAllResources { theSrcDir } {
# Wrapper-function to generate VS project files # Wrapper-function to generate VS project files
proc genproj {theFormat args} { proc genproj {theFormat args} {
set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "vc143" "vclang" "cbp" "xcd" "pro"} set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "vclang" "cbp" "xcd" "pro"}
set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" } set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" }
set isHelpRequire false set isHelpRequire false
@@ -324,7 +324,6 @@ proc genproj {theFormat args} {
vc14 - Visual Studio 2015 vc14 - Visual Studio 2015
vc141 - Visual Studio 2017 vc141 - Visual Studio 2017
vc142 - Visual Studio 2019 vc142 - Visual Studio 2019
vc143 - Visual Studio 2022
vclang - Visual Studio with ClangCL toolset vclang - Visual Studio with ClangCL toolset
cbp - CodeBlocks cbp - CodeBlocks
xcd - XCode xcd - XCode
@@ -561,7 +560,6 @@ proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl theSolution }
"vc14" - "vc14" -
"vc141" - "vc141" -
"vc142" - "vc142" -
"vc143" -
"vclang" { OS:MKVC $anOutDir $aModules $aTools $theSolution $theFormat $isUWP} "vclang" { OS:MKVC $anOutDir $aModules $aTools $theSolution $theFormat $isUWP}
"cbp" { OS:MKCBP $anOutDir $aModules $theSolution $thePlatform $theCmpl } "cbp" { OS:MKCBP $anOutDir $aModules $theSolution $thePlatform $theCmpl }
"xcd" { "xcd" {
@@ -1016,8 +1014,8 @@ proc osutils:vcsolution:header { vcversion } {
append var \ append var \
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \ "Microsoft Visual Studio Solution File, Format Version 12.00\n" \
"# Visual Studio 2013\n" "# Visual Studio 2013\n"
} elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141" || } elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141" ||
"$vcversion" == "vc142" || "$vcversion" == "vc143" || "$vcversion" == "vclang" } { "$vcversion" == "vc142" || "$vcversion" == "vclang" } {
append var \ append var \
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \ "Microsoft Visual Studio Solution File, Format Version 12.00\n" \
"# Visual Studio 14\n" "# Visual Studio 14\n"
@@ -1292,9 +1290,6 @@ proc osutils:vcproj:readtemplate {theVcVer isUWP isExec} {
} elseif { $theVcVer == "vc142" } { } elseif { $theVcVer == "vc142" } {
set aVCRTVer "vc14" set aVCRTVer "vc14"
set aToolset "v142" set aToolset "v142"
} elseif { $theVcVer == "vc143" } {
set aVCRTVer "vc14"
set aToolset "v143"
} elseif { $theVcVer == "vclang" } { } elseif { $theVcVer == "vclang" } {
set aVCRTVer "vc14" set aVCRTVer "vc14"
set aToolset "ClangCL" set aToolset "ClangCL"
@@ -1452,9 +1447,6 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
if { "$::HAVE_LIBLZMA" == "true" } { if { "$::HAVE_LIBLZMA" == "true" } {
set aLibsMap(CSF_LIBLZMA) "liblzma" set aLibsMap(CSF_LIBLZMA) "liblzma"
} }
if { "$::HAVE_DRACO" == "true" } {
set aLibsMap(CSF_Draco) "draco"
}
if { "$::HAVE_OPENVR" == "true" } { if { "$::HAVE_OPENVR" == "true" } {
set aLibsMap(CSF_OpenVR) "openvr_api" set aLibsMap(CSF_OpenVR) "openvr_api"
} }
@@ -1499,11 +1491,7 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
} }
} else { } else {
set aLibsMap(CSF_dl) "dl" set aLibsMap(CSF_dl) "dl"
if { "$::HAVE_XLIB" == "true" } { set aLibsMap(CSF_OpenGlLibs) "GL"
set aLibsMap(CSF_OpenGlLibs) "GL"
} else {
set aLibsMap(CSF_OpenGlLibs) "GL EGL"
}
set aLibsMap(CSF_OpenGlesLibs) "EGL GLESv2" set aLibsMap(CSF_OpenGlesLibs) "EGL GLESv2"
if { "$theOS" == "mac" || "$theOS" == "ios" } { if { "$theOS" == "mac" || "$theOS" == "ios" } {
set aLibsMap(CSF_objc) "objc" set aLibsMap(CSF_objc) "objc"
@@ -1537,9 +1525,8 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
if { "$::HAVE_TK" == "true" } { if { "$::HAVE_TK" == "true" } {
set aLibsMap(CSF_TclTkLibs) "tk8.6" set aLibsMap(CSF_TclTkLibs) "tk8.6"
} }
if { "$::HAVE_XLIB" == "true" } { set aLibsMap(CSF_XwLibs) "X11 Xext Xmu Xi"
set aLibsMap(CSF_XwLibs) "X11" set aLibsMap(CSF_MotifLibs) "X11"
}
} }
} }
} }
@@ -2544,7 +2531,6 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
lappend aCmplFlags "-DOCC_CONVERT_SIGNALS" lappend aCmplFlags "-DOCC_CONVERT_SIGNALS"
} }
lappend aCmplFlags "-Wall" lappend aCmplFlags "-Wall"
lappend aCmplFlags "-Wextra"
lappend aCmplFlags "-fexceptions" lappend aCmplFlags "-fexceptions"
} }
lappend aCmplFlagsRelease "-DNDEBUG" lappend aCmplFlagsRelease "-DNDEBUG"

View File

@@ -13,8 +13,8 @@ OccGitRoot = $$_PRO_FILE_PWD_/../../../..
# Define compilation flags # Define compilation flags
CONFIG += warn_on CONFIG += warn_on
QMAKE_CFLAGS_WARN_ON = -Wall -Wextra QMAKE_CFLAGS_WARN_ON = -Wall
QMAKE_CXXFLAGS_WARN_ON = -Wall -Wextra QMAKE_CXXFLAGS_WARN_ON = -Wall
win32 { win32 {
QMAKE_CFLAGS_WARN_ON = -W4 QMAKE_CFLAGS_WARN_ON = -W4
QMAKE_CXXFLAGS_WARN_ON = -W4 QMAKE_CXXFLAGS_WARN_ON = -W4
@@ -39,10 +39,6 @@ win32 {
DEFINES += _SCL_SECURE_NO_WARNINGS DEFINES += _SCL_SECURE_NO_WARNINGS
} else { } else {
CONFIG += c++11 CONFIG += c++11
clang {
QMAKE_CFLAGS_WARN_ON += -Wshorten-64-to-32
QMAKE_CXXFLAGS_WARN_ON += -Wshorten-64-to-32
}
QMAKE_CFLAGS += -fexceptions QMAKE_CFLAGS += -fexceptions
QMAKE_CXXFLAGS += -fexceptions QMAKE_CXXFLAGS += -fexceptions
QMAKE_CXXFLAGS += -fvisibility=default QMAKE_CXXFLAGS += -fvisibility=default
@@ -53,9 +49,6 @@ win32 {
} else { } else {
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14
} }
} else:gcc {
# ask linker to report missing library dependencies
QMAKE_LFLAGS += -Wl,-z,defs
} }
} }
!CONFIG(debug, debug|release) { !CONFIG(debug, debug|release) {

View File

@@ -26,7 +26,6 @@ HAVE_FFMPEG { CSF_FFmpeg = -lavcodec -lavformat -lswscale -lavutil }
HAVE_TBB { CSF_TBB = -ltbb -ltbbmalloc } HAVE_TBB { CSF_TBB = -ltbb -ltbbmalloc }
HAVE_ZLIB { CSF_ZLIB = -lzlib } HAVE_ZLIB { CSF_ZLIB = -lzlib }
HAVE_LIBLZMA { CSF_LIBLZMA = -lliblzma } HAVE_LIBLZMA { CSF_LIBLZMA = -lliblzma }
HAVE_DRACO { CSF_Draco = -ldraco }
win32 { win32 {
CSF_kernel32 = -lkernel32 CSF_kernel32 = -lkernel32
CSF_advapi32 = -ladvapi32 CSF_advapi32 = -ladvapi32
@@ -60,14 +59,11 @@ win32 {
} else { } else {
CSF_dl = -ldl CSF_dl = -ldl
CSF_ThreadLibs = -lpthread -lrt CSF_ThreadLibs = -lpthread -lrt
CSF_OpenGlLibs = -lGL
CSF_OpenGlesLibs = -lEGL -lGLESv2 CSF_OpenGlesLibs = -lEGL -lGLESv2
CSF_TclTkLibs = -ltk8.6 CSF_TclTkLibs = -lX11 -ltk8.6
HAVE_XLIB { CSF_XwLibs = -lX11 -lXext -lXmu -lXi
CSF_OpenGlLibs = -lGL CSF_MotifLibs = -lX11
CSF_XwLibs = -lX11
} else {
CSF_OpenGlLibs = -lGL -lEGL
}
HAVE_FREETYPE { CSF_fontconfig = -lfontconfig } HAVE_FREETYPE { CSF_fontconfig = -lfontconfig }
} }
@@ -132,31 +128,21 @@ for (aPackage, aPackages) {
} }
} }
# extend clean with versioned .so files
!win32 { !win32 {
aVerList = $$split(VERSION, ".") aVerList = $$split(VERSION, ".")
aVerMaj = $$member(aVerList, 0) aVerMaj = $$member(aVerList, 0)
aVerMin = $$member(aVerList, 1) aVerMin = $$member(aVerList, 1)
aVerMic = $$member(aVerList, 2) aVerMic = $$member(aVerList, 2)
equals(TEMPLATE, app) { equals(TEMPLATE, app) {
QMAKE_CLEAN += $$DESTDIR/$${TARGET} QMAKE_CLEAN += $$DESTDIR/$${TARGET}
} else { } else {
mac { mac {
# override qmake soname versionong logic
QMAKE_LFLAGS_SONAME =
QMAKE_LFLAGS += -Wl,-soname=lib$${TARGET}.dylib.$${aVerMaj}.$${aVerMin}
# extend clean with versioned .dylib files
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.dylib QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.dylib
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.dylib QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.dylib
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.dylib QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.dylib
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.$${aVerMic}.dylib QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.$${aVerMic}.dylib
} else { } else {
# override qmake soname versionong logic
QMAKE_LFLAGS_SONAME =
QMAKE_LFLAGS += -Wl,-soname=lib$${TARGET}.so.$${aVerMaj}.$${aVerMin}
# extend clean with versioned .so files
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj} QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}.$${aVerMin} QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}.$${aVerMin}

View File

@@ -9,10 +9,6 @@
# - Open project in Qt Creator, and call "Run qmake". # - Open project in Qt Creator, and call "Run qmake".
# - Close the project in Qt Creator, open it again so that you should see the sub-modules in Project tree; call "Run qmake" again. # - Close the project in Qt Creator, open it again so that you should see the sub-modules in Project tree; call "Run qmake" again.
# - "Run qmake" and perform Build. # - "Run qmake" and perform Build.
#
# Within Debian-based Linux repository Qt Creator can be installed like this:
# > sudo apt-get install qtcreator qtbase5-dev
TEMPLATE = subdirs TEMPLATE = subdirs
exists(custom.auto.pri) { include(custom.auto.pri) } exists(custom.auto.pri) { include(custom.auto.pri) }
exists(custom.pri) { include(custom.pri) } exists(custom.pri) { include(custom.pri) }

View File

@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorCodeStyle>
<!-- Written by QtCreator 3.6.1, 2016-05-19T14:46:43. -->
<qtcreator>
<data>
<variable>CodeStyleData</variable>
<valuemap type="QVariantMap">
<value type="bool" key="AlignAssignments">true</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="bool" key="BindStarToIdentifier">false</value>
<value type="bool" key="BindStarToLeftSpecifier">true</value>
<value type="bool" key="BindStarToRightSpecifier">false</value>
<value type="bool" key="BindStarToTypeName">true</value>
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">true</value>
<value type="bool" key="IndentAccessSpecifiers">false</value>
<value type="bool" key="IndentBlockBody">true</value>
<value type="bool" key="IndentBlockBraces">false</value>
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentClassBraces">false</value>
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
<value type="bool" key="IndentEnumBraces">false</value>
<value type="bool" key="IndentFunctionBody">true</value>
<value type="bool" key="IndentFunctionBraces">false</value>
<value type="bool" key="IndentNamespaceBody">true</value>
<value type="bool" key="IndentNamespaceBraces">false</value>
<value type="int" key="IndentSize">2</value>
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentSwitchLabels">true</value>
<value type="int" key="PaddingMode">2</value>
<value type="bool" key="SpacesForTabs">true</value>
<value type="int" key="TabSize">2</value>
</valuemap>
</data>
<data>
<variable>DisplayName</variable>
<value type="QString">occt</value>
</data>
</qtcreator>

View File

@@ -13,7 +13,6 @@ rem Paths to 3rd-party tools and libraries
set "anNdkPath=" set "anNdkPath="
set "aFreeType=" set "aFreeType="
set "aRapidJson=" set "aRapidJson="
set "aDraco="
rem Build stages to perform rem Build stages to perform
set "toCMake=1" set "toCMake=1"
@@ -35,9 +34,7 @@ set "BUILD_ApplicationFramework=ON"
set "BUILD_DataExchange=ON" set "BUILD_DataExchange=ON"
rem Optional 3rd-party libraries to enable rem Optional 3rd-party libraries to enable
set "USE_FREETYPE=ON"
set "USE_RAPIDJSON=OFF" set "USE_RAPIDJSON=OFF"
set "USE_DRACO=OFF"
rem Archive tool rem Archive tool
set "THE_7Z_PARAMS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on" set "THE_7Z_PARAMS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on"
@@ -141,9 +138,6 @@ echo Start building OCCT for %aPlatformAndCompiler%, API level %anApi%>> %aLogFi
pushd "%aWorkDir%" pushd "%aWorkDir%"
set "aFreeTypeLibName=libfreetype.so"
if exist "%aFreeType%/libs/%anAbi%/libfreetype.a" ( set "aFreeTypeLibName=libfreetype.a" )
set "aTimeZERO=%TIME%" set "aTimeZERO=%TIME%"
if ["%toCMake%"] == ["1"] ( if ["%toCMake%"] == ["1"] (
echo Configuring OCCT for Android %anAbi%, API level %anApi%... echo Configuring OCCT for Android %anAbi%, API level %anApi%...
@@ -168,19 +162,14 @@ if ["%toCMake%"] == ["1"] (
-D BUILD_MODULE_DataExchange:BOOL="%BUILD_DataExchange%" ^ -D BUILD_MODULE_DataExchange:BOOL="%BUILD_DataExchange%" ^
-D BUILD_MODULE_Draw:BOOL="OFF" ^ -D BUILD_MODULE_Draw:BOOL="OFF" ^
-D BUILD_DOC_Overview:BOOL="OFF" ^ -D BUILD_DOC_Overview:BOOL="OFF" ^
-D USE_FREETYPE:BOOL="%USE_FREETYPE%" ^
-D 3RDPARTY_FREETYPE_DIR:PATH="%aFreeType%" ^ -D 3RDPARTY_FREETYPE_DIR:PATH="%aFreeType%" ^
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="%aFreeType%/include" ^ -D 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="%aFreeType%/include" ^
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build: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_DIR:PATH="%aFreeType%/libs/%anAbi%" ^
-D 3RDPARTY_FREETYPE_LIBRARY:FILEPATH="%aFreeType%/libs/%anAbi%/%aFreeTypeLibName%" ^ -D 3RDPARTY_FREETYPE_LIBRARY:FILEPATH="%aFreeType%/libs/%anAbi%/libfreetype.so" ^
-D USE_RAPIDJSON:BOOL="%USE_RAPIDJSON%" ^ -D USE_RAPIDJSON:BOOL="%USE_RAPIDJSON%" ^
-D 3RDPARTY_RAPIDJSON_DIR:PATH="%aRapidJson%" ^ -D 3RDPARTY_RAPIDJSON_DIR:PATH="%aRapidJson%" ^
-D 3RDPARTY_RAPIDJSON_INCLUDE_DIR:PATH="%aRapidJson%/include" ^ -D 3RDPARTY_RAPIDJSON_INCLUDE_DIR:PATH="%aRapidJson%/include" ^
-D USE_DRACO:BOOL="%USE_DRACO%" ^
-D 3RDPARTY_DRACO_DIR:PATH="%aDraco%" ^
-D 3RDPARTY_DRACO_INCLUDE_DIR:FILEPATH="%aDraco%/include" ^
-D 3RDPARTY_DRACO_LIBRARY_DIR_draco:PATH="%aDraco%/libs/%anAbi%" ^
"%aCasSrc%" "%aCasSrc%"
if errorlevel 1 ( if errorlevel 1 (

View File

@@ -6,7 +6,6 @@ rem set "PATH=c:\CMake\bin;%PATH%"
rem set "anNdkPath=c:/android-ndk-r12" rem set "anNdkPath=c:/android-ndk-r12"
rem set "aFreeType=c:/freetype-2.7.1-android" rem set "aFreeType=c:/freetype-2.7.1-android"
rem set "aRapidJson=c:/rapidjson-1.1.0" rem set "aRapidJson=c:/rapidjson-1.1.0"
rem set "aDraco=c:/draco-1.4.1-android"
rem Uncomment to customize building steps rem Uncomment to customize building steps
rem set "aBuildRoot=%~dp0..\..\work" rem set "aBuildRoot=%~dp0..\..\work"
@@ -29,5 +28,4 @@ rem set "BUILD_ApplicationFramework=ON"
rem set "BUILD_DataExchange=ON" rem set "BUILD_DataExchange=ON"
rem Optional 3rd-party libraries to enable rem Optional 3rd-party libraries to enable
rem set "USE_RAPIDJSON=ON" rem set USE_RAPIDJSON=ON
rem set "USE_DRACO=ON"

View File

@@ -22,7 +22,6 @@ rem set BUILD_RELEASE_DISABLE_EXCEPTIONS=ON
rem set BUILD_WITH_DEBUG=OFF rem set BUILD_WITH_DEBUG=OFF
rem set BUILD_ENABLE_FPE_SIGNAL_HANDLER=ON rem set BUILD_ENABLE_FPE_SIGNAL_HANDLER=ON
rem set BUILD_USE_PCH=OFF rem set BUILD_USE_PCH=OFF
rem set BUILD_FORCE_RelWithDebInfo=OFF
rem Use semicolon-separated list of toolkits if you want to disable all modules rem Use semicolon-separated list of toolkits if you want to disable all modules
rem and build only some toolkits. rem and build only some toolkits.
@@ -43,6 +42,5 @@ rem set USE_FFMPEG=OFF
rem set USE_FREEIMAGE=OFF rem set USE_FREEIMAGE=OFF
rem set USE_GLES2=OFF rem set USE_GLES2=OFF
rem set USE_RAPIDJSON=OFF rem set USE_RAPIDJSON=OFF
rem set USE_DRACO=OFF
rem set USE_TBB=OFF rem set USE_TBB=OFF
rem set USE_VTK=OFF rem set USE_VTK=OFF

View File

@@ -35,7 +35,6 @@ FREETYPE_DIR="$OCCT3RDPARTY/freetype-2.7.1"
#USE_FREEIMAGE=OFF #USE_FREEIMAGE=OFF
#USE_GLES2=OFF #USE_GLES2=OFF
#USE_RAPIDJSON=OFF #USE_RAPIDJSON=OFF
#USE_DRACO=OFF
#USE_TBB=OFF #USE_TBB=OFF
#USE_VTK=OFF #USE_VTK=OFF

View File

@@ -12,7 +12,6 @@ set VS=14
set VSDATA=2015 set VSDATA=2015
set VSPLATFORM=Win64 set VSPLATFORM=Win64
set "BUILD_DIR=build-vs%VS%-%VSPLATFORM%" set "BUILD_DIR=build-vs%VS%-%VSPLATFORM%"
set "OCCT3RDPARTY="
set "INSTALL_DIR=%SrcRoot%\install" set "INSTALL_DIR=%SrcRoot%\install"
set BUILD_ADDITIONAL_TOOLKITS= set BUILD_ADDITIONAL_TOOLKITS=
@@ -24,7 +23,6 @@ set BUILD_RELEASE_DISABLE_EXCEPTIONS=ON
set BUILD_WITH_DEBUG=OFF set BUILD_WITH_DEBUG=OFF
set BUILD_ENABLE_FPE_SIGNAL_HANDLER=ON set BUILD_ENABLE_FPE_SIGNAL_HANDLER=ON
set BUILD_USE_PCH=OFF set BUILD_USE_PCH=OFF
set BUILD_FORCE_RelWithDebInfo=OFF
set BUILD_MODULE_ApplicationFramework=ON set BUILD_MODULE_ApplicationFramework=ON
set BUILD_MODULE_DataExchange=ON set BUILD_MODULE_DataExchange=ON
@@ -38,7 +36,6 @@ set USE_FFMPEG=OFF
set USE_FREEIMAGE=OFF set USE_FREEIMAGE=OFF
set USE_GLES2=OFF set USE_GLES2=OFF
set USE_RAPIDJSON=OFF set USE_RAPIDJSON=OFF
set USE_DRACO=OFF
set USE_TBB=OFF set USE_TBB=OFF
set USE_VTK=OFF set USE_VTK=OFF
@@ -72,14 +69,12 @@ cmake -G "%arch_compile%" ^
-D BUILD_WITH_DEBUG:BOOL=%BUILD_WITH_DEBUG% ^ -D BUILD_WITH_DEBUG:BOOL=%BUILD_WITH_DEBUG% ^
-D BUILD_ENABLE_FPE_SIGNAL_HANDLER:BOOL=%BUILD_ENABLE_FPE_SIGNAL_HANDLER% ^ -D BUILD_ENABLE_FPE_SIGNAL_HANDLER:BOOL=%BUILD_ENABLE_FPE_SIGNAL_HANDLER% ^
-D BUILD_USE_PCH:BOOL=%BUILD_USE_PCH% ^ -D BUILD_USE_PCH:BOOL=%BUILD_USE_PCH% ^
-D BUILD_FORCE_RelWithDebInfo:BOOL=%BUILD_FORCE_RelWithDebInfo% ^
-D INSTALL_DIR:PATH="%INSTALL_DIR%" ^ -D INSTALL_DIR:PATH="%INSTALL_DIR%" ^
-D USE_D3D:BOOL=%USE_D3D% ^ -D USE_D3D:BOOL=%USE_D3D% ^
-D USE_FFMPEG:BOOL=%USE_FFMPEG% ^ -D USE_FFMPEG:BOOL=%USE_FFMPEG% ^
-D USE_FREEIMAGE:BOOL=%USE_FREEIMAGE% ^ -D USE_FREEIMAGE:BOOL=%USE_FREEIMAGE% ^
-D USE_GLES2:BOOL=%USE_GLES2% ^ -D USE_GLES2:BOOL=%USE_GLES2% ^
-D USE_RAPIDJSON:BOOL=%USE_RAPIDJSON% ^ -D USE_RAPIDJSON:BOOL=%USE_RAPIDJSON% ^
-D USE_DRACO:BOOL=%USE_DRACO% ^
-D USE_TBB:BOOL=%USE_TBB% ^ -D USE_TBB:BOOL=%USE_TBB% ^
-D USE_VTK:BOOL=%USE_VTK% ^ -D USE_VTK:BOOL=%USE_VTK% ^
"%SrcRoot%" "%SrcRoot%"

View File

@@ -40,7 +40,6 @@ USE_FFMPEG=OFF
USE_FREEIMAGE=OFF USE_FREEIMAGE=OFF
USE_GLES2=OFF USE_GLES2=OFF
USE_RAPIDJSON=OFF USE_RAPIDJSON=OFF
USE_DRACO=OFF
USE_TBB=OFF USE_TBB=OFF
USE_VTK=OFF USE_VTK=OFF
AUX_ARGS= AUX_ARGS=
@@ -80,7 +79,6 @@ cmake -G "Unix Makefiles" \
-D USE_FREEIMAGE:BOOL=$USE_FREEIMAGE \ -D USE_FREEIMAGE:BOOL=$USE_FREEIMAGE \
-D USE_GLES2:BOOL=$USE_GLES2 \ -D USE_GLES2:BOOL=$USE_GLES2 \
-D USE_RAPIDJSON:BOOL=$USE_RAPIDJSON \ -D USE_RAPIDJSON:BOOL=$USE_RAPIDJSON \
-D USE_DRACO:BOOL=$USE_DRACO \
-D USE_TBB:BOOL=$USE_TBB \ -D USE_TBB:BOOL=$USE_TBB \
-D USE_VTK:BOOL=$USE_VTK \ -D USE_VTK:BOOL=$USE_VTK \
$AUX_ARGS "$SrcRoot" $AUX_ARGS "$SrcRoot"

View File

@@ -17,16 +17,15 @@ export aBuildRoot=work
export aFreeType= export aFreeType=
export aFreeImage= export aFreeImage=
export aRapidJson= export aRapidJson=
export aDraco=
# build stages to perform # build stages to perform
export toSimulator=0
export isStatic=1 export isStatic=1
export toCMake=1 export toCMake=1
export toClean=1 export toClean=1
export toMake=1 export toMake=1
export toInstall=1 export toInstall=1
export toPack=0 export toPack=0
export toPackFat=0
export toDebug=0 export toDebug=0
export BUILD_ModelingData=ON export BUILD_ModelingData=ON
@@ -35,31 +34,17 @@ export BUILD_Visualization=ON
export BUILD_ApplicationFramework=ON export BUILD_ApplicationFramework=ON
export BUILD_DataExchange=ON export BUILD_DataExchange=ON
export USE_FREETYPE=ON
export USE_FREEIMAGE=OFF export USE_FREEIMAGE=OFF
export USE_RAPIDJSON=OFF export USE_RAPIDJSON=OFF
export USE_DRACO=OFF
export IPHONEOS_DEPLOYMENT_TARGET=8.0 export IPHONEOS_DEPLOYMENT_TARGET=8.0
#export anAbiList="iPhoneOS|arm64 iPhoneSimulator|arm64 iPhoneSimulator|x86_64" export anAbi=arm64
export anAbiList="iPhoneOS|arm64" #export anAbi=x86_64
if [[ -f "${aScriptDir}/ios_custom.sh" ]]; then if [[ -f "${aScriptDir}/ios_custom.sh" ]]; then
source "${aScriptDir}/ios_custom.sh" source "${aScriptDir}/ios_custom.sh"
fi fi
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
aGitBranch=`git symbolic-ref --short HEAD`
YEAR=$(date +"%Y")
MONTH=$(date +"%m")
DAY=$(date +"%d")
aRevision=-${YEAR}-${MONTH}-${DAY}
#aRevision=-${aGitBranch}
set -o pipefail
aBuildType="Release" aBuildType="Release"
aBuildTypePrefix= aBuildTypePrefix=
if [[ $toDebug == 1 ]]; then if [[ $toDebug == 1 ]]; then
@@ -70,52 +55,59 @@ aLibType="Shared"
if [[ $isStatic == 1 ]]; then if [[ $isStatic == 1 ]]; then
aLibType="Static" aLibType="Static"
fi fi
aPlatformAndCompiler=ios-${anAbi}${aBuildTypePrefix}-clang
aPlatformSdk="iphoneos"
aSysRoot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
if [[ $toSimulator == 1 ]]; then
#anAbi=x86_64
aPlatformAndCompiler=ios-simulator64-${anAbi}${aBuildTypePrefix}-clang
aPlatformSdk="iphonesimulator"
aSysRoot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
fi
function buildArch { aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make"
anAbi=$1 aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}"
aPlatformSdk=$2 aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
aPlatformAndCompiler=${aPlatformSdk}-${anAbi}${aBuildTypePrefix}-clang if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then
rm -r -f "$aWorkDir"
rm -r -f "$aDestDir"
fi
mkdir -p "$aWorkDir"
mkdir -p "$aDestDir"
rm -f "$aLogFile"
aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make" anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}" anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log" aGitBranch=`git symbolic-ref --short HEAD`
if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then # include some information about OCCT into archive
rm -r -f "$aWorkDir" echo \<pre\>> "${aWorkDir}/VERSION.html"
rm -r -f "$aDestDir" git status >> "${aWorkDir}/VERSION.html"
git log -n 100 >> "${aWorkDir}/VERSION.html"
echo \</pre\>>> "${aWorkDir}/VERSION.html"
pushd "$aWorkDir"
aTimeZERO=$SECONDS
set -o pipefail
function logDuration {
if [[ $1 == 1 ]]; then
aDur=$(($4 - $3))
echo $2 time: $aDur sec>> "$aLogFile"
fi fi
mkdir -p "$aWorkDir" }
mkdir -p "$aDestDir"
rm -f "$aLogFile"
# include some information about OCCT into archive # (re)generate Make files
echo \<pre\>> "${aWorkDir}/VERSION.html" if [[ $toCMake == 1 ]]; then
git status >> "${aWorkDir}/VERSION.html" echo Configuring OCCT for iOS...
git log -n 100 >> "${aWorkDir}/VERSION.html" cmake -G "Unix Makefiles" \
echo \</pre\>>> "${aWorkDir}/VERSION.html"
pushd "$aWorkDir"
aTimeZERO=$SECONDS
function logDuration {
if [[ $1 == 1 ]]; then
aDur=$(($4 - $3))
echo $2 time: $aDur sec>> "$aLogFile"
fi
}
aSysRoot="/Applications/Xcode.app/Contents/Developer/Platforms/${aPlatformSdk}.platform/Developer/SDKs/${aPlatformSdk}.sdk"
# (re)generate Make files
if [[ $toCMake == 1 ]]; then
echo Configuring OCCT for iOS...
cmake -G "Unix Makefiles" \
-D CMAKE_SYSTEM_NAME="iOS" \ -D CMAKE_SYSTEM_NAME="iOS" \
-D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \ -D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
-D CMAKE_OSX_DEPLOYMENT_TARGET:STRING="$IPHONEOS_DEPLOYMENT_TARGET" \ -D CMAKE_OSX_DEPLOYMENT_TARGET:STRING="$IPHONEOS_DEPLOYMENT_TARGET" \
-D CMAKE_OSX_SYSROOT:PATH="$aSysRoot" \ -D CMAKE_OSX_SYSROOT:PATH="$aSysRoot" \
-D ENABLE_VISIBILITY:BOOL="TRUE" \
-D CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL="OFF" \ -D CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL="OFF" \
-D CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL="OFF" \ -D CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL="OFF" \
-D CMAKE_BUILD_TYPE:STRING="$aBuildType" \ -D CMAKE_BUILD_TYPE:STRING="$aBuildType" \
@@ -125,18 +117,13 @@ function buildArch {
-D INSTALL_DIR_LIB:STRING="lib" \ -D INSTALL_DIR_LIB:STRING="lib" \
-D INSTALL_DIR_RESOURCE:STRING="src" \ -D INSTALL_DIR_RESOURCE:STRING="src" \
-D INSTALL_NAME_DIR:STRING="@executable_path/../Frameworks" \ -D INSTALL_NAME_DIR:STRING="@executable_path/../Frameworks" \
-D USE_FREETYPE:BOOL="$USE_FREETYPE" \
-D 3RDPARTY_FREETYPE_DIR:PATH="$aFreeType" \ -D 3RDPARTY_FREETYPE_DIR:PATH="$aFreeType" \
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \ -D 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \ -D 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \
-D 3RDPARTY_FREETYPE_LIBRARY_DIR:PATH="$aFreeType/lib" \ -D 3RDPARTY_FREETYPE_LIBRARY_DIR:PATH="$aFreeType/lib" \
-D USE_RAPIDJSON:BOOL="$USE_RAPIDJSON" \ -D USE_RAPIDJSON:BOOL="ON" \
-D 3RDPARTY_RAPIDJSON_DIR:PATH="$aRapidJson" \ -D 3RDPARTY_RAPIDJSON_DIR:PATH="$aRapidJson" \
-D 3RDPARTY_RAPIDJSON_INCLUDE_DIR:PATH="$aRapidJson/include" \ -D 3RDPARTY_RAPIDJSON_INCLUDE_DIR:PATH="$aRapidJson/include" \
-D USE_DRACO:BOOL="$USE_DRACO" \
-D 3RDPARTY_DRACO_DIR:PATH="$aDraco" \
-D 3RDPARTY_DRACO_INCLUDE_DIR:FILEPATH="$aDraco/include" \
-D 3RDPARTY_DRACO_LIBRARY_DIR:PATH="$aDraco/lib" \
-D USE_FREEIMAGE:BOOL="$USE_FREEIMAGE" \ -D USE_FREEIMAGE:BOOL="$USE_FREEIMAGE" \
-D 3RDPARTY_FREEIMAGE_DIR:PATH="$aFreeImage" \ -D 3RDPARTY_FREEIMAGE_DIR:PATH="$aFreeImage" \
-D 3RDPARTY_FREEIMAGE_INCLUDE_DIR:FILEPATH="$aFreeImage/include" \ -D 3RDPARTY_FREEIMAGE_INCLUDE_DIR:FILEPATH="$aFreeImage/include" \
@@ -150,118 +137,57 @@ function buildArch {
-D BUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \ -D BUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \
-D BUILD_MODULE_Draw:BOOL="OFF" \ -D BUILD_MODULE_Draw:BOOL="OFF" \
-D BUILD_DOC_Overview:BOOL="OFF" \ -D BUILD_DOC_Overview:BOOL="OFF" \
"$aCasSrc" 2>&1 | tee -a "$aLogFile" "$aCasSrc" 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeGEN=$SECONDS
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
# clean up from previous build
if [[ $toClean == 1 ]]; then
make clean
fi
# build the project
if [[ $toMake == 1 ]]; then
echo Building...
make -j $aNbJobs 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeBUILD=$SECONDS
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
# install the project
if [[ $toInstall == 1 ]]; then
echo Installing OCCT into $aDestDir...
make install 2>&1 | tee -a "$aLogFile"
cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html"
echo Platform: ${aPlatformSdk} ABI: ${anAbi} Build: ${aBuildType} IPHONEOS_DEPLOYMENT_TARGET: ${IPHONEOS_DEPLOYMENT_TARGET} > "$aDestDir/build_target.txt"
fi
aTimeINSTALL=$SECONDS
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
# create an archive
if [[ $toPack == 1 ]]; then
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
rm ${aDestDir}/../${anArchName} &>/dev/null
pushd "$aDestDir"
tar -jcf ${aDestDir}/../${anArchName} *
popd
fi
aTimePACK=$SECONDS
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
# finished
DURATION=$(($aTimePACK - $aTimeZERO))
echo Total time: $DURATION sec
logDuration 1 "Total" $aTimeZERO $aTimePACK
popd
}
for anArchIter in $anAbiList
do
IFS="|" read -r aPlatform anArch <<< "$anArchIter"
echo Platform: ${aPlatform} ABI: ${anArch} Build: ${aBuildType}
buildArch $anArch $aPlatform
done
# create a FAT archive
if [[ $toPackFat == 1 ]]; then
for aPlatIter in iPhoneOS iPhoneSimulator
do
aSuffixFat=${aPlatIter}${aBuildTypePrefix}-clang
aFatDir="${aCasSrc}/${aBuildRoot}/${aSuffixFat}"
# merge per-arch builds into fat builds
hasPlatform=0
for anArchIter in $anAbiList
do
IFS="|" read -r aPlatform anArch <<< "$anArchIter"
if [[ $aPlatIter != ${aPlatform} ]]; then
continue
fi
aSuffixThin=${aPlatform}-${anArch}${aBuildTypePrefix}-clang
anArchDir="${aCasSrc}/${aBuildRoot}/${aSuffixThin}"
if [[ $hasPlatform == 0 ]]; then
hasPlatform=1
echo Packing FAT archive for platform: ${aPlatform}
rm -r -f "$aFatDir"
mkdir -p "$aFatDir"
rsync -r --exclude '*.a' "$anArchDir/" "$aFatDir"
rm -f "$aFatDir/build_target.txt"
for aLibIter in $anArchDir/lib/*.a; do
aLibName=`basename $aLibIter`
lipo "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
done
else
for aLibIter in $aFatDir/lib/*.a; do
aLibName=`basename $aLibIter`
lipo "$aFatDir/lib/$aLibName" "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
#lipo -info "$aFatDir/lib/$aLibName"
done
fi
cat "$anArchDir/build_target.txt" >> "$aFatDir/build_target.txt"
done
# create an archive
for anArchIter in $anAbiList
do
IFS="|" read -r aPlatform anArch <<< "$anArchIter"
if [[ $aPlatIter != ${aPlatform} ]]; then
continue
fi
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aSuffixFat}.tar.bz2
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
rm ${aFatDir}/../${anArchName} &>/dev/null
pushd "$aFatDir"
tar -jcf ${aFatDir}/../${anArchName} *
popd
break
done
done
fi fi
aTimeGEN=$SECONDS
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
# clean up from previous build
if [[ $toClean == 1 ]]; then
make clean
fi
# build the project
if [[ $toMake == 1 ]]; then
echo Building...
make -j $aNbJobs 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeBUILD=$SECONDS
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
# install the project
if [[ $toInstall == 1 ]]; then
echo Installing OCCT into $aDestDir...
make install 2>&1 | tee -a "$aLogFile"
cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html"
fi
aTimeINSTALL=$SECONDS
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
# create an archive
if [[ $toPack == 1 ]]; then
YEAR=$(date +"%Y")
MONTH=$(date +"%m")
DAY=$(date +"%d")
aRevision=-${YEAR}-${MONTH}-${DAY}
#aRevision=-${aGitBranch}
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
rm ${aDestDir}/../${anArchName} &>/dev/null
pushd "$aDestDir"
tar -jcf ${aDestDir}/../${anArchName} *
popd
fi
aTimePACK=$SECONDS
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
# finished
DURATION=$(($aTimePACK - $aTimeZERO))
echo Total time: $DURATION sec
logDuration 1 "Total" $aTimeZERO $aTimePACK
popd

View File

@@ -1,18 +1,17 @@
# environment configuration template for ios_build.sh (to be renamed as ios_custom_env.sh) # environment configuration template for macos_build.sh (to be renamed as macos_custom_env.sh)
export PATH=/Applications/CMake.app/Contents/bin:$PATH export PATH=/Applications/CMake.app/Contents/bin:$PATH
export aFreeType="$aSrcRoot/../3rdparty/freetype-2.10.4-ios" export aFreeType="$aSrcRoot/../3rdparty/freetype-2.10.4-ios"
export aFreeImage="$aSrcRoot/../3rdparty/freeimage-3.18-ios" export aFreeImage="$aSrcRoot/../3rdparty/freeimage-3.18-ios"
export aRapidJson="$aSrcRoot/../3rdparty/rapidjson-1.1.0" export aRapidJson="$aSrcRoot/../3rdparty/rapidjson-1.1.0"
export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-ios"
# Uncomment to customize building steps # Uncomment to customize building steps
#export toSimulator=0
#export isStatic=0 #export isStatic=0
#export toCMake=1 #export toCMake=1
#export toClean=1 #export toClean=1
#export toMake=1 #export toMake=1
#export toInstall=1 #export toInstall=1
#export toPack=0 #export toPack=0
#export toPackFat=1
#export toDebug=0 #export toDebug=0
#export BUILD_ModelingData=ON #export BUILD_ModelingData=ON
@@ -22,9 +21,8 @@ export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-ios"
#export BUILD_DataExchange=ON #export BUILD_DataExchange=ON
#export USE_RAPIDJSON=ON #export USE_RAPIDJSON=ON
#export USE_DRACO=ON
#export USE_FREEIMAGE=ON #export USE_FREEIMAGE=ON
#export IPHONEOS_DEPLOYMENT_TARGET=8.0 #export IPHONEOS_DEPLOYMENT_TARGET=8.0
#export anAbiList="iPhoneOS|arm64 iPhoneSimulator|arm64 iPhoneSimulator|x86_64" #export anAbi=arm64
#export anAbiList="iPhoneOS|arm64" #export anAbi=x86_64

View File

@@ -17,16 +17,13 @@ export aBuildRoot=work
export aFreeType= export aFreeType=
export aFreeImage= export aFreeImage=
export aRapidJson= export aRapidJson=
export aDraco=
# build stages to perform # build stages to perform
export isStatic=0
export toCMake=1 export toCMake=1
export toClean=1 export toClean=1
export toMake=1 export toMake=1
export toInstall=1 export toInstall=1
export toPack=0 export toPack=0
export toPackFat=0
export toDebug=0 export toDebug=0
export BUILD_ModelingData=ON export BUILD_ModelingData=ON
@@ -36,92 +33,71 @@ export BUILD_ApplicationFramework=ON
export BUILD_DataExchange=ON export BUILD_DataExchange=ON
export BUILD_Draw=ON export BUILD_Draw=ON
export USE_FREETYPE=ON
export USE_FREEIMAGE=ON export USE_FREEIMAGE=ON
export USE_RAPIDJSON=OFF export USE_RAPIDJSON=OFF
export USE_DRACO=OFF
export MACOSX_DEPLOYMENT_TARGET=10.10 export MACOSX_DEPLOYMENT_TARGET=10.10
#export anAbiList="arm64 x86_64" #export anAbi=arm64
export anAbiList="x86_64" export anAbi=x86_64
aPlatform="macos"
if [[ -f "${aScriptDir}/macos_custom.sh" ]]; then if [[ -f "${aScriptDir}/macos_custom.sh" ]]; then
source "${aScriptDir}/macos_custom.sh" source "${aScriptDir}/macos_custom.sh"
fi fi
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
aGitBranch=`git symbolic-ref --short HEAD`
YEAR=$(date +"%Y")
MONTH=$(date +"%m")
DAY=$(date +"%d")
aRevision=-${YEAR}-${MONTH}-${DAY}
#aRevision=-${aGitBranch}
set -o pipefail
aBuildType="Release" aBuildType="Release"
aBuildTypePrefix= aBuildTypePrefix=
if [[ $toDebug == 1 ]]; then if [[ $toDebug == 1 ]]; then
aBuildType="Debug" aBuildType="Debug"
aBuildTypePrefix="-debug" aBuildTypePrefix="-debug"
fi fi
aLibType="Shared" aPlatformAndCompiler=mac-${anAbi}${aBuildTypePrefix}-clang
aLibExt="dylib"
if [[ $isStatic == 1 ]]; then aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make"
aLibType="Static" aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}"
aLibExt="a" aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then
rm -r -f "$aWorkDir"
rm -r -f "$aDestDir"
fi fi
mkdir -p "$aWorkDir"
mkdir -p "$aDestDir"
rm -f "$aLogFile"
function buildArch { anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
anAbi=$1 anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
aGitBranch=`git symbolic-ref --short HEAD`
aPlatformAndCompiler=${aPlatform}-${anAbi}${aBuildTypePrefix}-clang # 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"
aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make" pushd "$aWorkDir"
aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}"
aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then aTimeZERO=$SECONDS
rm -r -f "$aWorkDir" set -o pipefail
rm -r -f "$aDestDir"
function logDuration {
if [[ $1 == 1 ]]; then
aDur=$(($4 - $3))
echo $2 time: $aDur sec>> "$aLogFile"
fi fi
mkdir -p "$aWorkDir" }
mkdir -p "$aDestDir"
rm -f "$aLogFile"
# include some information about OCCT into archive # (re)generate Make files
echo \<pre\>> "${aWorkDir}/VERSION.html" if [[ $toCMake == 1 ]]; then
git status >> "${aWorkDir}/VERSION.html" echo Configuring OCCT for macOS...
git log -n 100 >> "${aWorkDir}/VERSION.html" cmake -G "Unix Makefiles" \
echo \</pre\>>> "${aWorkDir}/VERSION.html"
pushd "$aWorkDir"
aTimeZERO=$SECONDS
function logDuration {
if [[ $1 == 1 ]]; then
aDur=$(($4 - $3))
echo $2 time: $aDur sec>> "$aLogFile"
fi
}
# (re)generate Make files
if [[ $toCMake == 1 ]]; then
echo Configuring OCCT for macOS...
cmake -G "Unix Makefiles" \
-D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
-D CMAKE_BUILD_TYPE:STRING="$aBuildType" \ -D CMAKE_BUILD_TYPE:STRING="$aBuildType" \
-D BUILD_LIBRARY_TYPE:STRING="$aLibType" \ -D BUILD_LIBRARY_TYPE:STRING="Shared" \
-D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
-D INSTALL_DIR:PATH="$aDestDir" \ -D INSTALL_DIR:PATH="$aDestDir" \
-D INSTALL_DIR_INCLUDE:STRING="inc" \ -D INSTALL_DIR_INCLUDE:STRING="inc" \
-D INSTALL_DIR_LIB:STRING="lib" \ -D INSTALL_DIR_LIB:STRING="lib" \
-D INSTALL_DIR_RESOURCE:STRING="src" \ -D INSTALL_DIR_RESOURCE:STRING="src" \
-D INSTALL_NAME_DIR:STRING="@executable_path/../Frameworks" \ -D INSTALL_NAME_DIR:STRING="@executable_path/../Frameworks" \
-D USE_FREETYPE:BOOL="$USE_FREETYPE" \
-D 3RDPARTY_FREETYPE_DIR:PATH="$aFreeType" \ -D 3RDPARTY_FREETYPE_DIR:PATH="$aFreeType" \
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \ -D 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \ -D 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \
@@ -130,10 +106,6 @@ function buildArch {
-D USE_RAPIDJSON:BOOL="$USE_RAPIDJSON" \ -D USE_RAPIDJSON:BOOL="$USE_RAPIDJSON" \
-D 3RDPARTY_RAPIDJSON_DIR:PATH="$aRapidJson" \ -D 3RDPARTY_RAPIDJSON_DIR:PATH="$aRapidJson" \
-D 3RDPARTY_RAPIDJSON_INCLUDE_DIR:PATH="$aRapidJson/include" \ -D 3RDPARTY_RAPIDJSON_INCLUDE_DIR:PATH="$aRapidJson/include" \
-D USE_DRACO:BOOL="$USE_DRACO" \
-D 3RDPARTY_DRACO_DIR:PATH="$aDraco" \
-D 3RDPARTY_DRACO_INCLUDE_DIR:FILEPATH="$aDraco/include" \
-D 3RDPARTY_DRACO_LIBRARY_DIR:PATH="$aDraco/lib" \
-D USE_FREEIMAGE:BOOL="$USE_FREEIMAGE" \ -D USE_FREEIMAGE:BOOL="$USE_FREEIMAGE" \
-D 3RDPARTY_FREEIMAGE_DIR:PATH="$aFreeImage" \ -D 3RDPARTY_FREEIMAGE_DIR:PATH="$aFreeImage" \
-D 3RDPARTY_FREEIMAGE_INCLUDE_DIR:FILEPATH="$aFreeImage/include" \ -D 3RDPARTY_FREEIMAGE_INCLUDE_DIR:FILEPATH="$aFreeImage/include" \
@@ -147,122 +119,57 @@ function buildArch {
-D BUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \ -D BUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \
-D BUILD_MODULE_Draw:BOOL="${BUILD_Draw}" \ -D BUILD_MODULE_Draw:BOOL="${BUILD_Draw}" \
-D BUILD_DOC_Overview:BOOL="OFF" \ -D BUILD_DOC_Overview:BOOL="OFF" \
"$aCasSrc" 2>&1 | tee -a "$aLogFile" "$aCasSrc" 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi fi
aTimeGEN=$SECONDS aTimeGEN=$SECONDS
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
# clean up from previous build # clean up from previous build
if [[ $toClean == 1 ]]; then if [[ $toClean == 1 ]]; then
make clean make clean
fi fi
# build the project # build the project
if [[ $toMake == 1 ]]; then if [[ $toMake == 1 ]]; then
echo Building OCCT... echo Building OCCT...
make -j $aNbJobs 2>&1 | tee -a "$aLogFile" make -j $aNbJobs 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi fi
aTimeBUILD=$SECONDS aTimeBUILD=$SECONDS
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
# install the project # install the project
if [[ $toInstall == 1 ]]; then if [[ $toInstall == 1 ]]; then
echo Installing OCCT into $aDestDir... echo Installing OCCT into $aDestDir...
make install 2>&1 | tee -a "$aLogFile" make install 2>&1 | tee -a "$aLogFile"
cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html" cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html"
echo Platform: macOS ABI: ${anAbi} Build: ${aBuildType} MACOSX_DEPLOYMENT_TARGET: ${MACOSX_DEPLOYMENT_TARGET} > "$aDestDir/build_target.txt" fi
fi aTimeINSTALL=$SECONDS
aTimeINSTALL=$SECONDS logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
# create an archive # create an archive
if [[ $toPack == 1 ]]; then if [[ $toPack == 1 ]]; then
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2 YEAR=$(date +"%Y")
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}... MONTH=$(date +"%m")
rm ${aDestDir}/../${anArchName} &>/dev/null DAY=$(date +"%d")
pushd "$aDestDir" aRevision=-${YEAR}-${MONTH}-${DAY}
tar -jcf ${aDestDir}/../${anArchName} * #aRevision=-${aGitBranch}
popd
fi
aTimePACK=$SECONDS
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
# finished anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2
DURATION=$(($aTimePACK - $aTimeZERO))
echo Total time: $DURATION sec
logDuration 1 "Total" $aTimeZERO $aTimePACK
popd
}
for anArchIter in $anAbiList
do
echo Platform: macOS ABI: ${anArchIter} Build: ${aBuildType}
buildArch $anArchIter
done
# create a FAT archive
if [[ $toPackFat == 1 ]]; then
aSuffixFat=${aPlatform}${aBuildTypePrefix}-clang
aFatDir="${aCasSrc}/${aBuildRoot}/${aSuffixFat}"
# merge per-arch builds into fat builds
hasPlatform=0
for anArchIter in $anAbiList
do
aSuffixThin=${aPlatform}-${anArchIter}${aBuildTypePrefix}-clang
anArchDir="${aCasSrc}/${aBuildRoot}/${aSuffixThin}"
if [[ $hasPlatform == 0 ]]; then
hasPlatform=1
echo Packing FAT archive
rm -r -f "$aFatDir"
mkdir -p "$aFatDir"
if [[ $isStatic == 1 ]]; then
rsync -r -l --exclude '*.a' "$anArchDir/" "$aFatDir"
else
rsync -r -l --exclude '*.dylib' "$anArchDir/" "$aFatDir"
fi
rm -f "$aFatDir/build_target.txt"
if [[ -L "$anArchDir/bin/DRAWEXE" ]]; then
aDrawExe=$(readlink "$anArchDir/bin/DRAWEXE")
rm $aFatDir/bin/$aDrawExe
lipo "$anArchDir/bin/$aDrawExe" -output "$aFatDir/bin/$aDrawExe" -create
fi
for aLibIter in $anArchDir/lib/*.$aLibExt; do
aLibName=`basename $aLibIter`
if [[ -L "$anArchDir/lib/$aLibName" ]]; then
cp -a "$anArchDir/lib/$aLibName" "$aFatDir/lib/"
else
lipo "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
fi
done
else
if [[ -L "$anArchDir/bin/DRAWEXE" ]]; then
aDrawExe=$(readlink "$anArchDir/bin/DRAWEXE")
lipo "$aFatDir/bin/$aDrawExe" "$anArchDir/bin/$aDrawExe" -output "$aFatDir/bin/$aDrawExe" -create
fi
for aLibIter in $aFatDir/lib/*.$aLibExt; do
aLibName=`basename $aLibIter`
if [[ ! -L "$anArchDir/lib/$aLibName" ]]; then
lipo "$aFatDir/lib/$aLibName" "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
#lipo -info "$aFatDir/lib/$aLibName"
fi
done
fi
cat "$anArchDir/build_target.txt" >> "$aFatDir/build_target.txt"
done
# create an archive
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aSuffixFat}.tar.bz2
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}... echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
rm ${aFatDir}/../${anArchName} &>/dev/null rm ${aDestDir}/../${anArchName} &>/dev/null
pushd "$aFatDir" pushd "$aDestDir"
tar -jcf ${aFatDir}/../${anArchName} * tar -jcf ${aDestDir}/../${anArchName} *
popd popd
fi fi
aTimePACK=$SECONDS
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
# finished
DURATION=$(($aTimePACK - $aTimeZERO))
echo Total time: $DURATION sec
logDuration 1 "Total" $aTimeZERO $aTimePACK
popd

View File

@@ -3,7 +3,6 @@ export PATH=/Applications/CMake.app/Contents/bin:$PATH
export aFreeType="$aSrcRoot/../3rdparty/freetype-2.10.4-macos" export aFreeType="$aSrcRoot/../3rdparty/freetype-2.10.4-macos"
export aFreeImage="$aSrcRoot/../3rdparty/freeimage-3.18-macos" export aFreeImage="$aSrcRoot/../3rdparty/freeimage-3.18-macos"
export aRapidJson="$aSrcRoot/../3rdparty/rapidjson-1.1.0" export aRapidJson="$aSrcRoot/../3rdparty/rapidjson-1.1.0"
export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-macos"
# Uncomment to customize building steps # Uncomment to customize building steps
#export aBuildRoot=work #export aBuildRoot=work
@@ -12,7 +11,6 @@ export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-macos"
#export toMake=1 #export toMake=1
#export toInstall=1 #export toInstall=1
#export toPack=1 #export toPack=1
#export toPackFat=1
#export BUILD_ModelingData=ON #export BUILD_ModelingData=ON
#export BUILD_ModelingAlgorithms=ON #export BUILD_ModelingAlgorithms=ON
@@ -22,10 +20,8 @@ export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-macos"
#export BUILD_Draw=ON #export BUILD_Draw=ON
#export USE_RAPIDJSON=ON #export USE_RAPIDJSON=ON
#export USE_DRACO=ON
#export USE_FREEIMAGE=ON #export USE_FREEIMAGE=ON
#export MACOSX_DEPLOYMENT_TARGET=10.10 #export MACOSX_DEPLOYMENT_TARGET=10.10
#export anAbiList=arm64 #export anAbi=arm64
#export anAbiList=x86_64 #export anAbi=x86_64
#export anAbiList="arm64 x86_64"

View File

@@ -1,267 +0,0 @@
@echo OFF
rem Auxiliary script for semi-automated building of OCCT for Mingw-w64 platform.
rem mingw_custom.bat should be configured with paths to CMake, 3rd-parties and MinGW.
set "aCasSrc=%~dp0..\.."
set "aBuildRoot=%aCasSrc%\work"
set aNbJobs=%NUMBER_OF_PROCESSORS%
rem Paths to 3rd-party tools and libraries
set "aCmakeBin="
set "aMingwVars="
set "aFreeType="
set "aFreeImage="
set "aRapidJson="
set "aDraco="
set "aTclTk="
rem Build stages to perform
set "toCMake=1"
set "toClean=0"
set "toMake=1"
set "toInstall=1"
set "toPack=0"
set "toDebug=0"
set "isStatic=0"
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"
set "BUILD_Draw=ON"
rem Optional 3rd-party libraries to enable
set "USE_FREETYPE=ON"
set "USE_RAPIDJSON=OFF"
set "USE_DRACO=OFF"
set "USE_FREEIMAGE=ON"
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 "%~dp0mingw_custom.bat" call "%~dp0mingw_custom.bat"
if not ["%aMingwVars%"] == [""] ( call "%aMingwVars%" )
if not ["%aCmakeBin%"] == [""] ( set "PATH=%aCmakeBin%;%PATH%" )
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" )
set "aBuildType=Release"
set "aBuildTypePrefix="
set "aLibType=Shared"
if ["%isStatic%"] == ["1"] set "aLibType=Static"
if ["%toDebug%"] == ["1"] (
set "aBuildType=Debug"
set "aBuildTypePrefix=-debug"
)
call :cmakeGenerate
if errorlevel 1 (
if not ["%1"] == ["-nopause"] (
pause
)
exit /B 1
goto :eof
)
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%-mingw64%aBuildTypePrefix%"
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%\"
echo Copying dependencies...
for %%i in (libstdc++-6.dll libwinpthread-1.dll libgcc_s_seh-1.dll) do (
if "%%~$PATH:i" == "" (
echo "Error: could not find %%i"
) else (
xcopy /Y "%%~$PATH:i" "%aTarget%\win64\gcc\bin"
)
)
"%THE_7Z_PATH%" a -r %THE_7Z_PARAMS% "%aBuildRoot%/%anArchName%.7z" "%aTarget%"
)
if not ["%1"] == ["-nopause"] (
pause
)
goto :eof
:cmakeGenerate
set "aPlatformAndCompiler=mingw64%aBuildTypePrefix%"
set "aWorkDir=%aBuildRoot%\occt-%aPlatformAndCompiler%-make"
set "aDestDir=%aBuildRoot%\occt-%aPlatformAndCompiler%"
set "aLogFile=%aBuildRoot%\occt-%aPlatformAndCompiler%-build.log"
if ["%toCMake%"] == ["1"] (
if ["%toClean%"] == ["1"] (
rmdir /S /Q %aWorkDir%"
rmdir /S /Q %aDestDir%"
)
)
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 MinGW-w64...
cmake -G "MinGW Makefiles" ^
-D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^
-D BUILD_LIBRARY_TYPE:STRING="%aLibType%" ^
-D INSTALL_DIR:PATH="%aDestDir%" ^
-D INSTALL_DIR_INCLUDE:STRING="inc" ^
-D INSTALL_DIR_RESOURCE:STRING="src" ^
-D BUILD_DOC_Overview:BOOL="OFF" ^
-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="%BUILD_Draw%" ^
-D 3RDPARTY_TCL_DIR:PATH="%aTclTk%" ^
-D 3RDPARTY_TCL_INCLUDE_DIR:FILEPATH="%aTclTk%/include" ^
-D 3RDPARTY_TCL_LIBRARY_DIR:PATH="%aTclTk%/lib" ^
-D 3RDPARTY_TCL_DLL_DIR:PATH="%aTclTk%/bin" ^
-D 3RDPARTY_TK_DIR:PATH="%aTclTk%" ^
-D 3RDPARTY_TK_INCLUDE_DIR:FILEPATH="%aTclTk%/include" ^
-D 3RDPARTY_TK_LIBRARY_DIR:PATH="%aTclTk%/lib" ^
-D 3RDPARTY_TK_DLL_DIR:PATH="%aTclTk%/bin" ^
-D USE_D3D:BOOL="ON" ^
-D USE_FREETYPE:BOOL="%USE_FREETYPE%" ^
-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%/lib" ^
-D USE_FREEIMAGE:BOOL="%USE_FREEIMAGE%" ^
-D 3RDPARTY_FREEIMAGE_DIR:PATH="%aFreeImage%" ^
-D 3RDPARTY_FREEIMAGE_INCLUDE_DIR:FILEPATH="%aFreeImage%/include" ^
-D 3RDPARTY_FREEIMAGE_LIBRARY_DIR:PATH="%aFreeImage%/lib" ^
-D USE_RAPIDJSON:BOOL="%USE_RAPIDJSON%" ^
-D 3RDPARTY_RAPIDJSON_DIR:PATH="%aRapidJson%" ^
-D 3RDPARTY_RAPIDJSON_INCLUDE_DIR:PATH="%aRapidJson%/include" ^
-D USE_DRACO:BOOL="%USE_DRACO%" ^
-D 3RDPARTY_DRACO_DIR:PATH="%aDraco%" ^
-D 3RDPARTY_DRACO_INCLUDE_DIR:FILEPATH="%aDraco%/include" ^
-D 3RDPARTY_DRACO_LIBRARY_DIR:PATH="%aDraco%/lib" ^
"%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

@@ -1,29 +0,0 @@
rem Environment configuration template for mingw_build.bat (to be renamed as mingw_custom.bat)
set "aCmakeBin=%ProgramW6432%\CMake\bin"
set "aFreeType=%aCasSrc%/../3rdparty/freetype-2.6.3-mingw-64"
set "aTclTk=%aCasSrc%/../3rdparty/tcltk-8.6.4-mingw-64"
set "aFreeImage=%aCasSrc%/../3rdparty/freeimage-3.17-0-mingw-64"
set "aRapidJson=%aCasSrc%/../3rdparty/rapidjson-1.1.0"
set "aDraco=%aCasSrc%/../3rdparty/draco-1.4-1-mingw-64"
set "aMingwVars=c:\mingw-8.3.0-msys2\mingwvars.bat"
rem Uncomment to customize building steps
rem set "aBuildRoot=work"
rem set "toCMake=1"
rem set "toClean=1"
rem set "toMake=1"
rem set "toInstall=1"
rem set "toPack=1"
rem set "toDebug=0"
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 set "BUILD_Draw=ON"
rem set "USE_RAPIDJSON=ON"
rem set "USE_DRACO=ON"
rem set "USE_FREEIMAGE=ON"

View File

@@ -13,8 +13,6 @@ rem Paths to 3rd-party tools and libraries
set "aCmakeBin=" set "aCmakeBin="
set "aFreeType=" set "aFreeType="
set "aRapidJson=" set "aRapidJson="
set "aDraco="
set "aTcl="
rem Build stages to perform rem Build stages to perform
set "toCMake=1" set "toCMake=1"
@@ -32,13 +30,9 @@ set "BUILD_ModelingAlgorithms=ON"
set "BUILD_Visualization=ON" set "BUILD_Visualization=ON"
set "BUILD_ApplicationFramework=ON" set "BUILD_ApplicationFramework=ON"
set "BUILD_DataExchange=ON" set "BUILD_DataExchange=ON"
set "BUILD_Draw=OFF"
rem Optional 3rd-party libraries to enable rem Optional 3rd-party libraries to enable
set "USE_FREETYPE=ON"
set "USE_RAPIDJSON=OFF" set "USE_RAPIDJSON=OFF"
set "USE_DRACO=OFF"
set "USE_PTHREADS=OFF"
rem Archive tool rem Archive tool
set "THE_7Z_PARAMS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on" set "THE_7Z_PARAMS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on"
@@ -60,14 +54,9 @@ for /f %%i in ('git symbolic-ref --short HEAD') do ( set "aGitBranch=%%i" )
set "aBuildType=Release" set "aBuildType=Release"
set "aBuildTypePrefix=" set "aBuildTypePrefix="
set "anExtraCxxFlags="
if /I ["%USE_PTHREADS%"] == ["ON"] (
set "anExtraCxxFlags=-pthread"
set "aBuildTypePrefix=%aBuildTypePrefix%-pthread"
)
if ["%toDebug%"] == ["1"] ( if ["%toDebug%"] == ["1"] (
set "aBuildType=Debug" set "aBuildType=Debug"
set "aBuildTypePrefix=%aBuildTypePrefix%-debug" set "aBuildTypePrefix=-debug"
) )
call :cmakeGenerate call :cmakeGenerate
@@ -152,10 +141,6 @@ echo ^</pre^>>> "%aWorkDir%\VERSION.html"
echo Start building OCCT for %aPlatformAndCompiler% echo Start building OCCT for %aPlatformAndCompiler%
echo Start building OCCT for %aPlatformAndCompiler%>> %aLogFile% echo Start building OCCT for %aPlatformAndCompiler%>> %aLogFile%
echo --->> %aLogFile%
call emcc --version >> %aLogFile%
echo --->> %aLogFile%
pushd "%aWorkDir%" pushd "%aWorkDir%"
set "aTimeZERO=%TIME%" set "aTimeZERO=%TIME%"
@@ -165,35 +150,23 @@ if ["%toCMake%"] == ["1"] (
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^ -D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
-D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^ -D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^
-D BUILD_LIBRARY_TYPE:STRING="Static" ^ -D BUILD_LIBRARY_TYPE:STRING="Static" ^
-D CMAKE_CXX_FLAGS="%anExtraCxxFlags%" ^
-D INSTALL_DIR:PATH="%aDestDir%" ^ -D INSTALL_DIR:PATH="%aDestDir%" ^
-D INSTALL_DIR_INCLUDE:STRING="inc" ^ -D INSTALL_DIR_INCLUDE:STRING="inc" ^
-D INSTALL_DIR_RESOURCE:STRING="src" ^ -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_FoundationClasses:BOOL="ON" ^
-D BUILD_MODULE_ModelingData:BOOL="%BUILD_ModelingData%" ^ -D BUILD_MODULE_ModelingData:BOOL="%BUILD_ModelingData%" ^
-D BUILD_MODULE_ModelingAlgorithms:BOOL="%BUILD_ModelingAlgorithms%" ^ -D BUILD_MODULE_ModelingAlgorithms:BOOL="%BUILD_ModelingAlgorithms%" ^
-D BUILD_MODULE_Visualization:BOOL="%BUILD_Visualization%" ^ -D BUILD_MODULE_Visualization:BOOL="%BUILD_Visualization%" ^
-D BUILD_MODULE_ApplicationFramework:BOOL="%BUILD_ApplicationFramework%" ^ -D BUILD_MODULE_ApplicationFramework:BOOL="%BUILD_ApplicationFramework%" ^
-D BUILD_MODULE_DataExchange:BOOL="%BUILD_DataExchange%" ^ -D BUILD_MODULE_DataExchange:BOOL="%BUILD_DataExchange%" ^
-D BUILD_MODULE_Draw:BOOL="%BUILD_Draw%" ^ -D BUILD_MODULE_Draw:BOOL="OFF" ^
-D BUILD_DOC_Overview:BOOL="OFF" ^ -D BUILD_DOC_Overview:BOOL="OFF" ^
-D USE_FREETYPE:BOOL="%USE_FREETYPE%" ^
-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 USE_RAPIDJSON:BOOL="%USE_RAPIDJSON%" ^ -D USE_RAPIDJSON:BOOL="%USE_RAPIDJSON%" ^
-D 3RDPARTY_RAPIDJSON_DIR:PATH="%aRapidJson%" ^ -D 3RDPARTY_RAPIDJSON_DIR:PATH="%aRapidJson%" ^
-D 3RDPARTY_RAPIDJSON_INCLUDE_DIR:PATH="%aRapidJson%/include" ^ -D 3RDPARTY_RAPIDJSON_INCLUDE_DIR:PATH="%aRapidJson%/include" ^
-D USE_DRACO:BOOL="%USE_DRACO%" ^
-D 3RDPARTY_DRACO_DIR:PATH="%aDraco%" ^
-D 3RDPARTY_DRACO_INCLUDE_DIR:FILEPATH="%aDraco%/include" ^
-D 3RDPARTY_DRACO_LIBRARY_DIR:PATH="%aDraco%/lib" ^
-D 3RDPARTY_DRACO_LIBRARY:FILEPATH="%aDraco%/lib/libdraco.a" ^
-D USE_TK:BOOL="OFF" ^
-D 3RDPARTY_TCL_DIR:PATH="%aTcl%" ^
-D 3RDPARTY_TCL_INCLUDE_DIR:PATH="%aTcl%/include" ^
-D 3RDPARTY_TCL_LIBRARY_DIR:PATH="%aTcl%/lib" ^
-D 3RDPARTY_TCL_LIBRARY:FILEPATH="%aTcl%/lib/libtcl.a" ^
"%aCasSrc%" "%aCasSrc%"
if errorlevel 1 ( if errorlevel 1 (
@@ -263,7 +236,6 @@ if ["%toCMake%"] == ["1"] (
cmake -G "MinGW Makefiles" ^ cmake -G "MinGW Makefiles" ^
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^ -D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
-D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^ -D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^
-D CMAKE_CXX_FLAGS="%anExtraCxxFlags%" ^
-D CMAKE_INSTALL_PREFIX:PATH="%aDestDirSmpl%" ^ -D CMAKE_INSTALL_PREFIX:PATH="%aDestDirSmpl%" ^
-D SOURCE_MAP_BASE:STRING="%sourceMapBase%" ^ -D SOURCE_MAP_BASE:STRING="%sourceMapBase%" ^
-D OpenCASCADE_DIR:PATH="%aDestDir%/lib/cmake/opencascade" ^ -D OpenCASCADE_DIR:PATH="%aDestDir%/lib/cmake/opencascade" ^

View File

@@ -1,8 +1,7 @@
rem Environment configuration template for wasm_build.bat (to be renamed as wasm_custom.bat) rem Environment configuration template for wasm_build.bat (to be renamed as wasm_custom.bat)
set "EMSDK_ROOT=%aCasSrc%\..\emsdk" set "EMSDK_ROOT=%aCasSrc%\..\emsdk"
set "aFreeType=%aCasSrc%\..\3rdparty\freetype-2.7.1-wasm32" set "aFreeType=%aCasSrc%\..\3rdparty\freetype-2.7.1-wasm"
rem set "aRapidJson=%aCasSrc%\..\3rdparty\rapidjson-1.1.0" rem set "aRapidJson=%aCasSrc%\..\3rdparty\rapidjson-1.1.0"
rem set "aDraco=%aCasSrc%\..\3rdparty\draco-1.4.1-wasm32"
rem set "aCmakeBin=%ProgramW6432%\CMake\bin" rem set "aCmakeBin=%ProgramW6432%\CMake\bin"
rem Uncomment to customize building steps rem Uncomment to customize building steps
@@ -24,6 +23,4 @@ rem set "BUILD_Visualization=ON"
rem set "BUILD_ApplicationFramework=ON" rem set "BUILD_ApplicationFramework=ON"
rem set "BUILD_DataExchange=ON" rem set "BUILD_DataExchange=ON"
rem set "USE_RAPIDJSON=ON" rem set "USE_RAPIDJSON=OFF"
rem set "USE_DRACO=ON"
rem set "USE_PTHREADS=ON"

View File

@@ -21,8 +21,6 @@ set "toInstall=1"
set "toDebug=0" set "toDebug=0"
set "sourceMapBase=" set "sourceMapBase="
set "USE_PTHREADS=OFF"
rem Configuration file rem Configuration file
if exist "%~dp0wasm_custom.bat" call "%~dp0wasm_custom.bat" if exist "%~dp0wasm_custom.bat" call "%~dp0wasm_custom.bat"
@@ -32,14 +30,9 @@ if not ["%aCmakeBin%"] == [""] ( set "PATH=%aCmakeBin%;%PATH%" )
set "aBuildType=Release" set "aBuildType=Release"
set "aBuildTypePrefix=" set "aBuildTypePrefix="
set "anExtraCxxFlags="
if /I ["%USE_PTHREADS%"] == ["ON"] (
set "anExtraCxxFlags=-pthread"
set "aBuildTypePrefix=%aBuildTypePrefix%-pthread"
)
if ["%toDebug%"] == ["1"] ( if ["%toDebug%"] == ["1"] (
set "aBuildType=Debug" set "aBuildType=Debug"
set "aBuildTypePrefix=%aBuildTypePrefix%-debug" set "aBuildTypePrefix=-debug"
) )
call :cmakeGenerate call :cmakeGenerate
@@ -71,7 +64,6 @@ if ["%toCMake%"] == ["1"] (
cmake -G "MinGW Makefiles" ^ cmake -G "MinGW Makefiles" ^
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^ -D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
-D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^ -D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^
-D CMAKE_CXX_FLAGS="%anExtraCxxFlags%" ^
-D CMAKE_INSTALL_PREFIX:PATH="%aDestDirSmpl%" ^ -D CMAKE_INSTALL_PREFIX:PATH="%aDestDirSmpl%" ^
-D SOURCE_MAP_BASE:STRING="%sourceMapBase%" ^ -D SOURCE_MAP_BASE:STRING="%sourceMapBase%" ^
-D OpenCASCADE_DIR:PATH="%aDestDirOcct%/lib/cmake/opencascade" ^ -D OpenCASCADE_DIR:PATH="%aDestDirOcct%/lib/cmake/opencascade" ^

View File

@@ -27,7 +27,6 @@ set "HAVE_D3D=false"
set "HAVE_ZLIB=false" set "HAVE_ZLIB=false"
set "HAVE_LIBLZMA=false" set "HAVE_LIBLZMA=false"
set "HAVE_RAPIDJSON=false" set "HAVE_RAPIDJSON=false"
set "HAVE_DRACO=false"
set "HAVE_OPENVR=false" set "HAVE_OPENVR=false"
set "HAVE_E57=false" set "HAVE_E57=false"
set "CSF_OPT_INC=" set "CSF_OPT_INC="
@@ -35,14 +34,6 @@ set "CSF_OPT_LIB32="
set "CSF_OPT_LIB64=" set "CSF_OPT_LIB64="
set "CSF_OPT_BIN32=" set "CSF_OPT_BIN32="
set "CSF_OPT_BIN64=" set "CSF_OPT_BIN64="
set "CSF_OPT_LIB32D="
set "CSF_OPT_LIB64D="
set "CSF_OPT_BIN32D="
set "CSF_OPT_BIN64D="
set "CSF_OPT_LIB32I="
set "CSF_OPT_LIB64I="
set "CSF_OPT_BIN32I="
set "CSF_OPT_BIN64I="
set "CSF_DEFINES=%CSF_DEFINES_EXTRA%" set "CSF_DEFINES=%CSF_DEFINES_EXTRA%"
if not ["%CASROOT%"] == [""] if exist "%SCRIPTROOT%\%CASROOT%" set "CASROOT=%SCRIPTROOT%\%CASROOT%" if not ["%CASROOT%"] == [""] if exist "%SCRIPTROOT%\%CASROOT%" set "CASROOT=%SCRIPTROOT%\%CASROOT%"
@@ -121,12 +112,8 @@ if not "%DevEnvDir%" == "" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do ( for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "DevEnvDir=%%i\Common7\IDE\" set "DevEnvDir=%%i\Common7\IDE\"
) )
) else if /I "%VCFMT%" == "vc143" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[17.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "DevEnvDir=%%i\Common7\IDE\"
)
) else if /I "%VCFMT%" == "vclang" ( ) else if /I "%VCFMT%" == "vclang" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do ( for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "DevEnvDir=%%i\Common7\IDE\" set "DevEnvDir=%%i\Common7\IDE\"
) )
) else if /I "%VCFMT%" == "gcc" ( ) else if /I "%VCFMT%" == "gcc" (
@@ -141,7 +128,6 @@ if not "%DevEnvDir%" == "" (
echo vc14 = VS 2015 echo vc14 = VS 2015
echo vc141 = VS 2017 echo vc141 = VS 2017
echo vc142 = VS 2019 echo vc142 = VS 2019
echo vc143 = VS 2022
echo vclang = VS 2019 with ClangCL toolset echo vclang = VS 2019 with ClangCL toolset
exit /B exit /B
) )
@@ -172,15 +158,10 @@ if /I "%VCFMT%" == "vc9" (
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat" set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
) )
set "VCPlatformToolSet=v142" set "VCPlatformToolSet=v142"
) else if /I "%VCFMT%" == "vc143" ( ) else if /I "%VCFMT%" == "vclang" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[17.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do ( for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat" set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
) )
set "VCPlatformToolSet=v143"
) else if /I "%VCFMT%" == "vclang" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
)
set "VCPlatformToolSet=ClangCL" set "VCPlatformToolSet=ClangCL"
) else if /I "%VCFMT%" == "gcc" ( ) else if /I "%VCFMT%" == "gcc" (
rem MinGW rem MinGW
@@ -189,14 +170,14 @@ if /I "%VCFMT%" == "vc9" (
exit /B exit /B
) )
if ["%CSF_OPT_LIB32D%"] == [""] set "CSF_OPT_LIB32D=%CSF_OPT_LIB32%" set "CSF_OPT_LIB32D=%CSF_OPT_LIB32%"
if ["%CSF_OPT_LIB64D%"] == [""] set "CSF_OPT_LIB64D=%CSF_OPT_LIB64%" set "CSF_OPT_LIB64D=%CSF_OPT_LIB64%"
if ["%CSF_OPT_BIN32D%"] == [""] set "CSF_OPT_BIN32D=%CSF_OPT_BIN32%" set "CSF_OPT_BIN32D=%CSF_OPT_BIN32%"
if ["%CSF_OPT_BIN64D%"] == [""] set "CSF_OPT_BIN64D=%CSF_OPT_BIN64%" set "CSF_OPT_BIN64D=%CSF_OPT_BIN64%"
if ["%CSF_OPT_LIB32I%"] == [""] set "CSF_OPT_LIB32I=%CSF_OPT_LIB32%" set "CSF_OPT_LIB32I=%CSF_OPT_LIB32%"
if ["%CSF_OPT_LIB64I%"] == [""] set "CSF_OPT_LIB64I=%CSF_OPT_LIB64%" set "CSF_OPT_LIB64I=%CSF_OPT_LIB64%"
if ["%CSF_OPT_BIN32I%"] == [""] set "CSF_OPT_BIN32I=%CSF_OPT_BIN32%" set "CSF_OPT_BIN32I=%CSF_OPT_BIN32%"
if ["%CSF_OPT_BIN64I%"] == [""] set "CSF_OPT_BIN64I=%CSF_OPT_BIN64%" set "CSF_OPT_BIN64I=%CSF_OPT_BIN64%"
rem ----- Optional 3rd-parties should be enabled by HAVE macros ----- rem ----- Optional 3rd-parties should be enabled by HAVE macros -----
set "CSF_OPT_CMPL=" set "CSF_OPT_CMPL="
@@ -213,7 +194,6 @@ if ["%HAVE_D3D%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DH
if ["%HAVE_ZLIB%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_ZLIB" & set "CSF_DEFINES=HAVE_ZLIB;%CSF_DEFINES%" if ["%HAVE_ZLIB%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_ZLIB" & set "CSF_DEFINES=HAVE_ZLIB;%CSF_DEFINES%"
if ["%HAVE_LIBLZMA%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_LIBLZMA" & set "CSF_DEFINES=HAVE_LIBLZMA;%CSF_DEFINES%" if ["%HAVE_LIBLZMA%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_LIBLZMA" & set "CSF_DEFINES=HAVE_LIBLZMA;%CSF_DEFINES%"
if ["%HAVE_RAPIDJSON%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_RAPIDJSON" & set "CSF_DEFINES=HAVE_RAPIDJSON;%CSF_DEFINES%" if ["%HAVE_RAPIDJSON%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_RAPIDJSON" & set "CSF_DEFINES=HAVE_RAPIDJSON;%CSF_DEFINES%"
if ["%HAVE_DRACO%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_DRACO" & set "CSF_DEFINES=HAVE_DRACO;%CSF_DEFINES%"
if ["%HAVE_OPENVR%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_OPENVR" & set "CSF_DEFINES=HAVE_OPENVR;%CSF_DEFINES%" if ["%HAVE_OPENVR%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_OPENVR" & set "CSF_DEFINES=HAVE_OPENVR;%CSF_DEFINES%"
if ["%HAVE_E57%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_E57" & set "CSF_DEFINES=HAVE_E57;%CSF_DEFINES%" if ["%HAVE_E57%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_E57" & set "CSF_DEFINES=HAVE_E57;%CSF_DEFINES%"

View File

@@ -131,10 +131,6 @@ if exist "%CASROOT%\custom.bat" (
call "%CASROOT%\custom.bat" %VCVER% %ARCH% %CASDEB% call "%CASROOT%\custom.bat" %VCVER% %ARCH% %CASDEB%
) )
if not ["%QTDIR%"] == [""] (
set "PATH=%QTDIR%/bin;%PATH%"
set "QT_PLUGIN_PATH=%QTDIR%/plugins"
)
if not ["%TCL_DIR%"] == [""] set "PATH=%TCL_DIR%;%PATH%" if not ["%TCL_DIR%"] == [""] set "PATH=%TCL_DIR%;%PATH%"
if not ["%TK_DIR%"] == [""] set "PATH=%TK_DIR%;%PATH%" if not ["%TK_DIR%"] == [""] set "PATH=%TK_DIR%;%PATH%"
if not ["%FREETYPE_DIR%"] == [""] set "PATH=%FREETYPE_DIR%;%PATH%" if not ["%FREETYPE_DIR%"] == [""] set "PATH=%FREETYPE_DIR%;%PATH%"
@@ -145,6 +141,10 @@ if not ["%TBB_DIR%"] == [""] set "PATH=%TBB_DIR%;%PATH%"
if not ["%VTK_DIR%"] == [""] set "PATH=%VTK_DIR%;%PATH%" if not ["%VTK_DIR%"] == [""] set "PATH=%VTK_DIR%;%PATH%"
if not ["%FFMPEG_DIR%"] == [""] set "PATH=%FFMPEG_DIR%;%PATH%" if not ["%FFMPEG_DIR%"] == [""] set "PATH=%FFMPEG_DIR%;%PATH%"
if not ["%OPENVR_DIR%"] == [""] set "PATH=%OPENVR_DIR%;%PATH%" if not ["%OPENVR_DIR%"] == [""] set "PATH=%OPENVR_DIR%;%PATH%"
if not ["%QTDIR%"] == [""] (
set "PATH=%QTDIR%/bin;%PATH%"
set "QT_PLUGIN_PATH=%QTDIR%/plugins"
)
rem ----- Set path to 3rd party and OCCT libraries ----- rem ----- Set path to 3rd party and OCCT libraries -----
if not "%CSF_OCCTBinPath%" == "" ( if not "%CSF_OCCTBinPath%" == "" (

View File

@@ -3,8 +3,6 @@
# go to the script directory # go to the script directory
aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD"; aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";
aSystem=`uname -s`
# Reset values # Reset values
export CASROOT="__CASROOT__" export CASROOT="__CASROOT__"
export CASDEB="" export CASDEB=""
@@ -20,13 +18,9 @@ export HAVE_GLES2="false";
export HAVE_ZLIB="false"; export HAVE_ZLIB="false";
export HAVE_LIBLZMA="false"; export HAVE_LIBLZMA="false";
export HAVE_RAPIDJSON="false"; export HAVE_RAPIDJSON="false";
export HAVE_DRACO="false";
export HAVE_OPENVR="false"; export HAVE_OPENVR="false";
export HAVE_E57="false"; export HAVE_E57="false";
export HAVE_XLIB="true"; export MACOSX_USE_GLX="false";
if [ "$aSystem" == "Darwin" ]; then
export HAVE_XLIB="false";
fi
export CSF_OPT_INC="" export CSF_OPT_INC=""
export CSF_OPT_LIB32="" export CSF_OPT_LIB32=""
export CSF_OPT_LIB64="" export CSF_OPT_LIB64=""
@@ -66,6 +60,7 @@ else
export ARCH="64"; export ARCH="64";
fi fi
aSystem=`uname -s`
if [ "$aSystem" == "Darwin" ]; then if [ "$aSystem" == "Darwin" ]; then
export WOKSTATION="mac"; export WOKSTATION="mac";
export ARCH="64"; export ARCH="64";
@@ -116,10 +111,10 @@ if [ "$HAVE_VTK" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -D
if [ "$HAVE_ZLIB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_ZLIB"; fi if [ "$HAVE_ZLIB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_ZLIB"; fi
if [ "$HAVE_LIBLZMA" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_LIBLZMA"; fi if [ "$HAVE_LIBLZMA" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_LIBLZMA"; fi
if [ "$HAVE_RAPIDJSON" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_RAPIDJSON"; fi if [ "$HAVE_RAPIDJSON" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_RAPIDJSON"; fi
if [ "$HAVE_DRACO" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_DRACO"; fi
if [ "$HAVE_OPENVR" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_OPENVR"; fi if [ "$HAVE_OPENVR" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_OPENVR"; fi
if [ "$HAVE_E57" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_E57"; fi if [ "$HAVE_E57" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_E57"; fi
if [ "$HAVE_XLIB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_XLIB"; fi # Option to compile OCCT with X11 libs on Mac OS X
if [ "$MACOSX_USE_GLX" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DMACOSX_USE_GLX"; fi
# To split string into array # To split string into array
aDelimBack=$IFS aDelimBack=$IFS

View File

@@ -100,7 +100,7 @@
<ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName> <ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>26812</DisableSpecificWarnings> <DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel> <FloatingPointModel>Precise</FloatingPointModel>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
__VCMPL32__ __VCMPL32__
@@ -148,7 +148,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<DisableSpecificWarnings>26812</DisableSpecificWarnings> <DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel> <FloatingPointModel>Precise</FloatingPointModel>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
@@ -196,7 +196,7 @@
<ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName> <ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>26812</DisableSpecificWarnings> <DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel> <FloatingPointModel>Precise</FloatingPointModel>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
__VCMPL64__ __VCMPL64__
@@ -244,7 +244,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<DisableSpecificWarnings>26812</DisableSpecificWarnings> <DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel> <FloatingPointModel>Precise</FloatingPointModel>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>

View File

@@ -95,7 +95,7 @@
<ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName> <ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>26812</DisableSpecificWarnings> <DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__ <FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
@@ -140,7 +140,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<DisableSpecificWarnings>26812</DisableSpecificWarnings> <DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__ <FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__
</ClCompile> </ClCompile>
@@ -185,7 +185,7 @@
<ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName> <ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>26812</DisableSpecificWarnings> <DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__ <FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
@@ -229,7 +229,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<DisableSpecificWarnings>26812</DisableSpecificWarnings> <DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__ <FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__
</ClCompile> </ClCompile>

View File

@@ -43,7 +43,6 @@ configure_file ("${OCCT_OVERVIEW_RESOURCE_DIR}/occt_ug_html.doxyfile" "${OCCT_CO
file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nPROJECT_NUMBER = ${OCC_VERSION_STRING_EXT}") file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nPROJECT_NUMBER = ${OCC_VERSION_STRING_EXT}")
file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nOUTPUT_DIRECTORY = ${OCCT_GENERATED_OVERVIEW_DIR}/.") file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nOUTPUT_DIRECTORY = ${OCCT_GENERATED_OVERVIEW_DIR}/.")
file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nPROJECT_LOGO = ${OCCT_OVERVIEW_DIR}/resources/occ_logo.png") file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nPROJECT_LOGO = ${OCCT_OVERVIEW_DIR}/resources/occ_logo.png")
file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nEXAMPLE_PATH = ${CMAKE_SOURCE_DIR}/src")
set (OCCT_ARTICLE_PARAM_INPUT "INPUT =") set (OCCT_ARTICLE_PARAM_INPUT "INPUT =")
set (OCCT_ARTICLE_PARAM_IMAGEPATH "IMAGE_PATH = ${OCCT_OVERVIEW_DIR}/resources/ ") set (OCCT_ARTICLE_PARAM_IMAGEPATH "IMAGE_PATH = ${OCCT_OVERVIEW_DIR}/resources/ ")

View File

@@ -12,19 +12,14 @@ samples/samples.md
../samples/CSharp/ReadMe.md ../samples/CSharp/ReadMe.md
../samples/CSharp/ReadMe_D3D.md ../samples/CSharp/ReadMe_D3D.md
../samples/qt/AndroidQt/ReadMe.md ../samples/qt/AndroidQt/ReadMe.md
../samples/qt/IESample/ReadMe.md
../samples/qt/OCCTOverview/ReadMe.md ../samples/qt/OCCTOverview/ReadMe.md
../samples/qt/Tutorial/ReadMe.md
../samples/java/jniviewer/ReadMe.md ../samples/java/jniviewer/ReadMe.md
../samples/ios/UIKitSample/ReadMe.md ../samples/ios/UIKitSample/ReadMe.md
../samples/webgl/ReadMe.md ../samples/webgl/ReadMe.md
../samples/glfw/readme.md
samples/ocaf.md samples/ocaf.md
samples/ocaf_func.md samples/ocaf_func.md
samples/draw_scripts.md samples/draw_scripts.md
samples/ais_object.md
samples/novice_guide.md
tutorial/tutorial.md tutorial/tutorial.md
build/build_upgrade.md build/build_upgrade.md

View File

@@ -6,8 +6,6 @@
tutorial/tutorial.md tutorial/tutorial.md
samples/novice_guide.md
upgrade/upgrade.md upgrade/upgrade.md
user_guides/foundation_classes/foundation_classes.md user_guides/foundation_classes/foundation_classes.md

View File

@@ -2,48 +2,60 @@
============================================== ==============================================
@tableofcontents @tableofcontents
On Windows, the easiest way to install third-party libraries is to download archive with pre-built binaries from https://dev.opencascade.org/resources/download/3rd-party-components. On Windows, the easiest way to install third-party libraries is to download archive with pre-built binaries from https://opencascade.com/content/3rd-party-components.
On Linux and macOS, it is recommended to use the version installed in the system natively. On Linux and OS X, it is recommended to use the version installed in the system natively.
@section dev_guides__building_3rdparty_win_1 Windows @section dev_guides__building_3rdparty_win_1 Windows
This section presents guidelines for building third-party products used by Open CASCADE Technology (OCCT) and samples on Windows platform. This document presents guidelines for building third-party products used by Open CASCADE Technology (OCCT) and samples on Windows platform. It is assumed that you are already familiar with MS Visual Studio / Visual C++.
It is assumed that you are already familiar with MS Visual Studio / Visual C++.
You need to use the same version of MS Visual Studio for building all third-party products and OCCT itself, in order to receive a consistent set of runtime binaries. You need to use the same version of MS Visual Studio for building all third-party products and OCCT itself, in order to receive a consistent set of run-time binaries.
It is recommended to create a separate new folder on your workstation, where you will unpack the downloaded archives of the third-party products, and where you will build these products (for example, `c:/occ3rdparty`). The links for downloading the third-party products are available at https://opencascade.com/content/3rd-party-components.
Further in this document, this folder is referred to as `3rdparty`.
There are two types of third-party products used by OCCT:
* Mandatory products:
* Tcl/Tk 8.5 -- 8.6;
* FreeType 2.4.10 -- 2.5.3.
* Optional products:
* TBB 3.x -- 4.x;
* FreeImage 3.14.1 -- 3.16.0;
* VTK 6.1.0.
It is recommended to create a separate new folder on your workstation, where you will unpack the downloaded archives of the third-party products, and where you will build these products (for example, *c:\\occ3rdparty*).
Further in this document, this folder is referred to as *3rdparty*.
@subsection dev_guides__building_3rdparty_win_2 Tcl/Tk @subsection dev_guides__building_3rdparty_win_2 Tcl/Tk
Tcl/Tk is required for DRAW test harness. Tcl/Tk is required for DRAW test harness.
**Installation from sources: Tcl** **Installation from sources: Tcl**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it. Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. In the `win` sub-directory, edit file `buildall.vc.bat`: 1. In the *win* sub-directory, edit file *buildall.vc.bat*:
* Edit the line `"call ... vcvars32.bat"` to have correct path to the version of Visual Studio to be used for building, for instance: * Edit the line "call ... vcvars32.bat" to have correct path to the version of Visual Studio to be used for building, for instance:
call "%VS80COMNTOOLS%\vsvars32.bat" call "%VS80COMNTOOLS%\vsvars32.bat"
If you are building 64-bit version, set environment accordingly, e.g.: If you are building 64-bit version, set environment accordingly, e.g.:
call "%VS80COMNTOOLS%\..\..\VC\vcvarsall.bat" amd64 call "%VS80COMNTOOLS%\..\..\VC\vcvarsall.bat" amd64
* Define variable `INSTALLDIR` pointing to directory where Tcl/Tk will be installed, e.g.: * Define variable *INSTALLDIR* pointing to directory where Tcl/Tk will be installed, e.g.:
set INSTALLDIR=D:\OCCT\3rdparty\tcltk-86-32 set INSTALLDIR=D:\OCCT\3rdparty\tcltk-86-32
* Add option `install` to the first command line calling `nmake`: * Add option *install* to the first command line calling *nmake*:
nmake -nologo -f makefile.vc release htmlhelp install %1 nmake -nologo -f makefile.vc release htmlhelp install %1
* Remove second call to `nmake` (building statically linked executable) * Remove second call to *nmake* (building statically linked executable)
2. Edit file `rules.vc` replacing line 2. Edit file *rules.vc* replacing line
SUFX = tsgx SUFX = tsgx
@@ -53,18 +65,21 @@ Download the necessary archive from https://www.tcl.tk/software/tcltk/download.h
This is to avoid extra prefix 't' in the library name, which is not recognized by default by OCCT build tools. This is to avoid extra prefix 't' in the library name, which is not recognized by default by OCCT build tools.
3. By default, Tcl uses dynamic version of run-time library (MSVCRT), which must be installed on the system where Tcl will be used. 3. By default, Tcl uses dynamic version of run-time library (MSVCRT), which must be installed on the system where Tcl will be used.
You may wish to link Tcl library with static version of run-time to avoid this dependency. You may wish to link Tcl library with static version of run-time to avoid this dependency.
For that: For that:
* Edit file `makefile.vc` replacing strings `"crt = -MD"` by `"crt = -MT"` * Edit file *makefile.vc* replacing strings "crt = -MD" by "crt = -MT"
* Edit source file `tclMain.c` (located in folder `generic`) commenting out forward declaration of function `isatty()`. * Edit source file *tclMain.c* (located in folder *generic*) commenting out forward declaration of function *isatty()*.
4. In the command prompt, run `buildall.vc.bat`<br>
You might need to run this script twice to have `tclsh` executable installed; check subfolder `bin` of specified installation path to verify this.
5. For convenience of use, we recommend making a copy of `tclsh` executable created in subfolder `bin` of `INSTALLDIR` and named with Tcl version number suffix, as `tclsh.exe` (with no suffix) 4. In the command prompt, run *buildall.vc.bat*
You might need to run this script twice to have *tclsh* executable installed; check subfolder *bin* of specified installation path to verify this.
5. For convenience of use, we recommend making a copy of *tclsh* executable created in subfolder *bin* of *INSTALLDIR* and named with Tcl version number suffix, as *tclsh.exe* (with no suffix)
> cd D:\OCCT\3rdparty\tcltk-86-32\bin > cd D:\OCCT\3rdparty\tcltk-86-32\bin
> cp tclsh86.exe tclsh.exe > cp tclsh86.exe tclsh.exe
@@ -72,303 +87,327 @@ Download the necessary archive from https://www.tcl.tk/software/tcltk/download.h
**Installation from sources: Tk** **Installation from sources: Tk**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it. Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
Apply the same steps as described for building Tcl above, with the same `INSTALLDIR`.
Note that Tk produces its own executable, called `wish`.
You might need to edit default value of `TCLDIR` variable defined in `buildall.vc.bat` (should be not necessary if you unpack both Tcl and Tk sources in the same folder). Apply the same steps as described for building Tcl above, with the same INSTALLDIR.
Note that Tk produces its own executable, called *wish*.
You might need to edit default value of *TCLDIR* variable defined in *buildall.vc.bat* (should be not necessary if you unpack both Tcl and Tk sources in the same folder).
@subsection dev_guides__building_3rdparty_win_2_2 FreeType @subsection dev_guides__building_3rdparty_win_2_2 FreeType
FreeType is required for text display in a 3D viewer. FreeType is required for text display in a 3D viewer. You can download its sources from https://sourceforge.net/projects/freetype/files/
You can download its sources from https://freetype.org/
1. Unpack the downloaded archive of FreeType product into the `3rdparty` folder. ### The building procedure
As a result, you will get a folder named, for example, `3rdparty/freetype-2.4.10`.
Further in this document, this folder is referred to as `freetype`.
2. Open the solution file `freetype/builds/win32/vc20xx/freetype.sln` in Visual Studio. 1. Unpack the downloaded archive of FreeType product into the *3rdparty* folder. As a result, you will get a folder named, for example, *3rdparty\\freetype-2.4.10*. Further in this document, this folder is referred to as *freetype*.
Here `vc20xx` stands for your version of Visual Studio.
2. Open the solution file *freetype\\builds\\win32\\vc20xx\\freetype.sln* in Visual Studio. Here *vc20xx* stands for your version of Visual Studio.
3. Select the configuration to build: either `Debug` or `Release`. 3. Select the configuration to build: either Debug or Release.
4. Build the `freetype` project.<br> 4. Build the *freetype* project.
As a result, you will get a `freetype` import library (`.lib`) in the `freetype/obj/win32/vc20xx` folder.
5. If you build FreeType for a 64 bit platform, select in the main menu `Build - Configuration Manager` As a result, you will get a freetype import library (.lib) in the *freetype\\obj\\win32\\vc20xx* folder.
and add `x64` platform to the solution configuration by copying the settings from `Win32` platform:
5. If you build FreeType for a 64 bit platform, select in the main menu **Build - Configuration Manager** and add *x64* platform to the solution configuration by copying the settings from Win32 platform:
@figure{/build/build_3rdparty/images/3rdparty_image001.png} @figure{/build/build_3rdparty/images/3rdparty_image001.png}
Update the value of the Output File for `x64` configuration: Update the value of the Output File for x64 configuration:
@figure{/build/build_3rdparty/images/3rdparty_image003.png} @figure{/build/build_3rdparty/images/3rdparty_image003.png}
Build the `freetype` project.<br> Build the *freetype* project.
As a result, you will obtain a 64 bit import library (`.lib`) file in the `freetype/x64/vc20xx` folder.
To build FreeType as a dynamic library (`.dll`) follow steps 6, 7 and 8 of this procedure.
6. Open menu Project-> Properties-> Configuration Properties-> General and change option `Configuration Type` to `Dynamic Library (.dll)`. As a result, you will obtain a 64 bit import library (.lib) file in the *freetype\\x64\\vc20xx* folder.
7. Edit file `freetype/include/freetype/config/ftoption.h`:<br>
in line 255, uncomment the definition of macro `FT_EXPORT` and change it as follows:
#define FT_EXPORT(x) __declspec(dllexport) x To build FreeType as a dynamic library (.dll) follow steps 6, 7 and 8 of this procedure.
8. Build the `freetype` project.<br> 6. Open menu Project-> Properties-> Configuration Properties-> General and change option **Configuration Type** to *Dynamic Library (.dll)*.
As a result, you will obtain the files of the import library (`.lib`) and the dynamic library (`.dll`) in folders `freetype/objs/release` or `freetype/objs/debug`. 7. Edit file *freetype\\include\\freetype\\config\\ftoption.h*:
If you build for a 64 bit platform, follow step 5 of the procedure.
in line 255, uncomment the definition of macro *FT_EXPORT* and change it as follows:
To facilitate the use of FreeType libraries in OCCT with minimal adjustment of build procedures, #define FT_EXPORT(x) __declspec(dllexport) x
it is recommended to copy the include files and libraries of FreeType into a separate folder, named according to the pattern `freetype-compiler-bitness-building mode`, where:
* `compiler` is `vc8` or `vc9` or `vc10` or `vc11`; 8. Build the *freetype* project.
* `bitness` is `32` or `64`;
* `building mode` is `opt` (for `Release`) or `deb` (for `Debug`). As a result, you will obtain the files of the import library (.lib) and the dynamic library (.dll) in folders <i>freetype \\objs\\release</i> or <i>\\objs\\debug </i>.
If you build for a 64 bit platform, follow step 5 of the procedure.
To facilitate the use of FreeType libraries in OCCT with minimal adjustment of build procedures, it is recommended to copy the include files and libraries of FreeType into a separate folder, named according to the pattern: *freetype-compiler-bitness-building mode*, where:
* **compiler** is *vc8* or *vc9* or *vc10* or *vc11*;
* **bitness** is *32* or *64*;
* **building mode** is *opt* (for Release) or *deb* (for Debug).
The *include* subfolder should be copied as is, while libraries should be renamed to *freetype.lib* and *freetype.dll* (suffixes removed) and placed to subdirectories *lib *and *bin*, respectively. If the Debug configuration is built, the Debug libraries should be put into subdirectories *libd* and *bind*.
The `include` subfolder should be copied as is, while libraries should be renamed to `freetype.lib` and `freetype.dll` (suffixes removed) and placed to subdirectories `lib` and `bin`, respectively.
If the `Debug` configuration is built, the Debug libraries should be put into subdirectories `libd` and `bind`.
@subsection dev_guides__building_3rdparty_win_3_1 TBB @subsection dev_guides__building_3rdparty_win_3_1 TBB
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb. This third-party product is installed with binaries
Go to the **Download** page, find the release version you need (e.g. `tbb30_018oss`) and pick the archive for Windows platform. from the archive that can be downloaded from https://github.com/intel/tbb.
Go to the **Download** page, find the release version you need (e.g. *tbb30_018oss*) and pick the archive for Windows platform.
Unpack the downloaded archive of TBB product into the `3rdparty` folder. Unpack the downloaded archive of TBB product into the *3rdparty* folder.
Further in this document, this folder is referred to as `tbb`. Further in this document, this folder is referred to as *tbb*.
@subsection dev_guides__building_3rdparty_win_3_3 FreeImage @subsection dev_guides__building_3rdparty_win_3_3 FreeImage
This third-party product should be built as a dynamically loadable library (`.dll` file). This third-party product should be built as a dynamically loadable library (.dll file).
You can download its sources from You can download its sources from
https://sourceforge.net/projects/freeimage/files/Source%20Distribution/ https://sourceforge.net/projects/freeimage/files/Source%20Distribution/
1. Unpack the downloaded archive of FreeImage product into `3rdparty` folder.<br> ### The building procedure:
As a result, you should have a folder named `3rdparty/FreeImage`.
Rename it according to the rule: `freeimage-platform-compiler-building mode`, where
* `platform` is `win32` or `win64`; 1. Unpack the downloaded archive of FreeImage product into *3rdparty* folder.
* `compiler` is `vc8` or `vc9` or `vc10` or `vc11`;
* `building mode` is *opt* (for release) or `deb` (for debug) As a result, you should have a folder named *3rdparty\\FreeImage*.
Rename it according to the rule: *freeimage-platform-compiler-building mode*, where
* **platform** is *win32* or *win64*;
* **compiler** is *vc8* or *vc9* or *vc10* or *vc11*;
* **building mode** is *opt* (for release) or *deb* (for debug)
Further in this document, this folder is referred to as `freeimage`. Further in this document, this folder is referred to as *freeimage*.
2. Open the solution file `freeimage/FreeImage.*.sln` in your Visual Studio.<br> 2. Open the solution file *freeimage\\FreeImage.*.sln* in your Visual Studio.
If you use a Visual Studio version higher than VC++ 2008, apply conversion of the workspace.
Such conversion should be suggested automatically by Visual Studio. If you use a Visual Studio version higher than VC++ 2008, apply conversion of the workspace.
Such conversion should be suggested automatically by Visual Studio.
3. Select a configuration to build.
3. Select a configuration to build. - Choose **Release** if you are building Release binaries.
- Choose `Release` if you are building Release binaries. - Choose **Debug** if you are building Debug binaries.
- Choose `Debug` if you are building Debug binaries.
*Note:* *Note:*
If you want to build a debug version of FreeImage binaries then you need to rename the following files in FreeImage projects:
If you want to build a debug version of FreeImage binaries then you need to rename the following files in FreeImage and FreeimagePlus projects:
Project -> Properties -> Configuration Properties -> Linker -> General -> Output File Project -> Properties -> Configuration Properties -> Linker -> General -> Output File
FreeImage*d*.dll to FreeImage.dll FreeImage*d*.dll to FreeImage.dll
FreeImagePlus*d*.dll to FreeImagePlus.dll
Project -> Properties -> Configuration Properties -> Linker -> Debugging-> Generate Program Database File Project -> Properties -> Configuration Properties -> Linker -> Debugging-> Generate Program Database File
FreeImage*d*.pdb to FreeImage.pdb FreeImage*d*.pdb to FreeImage.pdb
FreeImagePlus*d*.pdb to FreeImagePlus.pdb
Project -> Properties -> Configuration Properties -> Linker -> Advanced-Import Library Project -> Properties -> Configuration Properties -> Linker -> Advanced-Import Library
FreeImage*d*.lib to FreeImage.lib FreeImage*d*.lib to FreeImage.lib
FreeImagePlus*d*.lib to FreeImagePlus.lib
Project -> Properties -> Configuration Properties -> Build Events -> Post -> Build Event -> Command Line Project -> Properties -> Configuration Properties -> Build Events -> Post -> Build Event -> Command Line
FreeImage*d*.dll to FreeImage.dll FreeImage*d*.dll to FreeImage.dll
FreeImage*d*.lib to FreeImage.lib FreeImage*d*.lib to FreeImage.lib
FreeImagePlus*d*.dll to FreeImagePlus.dll
FreeImagePlus*d*.lib to FreeImagePlus.lib
Additionally, rename in project FreeImagePlus Additionally, rename in project FreeImagePlus
Project -> Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies
Project -> Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies from FreeImage*d*.lib to FreeImage.lib
from FreeImage*d*.lib to FreeImage.lib 4. Select a platform to build.
4. Select a platform to build. - Choose *Win32* if you are building for a 32 bit platform.
- Choose `Win32` if you are building for a 32 bit platform. - Choose *x64* if you are building for a 64 bit platform.
- Choose `x64` if you are building for a 64 bit platform.
5. Start the building process.<br> 5. Start the building process.
As a result, you should have the library files of FreeImage product in `freeimage/Dist` folder (`FreeImage.dll` and `FreeImage.lib`).
As a result, you should have the library files of FreeImage product in *freeimage\\Dist* folder (*FreeImage.dll* and *FreeImage.lib*) and in *freeimage\\Wrapper\\FreeImagePlus\\dist* folder (*FreeImagePlus.dll* and *FreeImagePlus.lib*).
@subsection dev_guides__building_3rdparty_win_3_4 VTK @subsection dev_guides__building_3rdparty_win_3_4 VTK
VTK Integration Services component provides adaptation functionality for visualization of OCCT topological shapes by means of VTK library. VTK is an open-source, freely available software system for 3D computer graphics, image processing and visualization. VTK Integration Services component provides adaptation functionality for visualization of OCCT topological shapes by means of VTK library.
1. Download the necessary archive from https://www.vtk.org/VTK/resources/software.html and unpack it into `3rdparty` folder.<br> ### The building procedure:
As a result, you will get a folder named, for example, `3rdparty/VTK-6.1.0`.
Further in this document, this folder is referred to as `VTK`. 1. Download the necessary archive from https://www.vtk.org/VTK/resources/software.html and unpack it into *3rdparty* folder.
As a result, you will get a folder named, for example, <i>3rdparty\VTK-6.1.0.</i>
Further in this document, this folder is referred to as *VTK*.
2. Use CMake to generate VS projects for building the library: 2. Use CMake to generate VS projects for building the library:
- Start CMake-GUI and select `VTK` folder as source path, and the folder of your choice for VS project and intermediate build data. - Start CMake-GUI and select VTK folder as source path, and the folder of your choice for VS project and intermediate build data.
- Click **Configure**. - Click **Configure**.
- Select the VS version to be used from the ones you have installed (we recommend using VS 2015) and the architecture (32 or 64-bit). - Select the VS version to be used from the ones you have installed (we recommend using VS 2010) and the architecture (32 or 64-bit).
- Generate VS projects with default CMake options. The open solution `VTK.sln` will be generated in the build folder. - Generate VS projects with default CMake options. The open solution *VTK.sln* will be generated in the build folder.
3. Build project VTK in Release mode. 3. Build project VTK in Release mode.
@section build_3rdparty_linux Linux @section build_3rdparty_linux Linux
This section presents additional guidelines for building third-party products used by Open CASCADE Technology and samples on Linux platform. This document presents additional guidelines for building third-party
products used by Open CASCADE Technology and samples on Linux platform.
@subsection dev_guides__building_3rdparty_linux_4 Installation From Official Repositories The links for downloading the third-party products are available on the web site at
https://opencascade.com/content/3rd-party-components.
**Debian-based distributives** There are two types of third-party products, which are necessary to build OCCT:
* Mandatory products:
* Tcl/Tk 8.5 - 8.6;  
* FreeType 2.4.10 - 2.5.3;
* Optional products:
* TBB 3.x - 4.x;
* FreeImage 3.14.1 - 3.16.0;
* VTK 6.1.0.
All 3rd-party products required for building of OCCT could be installed from official repositories.
You may install them from console using apt-get utility:
sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libx11-dev libgl1-mesa-dev libfreeimage-dev @subsection dev_guides__building_3rdparty_linux_2_1 Tcl/Tk
sudo apt-get install rapidjson-dev libdraco-dev
Building is possible with C++ compliant compiler: Tcl/Tk is required for DRAW test harness.
sudo apt-get install g++
@subsection dev_guides__building_3rdparty_linux_2_1 Tcl/Tk
Tcl/Tk is required for DRAW test harness.
**Installation from sources: Tcl** **Installation from sources: Tcl**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. Enter the `unix` sub-directory of the directory where the Tcl source files are located (`TCL_SRC_DIR`).
cd TCL_SRC_DIR/unix
2. Run the `configure` command:
configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR
For a 64 bit platform also add `--enable-64bit` option to the command line.
3. If the configure command has finished successfully, start the building process:
make
4. If building is finished successfully, start the installation of Tcl.
All binary and service files of the product will be copied to the directory defined by `TCL_INSTALL_DIR`
make install
**Installation from sources: Tk**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it. Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. Enter the `unix` sub-directory of the directory where the Tk source files are located (`TK_SRC_DIR`) 1. Enter the unix sub-directory of the directory where the Tcl source files are located <i>(TCL_SRC_DIR)</i>.
cd TK_SRC_DIR/unix cd TCL_SRC_DIR/unix
2. Run the `configure` command, where `TCL_LIB_DIR` is `TCL_INSTALL_DIR/lib`. 2. Run the *configure* command:
configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR
For a 64 bit platform also add `--enable-64bit` option to the command line. For a 64 bit platform also add <i>--enable-64bit</i> option to the command line.
3. If the configure command has finished successfully, start the building process:
make
3. If the configure command has finished successfully, start the building process: 4. If building is finished successfully, start the installation of Tcl.
All binary and service files of the product will be copied to the directory defined by *TCL_INSTALL_DIR*
make make install
4. If the building has finished successfully, start the installation of Tk. **Installation from sources: Tk**
All binary and service files of the product will be copied
to the directory defined by `TK_INSTALL_DIR` (usually it is `TCL_INSTALL_DIR`) Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. Enter the unix sub-directory of the directory where the Tk source files are located <i>(TK_SRC_DIR)</i>
make install cd TK_SRC_DIR/unix
2. Run the configure command, where <i>TCL_LIB_DIR</i> is *TCL_INSTALL_DIR/lib*.
configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR
For a 64 bit platform also add <i>--enable-64bit</i> option to the command line.
3. If the configure command has finished successfully, start the building process:
make
4. If the building has finished successfully, start the installation of Tk.
All binary and service files of the product will be copied
to the directory defined by *TK_INSTALL_DIR* (usually it is *TCL_INSTALL_DIR*)
make install
@subsection dev_guides__building_3rdparty_linux_2_2 FreeType @subsection dev_guides__building_3rdparty_linux_2_2 FreeType
FreeType is required for text display in the 3D viewer. FreeType is required for text display in the 3D viewer.
Download the necessary archive from https://freetype.org/ and unpack it. Download the necessary archive from https://sourceforge.net/projects/freetype/files/ and unpack it.
1. Enter the directory where the source files of FreeType are located (`FREETYPE_SRC_DIR`). 1. Enter the directory where the source files of FreeType are located <i>(FREETYPE_SRC_DIR)</i>.
cd FREETYPE_SRC_DIR cd FREETYPE_SRC_DIR
2. Run the `configure` command: 2. Run the *configure* command:
configure --prefix=FREETYPE_INSTALL_DIR
configure --prefix=FREETYPE_INSTALL_DIR For a 64 bit platform also add <i>CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'</i> option to the command line.
3. If the *configure* command has finished successfully, start the building process:
For a 64 bit platform also add `CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'` option to the command line. make
3. If the `configure` command has finished successfully, start the building process: 4. If the building has finished successfully, start the installation of FreeType.
All binary and service files of the product will be copied to the directory defined by *FREETYPE_INSTALL_DIR*
make
make install
4. If the building has finished successfully, start the installation of FreeType.
All binary and service files of the product will be copied to the directory defined by `FREETYPE_INSTALL_DIR`
make install
@subsection dev_guides__building_3rdparty_linux_3_1 TBB @subsection dev_guides__building_3rdparty_linux_3_1 TBB
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb. This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
Go to the **Download** page, find the release version you need and pick the archive for Linux platform. Go to the **Download** page, find the release version you need and pick the archive for Linux platform.
To install, unpack the downloaded archive of TBB product. To install, unpack the downloaded archive of TBB product.
@subsection dev_guides__building_3rdparty_linux_3_3 FreeImage @subsection dev_guides__building_3rdparty_linux_3_3 FreeImage
Download the necessary archive from https://sourceforge.net/projects/freeimage/files/Source%20Distribution/ and unpack it. Download the necessary archive from https://sourceforge.net/projects/freeimage/files/Source%20Distribution/
The directory with unpacked sources is further referred to as `FREEIMAGE_SRC_DIR`. and unpack it. The directory with unpacked sources is further referred to as *FREEIMAGE_SRC_DIR*.
1. Modify *FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h*:
In line 60 insert the following:
1. Modify `FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h`:<br> #include string.h
In line 60 insert the following:
#include string.h 2. Enter the directory where the source files of FreeImage are located <i>(FREEIMAGE_SRC_DIR)</i>.
cd FREEIMAGE_SRC_DIR
2. Enter the directory where the source files of FreeImage are located (`FREEIMAGE_SRC_DIR`). 3. Run the building process
make
cd FREEIMAGE_SRC_DIR 4. Run the installation process
3. Run the building process a. If you have the permission to write into directories <i>/usr/include</i> and <i>/usr/lib</i>, run the following command:
make
4. Run the installation process
a. If you have the permission to write into directories `/usr/include` and `/usr/lib`, run the following command:
make install
b. If you do not have this permission, you need to modify file `FREEIMAGE_SRC_DIR/Makefile.gnu`:
make install
b. If you do not have this permission, you need to modify file *FREEIMAGE_SRC_DIR/Makefile.gnu*:
Change lines 7-9 from: Change lines 7-9 from:
DESTDIR ?= /
INCDIR ?= $(DESTDIR)/usr/include
INSTALLDIR ?= $(DESTDIR)/usr/lib
DESTDIR ?= / to:
INCDIR ?= $(DESTDIR)/usr/include
INSTALLDIR ?= $(DESTDIR)/usr/lib
DESTDIR ?= $(DESTDIR)
INCDIR ?= $(DESTDIR)/include
INSTALLDIR ?= $(DESTDIR)/lib
Change lines 65-67 from:
install -m 644 -o root -g root $(HEADER) $(INCDIR)
install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
to: to:
DESTDIR ?= $(DESTDIR) install -m 755 $(HEADER) $(INCDIR)
INCDIR ?= $(DESTDIR)/include install -m 755 $(STATICLIB) $(INSTALLDIR)
INSTALLDIR ?= $(DESTDIR)/lib
Change lines 65-67 from:
install -m 644 -o root -g root $(HEADER) $(INCDIR)
install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
to:
install -m 755 $(HEADER) $(INCDIR)
install -m 755 $(STATICLIB) $(INSTALLDIR)
install -m 755 $(SHAREDLIB) $(INSTALLDIR) install -m 755 $(SHAREDLIB) $(INSTALLDIR)
Change line 70 from: Change line 70 from: 
ldconfig ldconfig
to: to:
\#ldconfig \#ldconfig
Then run the installation process by the following command:
Then run the installation process by the following command: make DESTDIR=FREEIMAGE_INSTALL_DIR install
make DESTDIR=FREEIMAGE_INSTALL_DIR install
5. Clean temporary files 5. Clean temporary files
@@ -376,180 +415,214 @@ The directory with unpacked sources is further referred to as `FREEIMAGE_SRC_DI
@subsection dev_guides__building_3rdparty_linux_3_4 VTK @subsection dev_guides__building_3rdparty_linux_3_4 VTK
You can download VTK sources from https://www.vtk.org/VTK/resources/software.html
### The building procedure:
Download the necessary archive from https://www.vtk.org/VTK/resources/software.html and unpack it. Download the necessary archive from https://www.vtk.org/VTK/resources/software.html and unpack it.
1. Install or build `cmake` product from the source file. 1. Install or build *cmake* product from the source file.
2. Start `cmake` in GUI mode with the directory where the source files of *VTK* are located: 2. Start *cmake* in GUI mode with the directory where the source files of *VTK* are located:
ccmake VTK_SRC_DIR ccmake VTK_SRC_DIR
* Press `[c]` to make the initial configuration * Press <i>[c]</i> to make the initial configuration
* Define the necessary options in `VTK_INSTALL_PREFIX` * Define the necessary options in *VTK_INSTALL_PREFIX*
* Press `[c]` to make the final configuration * Press <i>[c]</i> to make the final configuration
* Press `[g]` to generate `Makefile` and exit * Press <i>[g]</i> to generate Makefile and exit
3. Start the building of VTK: 3. Start the building of VTK:
make make
4. Start the installation of VTK. Binaries will be installed according to the `VTK_INSTALL_PREFIX` option. 4. Start the installation of VTK. Binaries will be installed according to the *VTK_INSTALL_PREFIX* option.
make install make install
@subsection dev_guides__building_3rdparty_linux_4 Installation From Official Repositories
**Debian-based distributives**
All 3rd-party products required for building of OCCT could be installed
from official repositories. You may install them from console using apt-get utility:
sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libxt-dev libxmu-dev libxi-dev libgl1-mesa-dev libfreeimage-dev
Building is possible with C++ compliant compiler:
sudo apt-get install g++
@section build_3rdparty_macos Mac OS X @section build_3rdparty_macos Mac OS X
This section presents additional guidelines for building third-party products This document presents additional guidelines for building third-party products
used by Open CASCADE Technology and samples on Mac OS X platform (10.6.4 and later). used by Open CASCADE Technology and samples on Mac OS X platform (10.6.4 and later).
@subsection dev_guides__building_3rdparty_osx_2_1 Tcl/Tk The links for downloading the third-party products are available at https://opencascade.com/content/3rd-party-components.
Tcl/Tk is required for DRAW test harness. There are two types of third-party products, which are necessary to build OCCT:
* Mandatory products:
* Tcl/Tk 8.5 - 8.6;
* FreeType 2.4.10 - 2.5.3.
* Optional products:
* TBB 3.x - 4.x;
* FreeImage 3.14.1 - 3.16.0
**Installation from sources: Tcl** @subsection dev_guides__building_3rdparty_osx_2_1 Tcl/Tk 8.5
Tcl/Tk is required for DRAW test harness. Version 8.5 or 8.6 can be used with OCCT.
**Installation from sources: Tcl 8.5**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it. Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. Enter the `macosx` sub-directory of the directory where the Tcl source files are located (`TCL_SRC_DIR`). 1. Enter the *macosx* sub-directory of the directory where the Tcl source files are located <i>(TCL_SRC_DIR)</i>.
cd TCL_SRC_DIR/macosx cd TCL_SRC_DIR/macosx
2. Run the `configure` command 2. Run the *configure* command
configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR
For a 64 bit platform also add `--enable-64bit` option to the command line. For a 64 bit platform also add <i>--enable-64bit</i> option to the command line.
3. If the `configure` command has finished successfully, start the building process 3. If the *configure* command has finished successfully, start the building process
make make
4. If building is finished successfully, start the installation of Tcl.
All binary and service files of the product will be copied to the directory defined by *TCL_INSTALL_DIR*.
4. If building is finished successfully, start the installation of Tcl. make install
All binary and service files of the product will be copied to the directory defined by `TCL_INSTALL_DIR`.
make install **Installation from sources: Tk 8.5**
**Installation from sources: Tk**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it. Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. Enter the `macosx` sub-directory of the directory where the source files of Tk are located (`TK_SRC_DIR`). 1. Enter the *macosx* sub-directory of the directory where the source files of Tk are located <i>(TK_SRC_DIR)</i>.
cd TK_SRC_DIR/macosx cd TK_SRC_DIR/macosx
2. Run the `configure` command, where `TCL_LIB_DIR` is `TCL_INSTALL_DIR/lib` 2. Run the *configure* command, where TCL_LIB_DIR is TCL_INSTALL_DIR/lib
configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR
For a 64 bit platform also add `--enable-64bit` option to the command line. For a 64 bit platform also add <i>--enable-64bit</i> option to the command line.
3. If the `configure` command has finished successfully, start the building process: 3. If the *configure* command has finished successfully, start the building process:
make make
4. If the building has finished successfully, start the installation of Tk. 4. If the building has finished successfully, start the installation of Tk. All binary and service files of the product will be copied to the directory defined by *TK_INSTALL_DIR* (usually it is TCL_INSTALL_DIR)
All binary and service files of the product will be copied to the directory defined by `TK_INSTALL_DIR` (usually it is `TCL_INSTALL_DIR`).
make install make install
@subsection dev_guides__building_3rdparty_osx_2_2 FreeType @subsection dev_guides__building_3rdparty_osx_2_2 FreeType 2.4.10
FreeType is required for text display in the 3D viewer.
FreeType is required for text display in the 3D viewer. Download the necessary archive from https://sourceforge.net/projects/freetype/files/ and unpack it.
Download the necessary archive from https://freetype.org/ and unpack it.
1. Enter the directory where the source files of FreeType are located (`FREETYPE_SRC_DIR`). 1. Enter the directory where the source files of FreeType are located <i>(FREETYPE_SRC_DIR)</i>.
cd FREETYPE_SRC_DIR cd FREETYPE_SRC_DIR
2. Run the `configure` command 2. Run the *configure* command
configure --prefix=FREETYPE_INSTALL_DIR
configure --prefix=FREETYPE_INSTALL_DIR For a 64 bit platform also add <i>CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'</i> option to the command line.
For a 64 bit platform also add `CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'` option to the command line. 3. If the *configure* command has finished successfully, start the building process
3. If the `configure` command has finished successfully, start the building process make
make 4. If building has finished successfully, start the installation of FreeType.
All binary and service files of the product will be copied to the directory defined by *FREETYPE_INSTALL_DIR*.
4. If building has finished successfully, start the installation of FreeType. make install
All binary and service files of the product will be copied to the directory defined by `FREETYPE_INSTALL_DIR`.
@subsection dev_guides__building_3rdparty_osx_3_1 TBB 3.x or 4.x
make install This third-party product is installed with binaries from the archive
that can be downloaded from https://github.com/intel/tbb.
Go to the **Download** page, find the release version you need (e.g. *tbb30_018oss*)
and pick the archive for Mac OS X platform.
To install, unpack the downloaded archive of TBB 3.0 product (*tbb30_018oss_osx.tgz*).
@subsection dev_guides__building_3rdparty_osx_3_1 TBB @subsection dev_guides__building_3rdparty_osx_3_3 FreeImage 3.14.1 or 3.15.x
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb. Download the necessary archive from
Go to the **Download** page, find the release version you need (e.g. `tbb30_018oss`) and pick the archive for Mac OS X platform.
To install, unpack the downloaded archive of TBB product (`tbb30_018oss_osx.tgz`).
@subsection dev_guides__building_3rdparty_osx_3_3 FreeImage
Download the necessary archive from
https://sourceforge.net/projects/freeimage/files/Source%20Distribution/ https://sourceforge.net/projects/freeimage/files/Source%20Distribution/
and unpack it. The directory with unpacked sources is further referred to as `FREEIMAGE_SRC_DIR`. and unpack it. The directory with unpacked sources is further referred to as *FREEIMAGE_SRC_DIR*.
Note that for building FreeImage on Mac OS X 10.7 you should replace `Makefile.osx` Note that for building FreeImage on Mac OS X 10.7 you should replace *Makefile.osx*
in `FREEIMAGE_SRC_DIR` by the corrected file, which you can find in attachment to issue [`#22811`](https://tracker.dev.opencascade.org/file_download.php?file_id=6937&type=bug) in OCCT Mantis bug tracker. in *FREEIMAGE_SRC_DIR* by the corrected file, which you can find in attachment to issue #22811 in OCCT Mantis bug tracker
(https://tracker.dev.opencascade.org/file_download.php?file_id=6937&type=bug).
1. If you build FreeImage 3.15.x you can skip this step. 1. If you build FreeImage 3.15.x you can skip this step.
Modify <i>FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h:</i>
In line 60 insert the following:
Modify `FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h:`<br> #include string.h
In line 60 insert the following:
#include string.h Modify <i>FREEIMAGE_SRC_DIR/Source/FreeImage/PluginTARGA.cpp:</i>
In line 320 replace:
Modify `FREEIMAGE_SRC_DIR/Source/FreeImage/PluginTARGA.cpp`:<br> SwapShort(value);
In line 320 replace:
SwapShort(value); with:
with: SwapShort(&value);
SwapShort(&value); 2. Enter the directory where the source files of FreeImage are located <i>(FREEIMAGE_SRC_DIR)</i>.
2. Enter the directory where the source files of FreeImage are located (`FREEIMAGE_SRC_DIR`). cd FREEIMAGE_SRC_DIR
cd FREEIMAGE_SRC_DIR
3. Run the building process 3. Run the building process
make make
4. Run the installation process 4. Run the installation process
1. If you have the permission to write into <i>/usr/local/include</i> and <i>/usr/local/lib</i> directories, run the following command:
1. If you have the permission to write into `/usr/local/include` and `/usr/local/lib` directories, run the following command: make install
make install 2. If you do not have this permission, you need to modify file *FREEIMAGE_SRC_DIR/Makefile.osx*:
2. If you do not have this permission, you need to modify file `FREEIMAGE_SRC_DIR/Makefile.osx`:<br> Change line 49 from:   
Change line 49 from:
PREFIX ?= /usr/local PREFIX ?= /usr/local
to: to:
PREFIX ?= $(PREFIX)
PREFIX ?= $(PREFIX)   Change lines 65-69 from:
  Change lines 65-69 from: install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR)
install -m 644 -o root -g wheel $(HEADER) $(INCDIR)
install -m 644 -o root -g wheel $(SHAREDLIB) $(STATICLIB) $(INSTALLDIR)
ranlib -sf $(INSTALLDIR)/$(STATICLIB)
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)
to:
install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR) install -d $(INCDIR) $(INSTALLDIR)
install -m 644 -o root -g wheel $(HEADER) $(INCDIR) install -m 755 $(HEADER) $(INCDIR)
install -m 644 -o root -g wheel $(SHAREDLIB) $(STATICLIB) $(INSTALLDIR) install -m 755 $(STATICLIB) $(INSTALLDIR)
ranlib -sf $(INSTALLDIR)/$(STATICLIB) install -m 755 $(SHAREDLIB) $(INSTALLDIR)
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME) ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
to:
install -d $(INCDIR) $(INSTALLDIR)
install -m 755 $(HEADER) $(INCDIR)
install -m 755 $(STATICLIB) $(INSTALLDIR)
install -m 755 $(SHAREDLIB) $(INSTALLDIR)
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME) ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
Then run the installation process by the following command: Then run the installation process by the following command:
make PREFIX=FREEIMAGE_INSTALL_DIR install make PREFIX=FREEIMAGE_INSTALL_DIR install
5. Clean temporary files 5. Clean temporary files
make clean make clean

View File

@@ -3,25 +3,29 @@ Build OCCT {#build_upgrade__building_occt}
@tableofcontents @tableofcontents
Before building OCCT, make sure to have all required third-party libraries installed. @note Before building OCCT, make sure to have all required third-party libraries installed.
The list of required libraries depends on what OCCT modules will be used, and your preferences. The list of required libraries depends on what OCCT modules will be used, and your preferences.
The typical minimum is **FreeType** (necessary for Visualization) and **Tcl/Tk** (for DRAW). The typical minimum is **Freetype** (necessary for Visualization) and **Tcl/Tk** (for DRAW).
See @ref intro_req "requirements on 3rdparty libraries" for a full list. See @ref intro_req "requirements on 3rdparty libraries" for a full list.
On OS X we recommend to use native libraries.
The easiest way to install third-party libraries is to download archive with pre-built binaries, corresponding to your target configuration, @section build_occt_windows Windows
from [Development Portal](https://dev.opencascade.org/resources/download/3rd-party-components).
You can also build third-party libraries from their sources, see @ref build_upgrade_building_3rdparty for instructions.
On Linux and macOS we recommend to use libraries maintained by distributive developers, when possible. @subsection build_occt_win_cmake Building with CMake tool
@section build_occt_win_cmake Building with CMake tool This article describes the **CMake**-based build process, which is now suggested as a standard way to produce the binaries of Open CASCADE Technology from sources. *OCCT requires CMake version 2.8.12 or later*.
This chapter describes the [CMake](https://cmake.org/download/)-based build process, which is now suggested as a standard way to produce the binaries of Open CASCADE Technology from sources. Here we describe the build procedure on the example of Windows platform with Visual Studio 2010.
OCCT requires CMake version 2.8.12 or later. However, CMake is cross-platform and can be used to build OCCT on Linux and OS X in essentially the same way.
@note Before you start, make sure to have installed all 3-rd party products that you are going to use with OCCT; see @ref build_upgrade.
@subsubsection build_cmake_start Start CMake
CMake is a tool that generates the actual project files for the selected target build system (e.g. Unix makefiles) or IDE (e.g. Visual Studio 2010). CMake is a tool that generates the actual project files for the selected target build system (e.g. Unix makefiles) or IDE (e.g. Visual Studio 2010).
Here we describe the build procedure on the example of Windows platform with Visual Studio 2010.
However, CMake is cross-platform and can be used to build OCCT on Linux and macOS in essentially the same way. For unexperienced users we recommend to start with *cmake-gui* -- a cross-platform GUI tool provided by CMake on Windows, Mac and Linux.
A command-line alternative, *ccmake* can also be used.
CMake deals with three directories: source, build or binary and installation. CMake deals with three directories: source, build or binary and installation.
@@ -32,286 +36,272 @@ CMake deals with three directories: source, build or binary and installation.
The good practice is not to use the source directory as a build one. The good practice is not to use the source directory as a build one.
Different configurations should be built in different build directories to avoid conflicts. Different configurations should be built in different build directories to avoid conflicts.
It is however possible to choose one installation directory for several configurations of OCCT (differentiated by platform, bitness, compiler and build type), for example: It is however possible to choose one installation directory for several configurations of OCCT (differentiated by platform, bitness, compiler and build type), for example:
d:/occt/ -- the source directory
d:/tmp/occt-build-vc10-x64 -- the build directory with the generated
solution and other intermediate files created during a CMake tool working
d:/occt-install -- the installation directory that is
able to contain several OCCT configurations
d:/occt/ - the source directory @subsubsection build_cmake_conf Configuration process
d:/tmp/occt-build-vc10-x64 - the build directory with the generated
solution and other intermediate files created during a CMake tool working
d:/occt-install - the installation directory that is
able to contain several OCCT configurations
@subsection build_cmake_conf Configuration process If the command-line tool is used, run the tool from the build directory with a single argument indicating the source (relative or absolute path) directory:
For unexperienced users we recommend to start with *cmake-gui* -- a cross-platform GUI tool provided by CMake on Windows, Mac and Linux.
A command-line alternative, *ccmake* can also be used.
If the command-line tool is used, run the tool from the build directory with a single argument indicating the source (relative or absolute path) directory, and press *c* to configure:
cd d:/tmp/occt-build-vc10-x64 cd d:/tmp/occt-build-vc10-x64
ccmake d:/occt ccmake d:/occt
@figure{/build/build_occt/images/cmake_image000.png} @figure{/build/build_occt/images/cmake_image000.png}
If the GUI tool is used, run this tool without additional arguments and after that specify the source directory by clicking **Browse Source** and the build (binary) one by clicking **Browse Build**: Press *c* to configure.
All actions required in the configuration process with the GUI tool will be described below.
If the GUI tool is used, run this tool without additional arguments and after that specify the source directory by clicking **Browse Source** and the build (binary) one by clicking **Browse Build**.
@figure{/build/build_occt/images/cmake_image001.png} @figure{/build/build_occt/images/cmake_image001.png}
@note Each configuration of the project should be built in its own directory. **Note**: Each configuration of the project should be built in its own directory. When building multiple configurations it is recommended to indicate in the name of build directories the system, bitness and compiler (e.g., <i>d:/occt/build/win32-vc10</i> ).
When building multiple configurations it is suggested to indicate in the name of build directories the system, bitness and compiler (e.g., <i>d:/occt/build/win32-vc10</i>).
Once the source and build directories are selected, "Configure" button should be pressed in order to start manual configuration process. Once the source and build directories are selected, "Configure" button should be pressed in order to start manual configuration process. It begins with selection of a target configurator. It is "Visual Studio 10 2010 Win64" in our example.
It begins with selection of a target configurator. It is "Visual Studio 10 2010 Win64" in our example.
@figure{/build/build_occt/images/cmake_image002.png} @figure{/build/build_occt/images/cmake_image002.png}
@note To build OCCT for **Universal Windows Platform (UWP)** specify the path to toolchain file for cross-compiling <i>d:/occt/adm/templates/uwp.toolchain.config.cmake</i>. To build OCCT for **Universal Windows Platform (UWP)** specify the path to toolchain file for cross-compiling <i>d:/occt/adm/templates/uwp.toolchain.config.cmake</i>.
Alternatively, if you are using CMake from the command line add options `-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0`.
Universal Windows Platform (UWP) is supported only on "Visual Studio 14 2015".
File `CASROOT/samples/xaml/ReadMe.md` describes the building procedure of XAML (UWP) sample.
Once "Finish" button is pressed, the first pass of the configuration process is executed. Alternatively, if you are using CMake from the command line add options -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 .
At the end of the process, CMake outputs the list of environment variables, which have to be properly specified for successful configuration.
**Note**: Universal Windows Platform (UWP) is supported only on "Visual Studio 14 2015". File <i>d:/occt/samples/xaml/ReadMe.md</i> describes the building procedure of XAML (UWP) sample.
Once "Finish" button is pressed, the first pass of the configuration process is executed. At the end of the process, CMake outputs the list of environment variables, which have to be properly specified for successful configuration.
@figure{/build/build_occt/images/cmake_image003.png} @figure{/build/build_occt/images/cmake_image003.png}
The error message provides some information about these variables. The error message provides some information about these variables. This message will appear after each pass of the process until all required variables are specified correctly.
This message will appear after each pass of the process until all required variables are specified correctly.
The change of the state of some variables can lead to the appearance of new variables. The change of the state of some variables can lead to the appearance of new variables. The new variables appeared after the pass of the configuration process are highlighted with red color by CMake GUI tool.
The new variables appeared after the pass of the configuration process are highlighted with red color by CMake GUI tool.
@note There is "grouped" option, which groups variables with a common prefix. Note: There is "grouped" option, which groups variables with a common prefix.
The following table gives the full list of environment variables used at the configuration stage: The following table gives the full list of environment variables used at the configuration stage:
| Variable | Type | Purpose | | Variable | Type | Purpose |
|----------|------|---------| |----------|------|---------|
| CMAKE_BUILD_TYPE | String | Specifies the build type on single-configuration generators (such as make). Possible values are Debug, Release and RelWithDebInfo | | CMAKE_BUILD_TYPE | String | Specifies the build type on single-configuration generators (such as make). Possible values are Debug, Release and RelWithDebInfo |
| USE_FREETYPE | Boolean | Indicates whether FreeType product should be used in OCCT for text rendering | | USE_FREEIMAGE | Boolean flag | Indicates whether FreeImage product should be used in OCCT visualization module for support of popular graphics image formats (PNG, BMP, etc.) |
| USE_FREEIMAGE | Boolean | Indicates whether FreeImage product should be used in OCCT visualization module for support of popular graphics image formats (PNG, BMP, etc.) | | USE_RAPIDJSON | Boolean flag | Indicates whether RapidJSON product should be used in OCCT Data Exchange module for support of glTF mesh file format |
| USE_OPENVR | Boolean | Indicates whether OpenVR product should be used in OCCT visualization module for support of Virtual Reality | | USE_TBB | Boolean flag | Indicates whether TBB 3rd party is used or not. TBB stands for Threading Building Blocks, the technology of Intel Corp, which comes with different mechanisms and patterns for injecting parallelism into your application. OCCT remains parallel even without TBB product |
| USE_OPENGL | Boolean | Indicates whether TKOpenGl graphic driver using OpenGL library (desktop) should be built within OCCT visualization module | | USE_VTK | Boolean flag | Indicates whether VTK 3rd party is used or not. VTK stands for Visualization ToolKit, the technology of Kitware Inc intended for general-purpose scientific visualization. OCCT comes with a bridge between CAD data representation and VTK by means of its dedicated VIS component (VTK Integration Services). You may skip this 3rd party unless you are planning to use VTK visualization for OCCT geometry. See the official documentation @ref occt_user_guides__vis for the details on VIS |
| USE_GLES2 | Boolean | Indicates whether TKOpenGles graphic driver using OpenGL ES library (embedded OpenGL) should be built within OCCT visualization module |
| USE_RAPIDJSON | Boolean | Indicates whether RapidJSON product should be used in OCCT Data Exchange module for support of glTF mesh file format |
| USE_DRACO | Boolean | Indicates whether Draco product should be used in OCCT Data Exchange module for support of Draco compression in glTF mesh file format |
| USE_TK | Boolean | Indicates whether Tcl/Tk product should be used in OCCT Draw Harness module for user interface (in addition to Tcl, which is mandatory for Draw Harness) |
| USE_TBB | Boolean | Indicates whether TBB (Threading Building Blocks) 3rd party is used or not. Note that OCCT remains parallel even without TBB product |
| USE_VTK | Boolean | Indicates whether VTK 3rd party is used or not. OCCT comes with a bridge between CAD data representation and VTK by means of its dedicated VIS component (VTK Integration Services). You may skip this 3rd party unless you are planning to use VTK visualization for OCCT geometry. See the official documentation @ref occt_user_guides__vis for the details on VIS |
| 3RDPARTY_DIR | Path | Defines the root directory where all required 3rd party products will be searched. Once you define this path it is very convenient to click "Configure" button in order to let CMake automatically detect all necessary products| | 3RDPARTY_DIR | Path | Defines the root directory where all required 3rd party products will be searched. Once you define this path it is very convenient to click "Configure" button in order to let CMake automatically detect all necessary products|
| 3RDPARTY_FREETYPE_* | Path | Path to FreeType binaries | | 3RDPARTY_FREETYPE_* | Path | Path to Freetype binaries |
| 3RDPARTY_TCL_* 3RDPARTY_TK_* | Path | Path to Tcl/Tk binaries | | 3RDPARTY_TCL_* 3RDPARTY_TK_* | Path | Path to Tcl/Tk binaries |
| 3RDPARTY_FREEIMAGE* | Path | Path to FreeImage binaries | | 3RDPARTY_FREEIMAGE* | Path | Path to Freeimage binaries |
| 3RDPARTY_TBB* | Path | Path to TBB binaries | | 3RDPARTY_TBB* | Path | Path to TBB binaries |
| 3RDPARTY_VTK_* | Path | Path to VTK binaries | | 3RDPARTY_VTK_* | Path | Path to VTK binaries |
| BUILD_MODULE_<MODULE>| Boolean | Indicates whether the corresponding OCCT module should be built or not. It should be noted that some toolkits of a module can be built even if this module is not checked (this happens if some other modules depend on these toolkits). The main modules and their descriptions can be found in @ref user_guides | | BUILD_MODULE_<MODULE>| Boolean flag | Indicates whether the corresponding OCCT module should be built or not. It should be noted that some toolkits of a module can be built even if this module is not checked (this happens if some other modules depend on these toolkits). The main modules and their descriptions can be found in @ref user_guides |
| BUILD_LIBRARY_TYPE | String | Specifies the type of library to be created. "Shared" libraries are linked dynamically and loaded at runtime. "Static" libraries are archives of object files used when linking other targets. Note that Draw Harness plugin system is incompatible with "Static" builds, and therefore it is disabled for these builds.| | BUILD_LIBRARY_TYPE | String | Specifies the type of library to be created. "Shared" libraries are linked dynamically and loaded at runtime. "Static" libraries are archives of object files used when linking other targets. Note that Draw Harness plugin system is incompatible with "Static" builds, and therefore it is disabled for these builds.|
| BUILD_ADDITIONAL_TOOLKITS | String | Semicolon-separated individual toolkits to include into build process. If you want to build some particular libraries (toolkits) only, then you may uncheck all modules in the corresponding *BUILD_MODUE_\<MODULE\>* options and provide the list of necessary libraries here. Of course, all dependencies will be resolved automatically | | BUILD_ADDITIONAL_TOOLKITS | String | Semicolon-separated individual toolkits to include into build process. If you want to build some particular libraries (toolkits) only, then you may uncheck all modules in the corresponding *BUILD_MODUE_\<MODULE\>* options and provide the list of necessary libraries here. Of course, all dependencies will be resolved automatically |
| BUILD_YACCLEX | Boolean | Enables Flex/Bison lexical analyzers. OCCT source files relating to STEP reader and ExprIntrp functionality are generated automatically with Flex/Bison. Checking this option leads to automatic search of Flex/Bison binaries and regeneration of the mentioned files | | BUILD_YACCLEX | Boolean flag | Enables Flex/Bison lexical analyzers. OCCT source files relating to STEP reader and ExprIntrp functionality are generated automatically with Flex/Bison. Checking this option leads to automatic search of Flex/Bison binaries and regeneration of the mentioned files |
| BUILD_SAMPLES_MFC | Boolean | Indicates whether MFC samples should be built together with OCCT. This option is only relevant to Windows platforms | | BUILD_SAMPLES_MFC | Boolean flag | Indicates whether MFC samples should be built together with OCCT. This option is only relevant to Windows platforms |
| BUILD_SAMPLES_QT | Boolean | Indicates whether QT samples should be built together with OCCT. | | BUILD_SAMPLES_QT | Boolean flag | Indicates whether QT samples should be built together with OCCT. |
| BUILD_Inspector | Boolean | Indicates whether Inspector should be built together with OCCT. | | BUILD_Inspector | Boolean flag | Indicates whether Inspector should be built together with OCCT. |
| BUILD_DOC_Overview | Boolean | Indicates whether OCCT overview documentation project should be created together with OCCT. It is not built together with OCCT. Checking this option leads to automatic search of Doxygen binaries. Its building calls Doxygen command to generate the documentation in HTML format | | BUILD_DOC_Overview | Boolean flag | Indicates whether OCCT overview documentation project should be created together with OCCT. It is not built together with OCCT. Checking this option leads to automatic search of Doxygen binaries. Its building calls Doxygen command to generate the documentation in HTML format |
| BUILD_PATCH | Path | Points to the directory recognized as a "patch" for OCCT. If specified, the files from this directory take precedence over the corresponding native OCCT sources. This way you are able to introduce patches to Open CASCADE Technology not affecting the original source distribution | | BUILD_PATCH | Path | Points to the directory recognized as a "patch" for OCCT. If specified, the files from this directory take precedence over the corresponding native OCCT sources. This way you are able to introduce patches to Open CASCADE Technology not affecting the original source distribution |
| BUILD_WITH_DEBUG | Boolean | Enables extended messages of many OCCT algorithms, usually printed to cout. These include messages on internal errors and special cases encountered, timing, etc. | | BUILD_WITH_DEBUG | Boolean flag | Enables extended messages of many OCCT algorithms, usually printed to cout. These include messages on internal errors and special cases encountered, timing, etc. |
| BUILD_ENABLE_FPE_SIGNAL_HANDLER | Boolean | Enable/Disable the floating point exceptions (FPE) during DRAW execution only. Corresponding environment variable (CSF_FPE) can be changed manually in custom.bat/sh scripts without regeneration by CMake. | | BUILD_ENABLE_FPE_SIGNAL_HANDLER | Boolean flag | Enable/Disable the floating point exceptions (FPE) during DRAW execution only. Corresponding environment variable (CSF_FPE) can be changed manually in custom.bat/sh scripts without regeneration by CMake. |
| CMAKE_CONFIGURATION_TYPES | String | Semicolon-separated CMake configurations | | CMAKE_CONFIGURATION_TYPES | String | Semicolon-separated CMake configurations |
| INSTALL_DIR | Path | Points to the installation directory. *INSTALL_DIR* is a synonym of *CMAKE_INSTALL_PREFIX*. The user can specify both *INSTALL_DIR* or *CMAKE_INSTALL_PREFIX* | | INSTALL_DIR | Path | Points to the installation directory. *INSTALL_DIR* is a synonym of *CMAKE_INSTALL_PREFIX*. The user can specify both *INSTALL_DIR* or *CMAKE_INSTALL_PREFIX* |
| INSTALL_DIR_BIN | Path | Relative path to the binaries installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_BIN}) | | INSTALL_DIR_BIN | Path | Relative path to the binaries installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_BIN}) |
| INSTALL_DIR_SCRIPT | Path | Relative path to the scripts installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}) | | INSTALL_DIR_SCRIPT | Path | Relative path to the scripts installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}) |
| INSTALL_DIR_LIB | Path | Relative path to the libraries installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_LIB}) | | INSTALL_DIR_LIB | Path | Relative path to the libraries installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_LIB}) |
| INSTALL_DIR_INCLUDE | Path | Relative path to the includes installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_INCLUDE}) | | INSTALL_DIR_INCLUDE | Path | Relative path to the includes installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_INCLUDE}) |
| INSTALL_DIR_RESOURCE | Path | Relative path to the resources installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}) | | INSTALL_DIR_RESOURCE | Path | Relative path to the resources installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}) |
| INSTALL_DIR_LAYOUT | String | Defines the structure of OCCT files (binaries, resources, headers, etc.) for the install directory. Two variants are predefined: for Windows (standard OCCT layout) and for Unix operating systems (standard Linux layout). If needed, the layout can be customized with INSTALL_DIR_* variables | | INSTALL_DIR_LAYOUT | String | Defines the structure of OCCT files (binaries, resources, headers, etc.) for the install directory. Two variants are predefined: for Windows (standard OCCT layout) and for Unix operating systems (standard Linux layout). If needed, the layout can be customized with INSTALL_DIR_* variables |
| INSTALL_DIR_DATA | Path | Relative path to the data files installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_DATA}) | | INSTALL_DIR_DATA | Path | Relative path to the data files installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_DATA}) |
| INSTALL_DIR_SAMPLES | Path | Relative path to the samples installation directory. Note that only "samples/tcl" folder will be installed. (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}) | | INSTALL_DIR_SAMPLES | Path | Relative path to the samples installation directory. Note that only "samples/tcl" folder will be installed. (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}) |
| INSTALL_DIR_TESTS | Path | Relative path to the tests installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_TESTS}) | | INSTALL_DIR_TESTS | Path | Relative path to the tests installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_TESTS}) |
| INSTALL_DIR_DOC | Path | Relative path to the documentation installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_DOC}) | | INSTALL_DIR_DOC | Path | Relative path to the documentation installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_DOC}) |
| INSTALL_FREETYPE | Boolean | Indicates whether FreeType binaries should be installed into the installation directory | | INSTALL_FREETYPE | Boolean flag | Indicates whether Freetype binaries should be installed into the installation directory |
| INSTALL_FREEIMAGE | Boolean | Indicates whether FreeImage binaries should be installed into the installation directory | | INSTALL_FREEIMAGE* | Boolean flag | Indicates whether Freeimage binaries should be installed into the installation directory |
| INSTALL_TBB | Boolean | Indicates whether TBB binaries should be installed into the installation directory | | INSTALL_TBB | Boolean flag | Indicates whether TBB binaries should be installed into the installation directory |
| INSTALL_VTK | Boolean | Indicates whether VTK binaries should be installed into the installation directory | | INSTALL_VTK | Boolean flag | Indicates whether VTK binaries should be installed into the installation directory |
| INSTALL_TCL | Boolean | Indicates whether TCL binaries should be installed into the installation directory | | INSTALL_TCL | Boolean flag | Indicates whether TCL binaries should be installed into the installation directory |
| INSTALL_TEST_CASES | Boolean | Indicates whether non-regression OCCT test scripts should be installed into the installation directory | | INSTALL_TEST_CASES | Boolean flag | Indicates whether non-regression OCCT test scripts should be installed into the installation directory |
| INSTALL_DOC_Overview | Boolean | Indicates whether OCCT overview documentation should be installed into the installation directory | | INSTALL_DOC_Overview | Boolean flag | Indicates whether OCCT overview documentation should be installed into the installation directory |
@note Only the forward slashes ("/") are acceptable in the CMake options defining paths. **Note:** Only the forward slashes ("/") are acceptable in the CMake options defining paths.
@subsubsection build_cmake_3rdparty 3rd party search mechanism @subsubsection build_cmake_3rdparty 3rd party search mechanism
If `3RDPARTY_DIR` directory is defined, then required 3rd party binaries are sought in it, and default system folders are ignored. If *3RDPARTY_DIR* directory is defined, then required 3rd party binaries are sought in it, and default system folders are ignored.
The procedure expects to find binary and header files of each 3rd party product in its own sub-directory: *bin*, *lib* and *include*. The procedure expects to find binary and header files of each 3rd party product in its own sub-directory: *bin*, *lib* and *include*.
The results of the search (achieved on the next pass of the configuration process) are recorded in the corresponding variables: The results of the search (achieved on the next pass of the configuration process) are recorded in the corresponding variables:
* `3RDPARTY_<PRODUCT>_DIR` -- path to the 3rdparty directory (with directory name) (e.g. <i>D:/3rdparty/tcltk-86-32</i>); * *3RDPARTY_\<PRODUCT\>_DIR* -- path to the 3rdparty directory (with directory name) (e.g. <i>D:/3rdparty/tcltk-86-32</i>)
* `3RDPARTY_<PRODUCT>_LIBRARY_DIR` -- path to the directory containing a library (e.g. <i>D:/3rdparty/tcltk-86-32/lib</i>); * *3RDPARTY_\<PRODUCT\>_LIBRARY_DIR* -- path to the directory containing a library (e.g. <i>D:/3rdparty/tcltk-86-32/lib</i>).
* `3RDPARTY_<PRODUCT>_INCLUDE_DIR` -- path to the directory containing a header file (e.g., <i>D:/3rdparty/tcltk-86-32/include</i>); * *3RDPARTY_\<PRODUCT\>_INCLUDE_DIR* -- path to the directory containing a header file (e.g., <i>D:/3rdparty/tcltk-86-32/include</i>)
* `3RDPARTY_<PRODUCT>_DLL_DIR` -- path to the directory containing a shared library (e.g., <i>D:/3rdparty/tcltk-86-32/bin</i>) This variable is only relevant to Windows platforms. * *3RDPARTY_\<PRODUCT\>_DLL_DIR* -- path to the directory containing a shared library (e.g., <i>D:/3rdparty/tcltk-86-32/bin</i>) This variable is only relevant to Windows platforms.
@note Each library and include directory should be children of the product directory if the last one is defined. Note: each library and include directory should be children of the product directory if the last one is defined.
The search process is as follows: The search process is as follows:
1. Common path: `3RDPARTY_DIR` 1. Common path: *3RDPARTY_DIR*
2. Path to a particular 3rd-party library: `3RDPARTY_<PRODUCT>_DIR` 2. Path to a particular 3rd-party library: *3RDPARTY_\<PRODUCT\>_DIR*
3. Paths to headers and binaries: 3. Paths to headers and binaries:
1. `3RDPARTY_<PRODUCT>_INCLUDE_DIR` 1. *3RDPARTY_\<PRODUCT\>_INCLUDE_DIR*
2. `3RDPARTY_<PRODUCT>_LIBRARY_DIR` 2. *3RDPARTY_\<PRODUCT\>_LIBRARY_DIR*
3. `3RDPARTY_<PRODUCT>_DLL_DIR` 3. *3RDPARTY_\<PRODUCT\>_DLL_DIR*
If a variable of any level is not defined (empty or `<variable name>-NOTFOUND`) and the upper level variable is defined, the content of the non-defined variable will be sought at the next configuration step. If a variable of any level is not defined (empty or <i> \<variable name\>-NOTFOUND </i>) and the upper level variable is defined, the content of the non-defined variable will be sought at the next configuration step. If the search process at level 3 does not find the required files, it seeks in default places.
If the search process at level 3 does not find the required files, it seeks in default places.
If a search result (include path, or library path, or dll path) does not meet your expectations, you can change `3RDPARTY_<PRODUCT>_*_DIR` variable, If a search result (include path, or library path, or dll path) does not meet your expectations, you can change *3RDPARTY_\<PRODUCT\>_*_DIR variable*, clear (if they are not empty) *3RDPARTY_\<PRODUCT\>_DLL_DIR, 3RDPARTY_\<PRODUCT\>_INCLUDE_DIR* and 3RDPARTY_\<PRODUCT\>_LIBRARY_DIR variables (or clear one of them) and run the configuration process again.
clear (if they are not empty) `3RDPARTY_<PRODUCT>_DLL_DIR`, `3RDPARTY_<PRODUCT>_INCLUDE_DIR` and `3RDPARTY_<PRODUCT>_LIBRARY_DIR` variables (or clear one of them) and run the configuration process again.
At this time the search will be performed in the newly identified directory and the result will be recorded to corresponding variables (replace old value if it is necessary). At this time the search will be performed in the newly identified directory
For example, `3RDPARTY_FREETYPE_DIR` variable and the result will be recorded to corresponding variables (replace old value if it is necessary).
For example, *3RDPARTY_FREETYPE_DIR* variable
d:/3rdparty/freetype-2.4.10 d:/3rdparty/freetype-2.4.10
can be changed to can be changed to
d:/3rdparty/freetype-2.5.3 d:/3rdparty/freetype-2.5.3
During the configuration process the related variables (`3RDPARTY_FREETYPE_DLL_DIR`, `3RDPARTY_FREETYPE_INCLUDE_DIR` and `3RDPARTY_FREETYPE_LIBRARY_DIR`) will be filled with new found values. During the configuration process the related variables (*3RDPARTY_FREETYPE_DLL_DIR*, *3RDPARTY_FREETYPE_INCLUDE_DIR* and *3RDPARTY_FREETYPE_LIBRARY_DIR*) will be filled with new found values.
@note The names of searched libraries and header files are hard-coded. **Note**: The names of searched libraries and header files are hard-coded. If there is the need to change their names, change appropriate cmake variables (edit CMakeCache.txt file or edit in cmake-gui in advance mode) without reconfiguration: *3RDPARTY_\<PRODUCT\>_INCLUDE* for include, *3RDPARTY_\<PRODUCT\>_LIB* for library and *3RDPARTY_\<PRODUCT\>_DLL* for shared library.
If there is the need to change their names, change appropriate CMake variables (edit CMakeCache.txt file or edit in cmake-gui in advance mode) without reconfiguration:
`3RDPARTY_<PRODUCT>_INCLUDE` for include, `3RDPARTY_<PRODUCT>_LIB` for library and `3RDPARTY_<PRODUCT>_DLL` for shared library.
@subsection build_cmake_gen Projects generation @subsubsection build_cmake_gen Projects generation
Once the configuration process is done, the "Generate" button is used to prepare project files for the target IDE. Once the configuration process is done, the "Generate" button is used to prepare project files for the target IDE.
In our exercise the Visual Studio solution will be automatically created in the build directory. In our exercise the Visual Studio solution will be automatically created in the build directory.
@subsection build_cmake_build Building @subsubsection build_cmake_build Building
Go to the build folder, start the Visual Studio solution *OCCT.sln* and build it by clicking **Build -> Build Solution**. Go to the build folder, start the Visual Studio solution *OCCT.sln* and build it by clicking **Build -> Build Solution**.
@figure{/build/build_occt/images/cmake_image004.png} @figure{/build/build_occt/images/cmake_image004.png}
By default, the build solution process skips the building of the INSTALL and Overview projects. By default the build solution process skips the building of the INSTALL and Overview project.
When the building process is finished build: When the building process is finished build:
* *Overview* project to generate OCCT overview documentation (if `BUILD_DOC_Overview` variable is checked) * Overview project to generate OCCT overview documentation (if BUILD_DOC_Overview variable is checked)
* the *INSTALL* project to run the **installation process** * the *INSTALL* project to run **the installation process**
For this, right-click on the *Overview/INSTALL* project and select **Project Only -> Build Only** -> *Overview/INSTALL* in the solution explorer. For this, right-click on the *Overview/INSTALL* project and select **Project Only -> Build Only** -> *Overview/INSTALL* in the solution explorer.
@subsection build_cmake_install Installation @subsubsection build_cmake_install Installation
Installation is a process of extracting redistributable resources (binaries, include files etc) from the build directory into the installation one. Installation is a process of extracting redistributable resources (binaries, include files etc) from the build directory into the installation one. The installation directory will be free of project files, intermediate object files and any other information related to the build routines.
The installation directory will be free of project files, intermediate object files and any other information related to the build routines.
Normally you use the installation directory of OCCT to link against your specific application.
Normally you use the installation directory of OCCT to link against your specific application.
The directory structure is as follows: The directory structure is as follows:
data -- data files for OCCT (brep, iges, stp)
doc -- OCCT overview documentation in HTML format
inc -- header files
samples -- samples
src -- all required source files for OCCT
tests -- OCCT test suite
win32\vc10\bind -- binary files (installed 3rdparties and occt)
\libd -- libraries (installed 3rdparties and occt)
data - data files for OCCT (brep, iges, stp) **Note:** The above example is given for debug configuration. However, it is generally safe to use the same installation directory for the release build. In the latter case the contents of install directory will be enriched with subdirectories and files related to the release configuration. In particular, the binaries directory win64 will be expanded as
doc - OCCT overview documentation in HTML format follows:
inc - header files
samples - samples
src - all required source files for OCCT
tests - OCCT test suite
win32\vc10\bind - binary files (installed 3rdparties and occt)
\libd - libraries (installed 3rdparties and occt)
@note The above example is given for debug configuration.
However, it is generally safe to use the same installation directory for the release build.
In the latter case the contents of install directory will be enriched with subdirectories and files related to the release configuration.
In particular, the binaries directory win64 will be expanded as follows:
\win32\vc10\bind \win32\vc10\bind
\libd \libd
\bin \bin
\lib \lib
If CMake installation flags are enabled for the 3rd party products (e.g. `INSTALL_FREETYPE`), then the corresponding binaries will be copied to the same bin(d) and lib(d) directories together with the native binaries of OCCT. If CMake installation flags are enabled for the 3rd party products (e.g. INSTALL_FREETYPE), then the corresponding binaries will be copied to the same bin(d) and lib(d) directories together with the native binaries of OCCT. Such organization of libraries can be especially helpful if your OCCT-based software does not use itself the 3rd parties of Open CASCADE Technology (thus, there is no sense to pack them into dedicated directories).
Such organization of libraries can be especially helpful if your OCCT-based software does not use itself the 3rd parties of Open CASCADE Technology (thus, there is no sense to pack them into dedicated directories).
The installation folder contains the scripts to run *DRAWEXE* (*draw.bat* or *draw.sh*), samples (if they were installed) and overview.html (short-cut for installed OCCT overview documentation). The installation folder contains the scripts to run *DRAWEXE* (*draw.bat* or *draw.sh*), samples (if they were installed) and overview.html (short-cut for installed OCCT overview documentation).
@subsection build_occt_crossplatform_cmake Cross-compiling (Android) @subsection build_occt_win_codeblocks Building with Code::Blocks
This section describes the steps to build OCCT libraries for Android from a complete source package with GNU make (makefiles). This file describes steps to build OCCT libraries from sources using **Code::Blocks**, a cross-platform IDE, using project files generated by OCCT legacy tool **genproj**.
The steps on Windows 7 and Ubuntu 15.10 are similar. There is the only one difference: makefiles are built with mingw32-make on Windows and native GNU make on Ubuntu. It can be used as an alternative to CMake build system (see @ref build_occt_win_cmake) for all supported platforms.
Required tools (download and install if it is required): @subsubsection build_codeblocks_3rdparty Third-party libraries
- CMake 3.0+
- [Cross-compilation toolchain for CMake](https://github.com/taka-no-me/android-cmake)
- [Android NDK r12+](https://developer.android.com/ndk/downloads)
- GNU Make: MinGW v4.82+ for [Windows](https://www.mingw-w64.org/), GNU Make 4.0 for Ubuntu.
Run GUI tool provided by CMake and: Before building OCCT, make sure to have all the needed third-party libraries installed, see @ref build_upgrade.
- Specify the root folder of OCCT (`$CASROOT`, which contains *CMakelists.txt* file) by clicking **Browse Source**.
- Specify the location (build folder) for CMake generated project files by clicking **Browse Build**.
@figure{/build/build_occt/images/android_image001.png} @subsubsection build_codeblocks_conf Configuration
Click **Configure** button. It opens the window with a drop-down list of generators supported by CMake project. Before building it is necessary to set up build environment.
Select "MinGW MakeFiles" item from the list
- Choose "Specify toolchain file for cross-compiling", and click "Next".
@figure{/build/build_occt/images/android_image002.png}
- Specify a toolchain file at the next dialog to `android.toolchain.cmake`, and click "Finish". The environment is defined in the file *custom.sh* (on Linux and OS X) or *custom.bat* (on Windows) which can be edited directly:
@figure{/build/build_occt/images/android_image003.png}
If `ANDROID_NDK` environment variable is not defined in current OS, add cache entry `ANDROID_NDK` (entry type is `PATH`) -- path to the NDK folder ("Add Entry" button): * Add paths to includes of used third-party libraries in variable *CSF_OPT_INC*.
@figure{/build/build_occt/images/android_image004.png} * Add paths to their binary libraries in variable *CSF_OPT_LIB64*.
* Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
If on Windows the message is appeared:
"CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles" CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.",
specify `CMAKE_MAKE_PROGRAM` to mingw32-make executable.
@figure{/build/build_occt/images/android_image005.png}
How to configure OCCT, see @ref build_cmake_conf "Configure" section taking into account the specific configuration variables for Android:
- `ANDROID_ABI` = `armeabi-v7a`
- `ANDROID_NATIVE_API_LEVEL` = `15`
- `ANDROID_NDK_LAYOUT` is equal to `CMAKE_BUILD_TYPE` variable
- `BUILD_MODULE_Draw` = `OFF`
@figure{/build/build_occt/images/android_image006.png}
Click **Generate** button and wait until the generation process is finished.
Then makefiles will appear in the build folder (e.g. <i> D:/tmp/occt-android </i>).
Open console and go to the build folder. Type "mingw32-make" (Windows) or "make" (Ubuntu) to start build process:
> mingw32-make
or
> make
Parallel building can be started with using `-jN` argument of "mingw32-make/make", where `N` is the number of building threads:
> mingw32-make -j4
or
> make -j4
Type "mingw32-make/make" with argument "install" to place the libraries to the install folder:
> mingw32-make install
or
> make install
@section build_occt_genproj Building with Genproj tool
**genproj** is a legacy tool (originated from command "wgenproj" in WOK) for generation of Visual Studio, Code::Blocks, Qt Creator (qmake), and XCode project files for building Open CASCADE Technology.
These project files are placed inside OCCT directory (in *adm* subfolder) and use relative paths, thus can be moved together with sources.
The project files included in official distribution of OCCT are generated by this tool.
@note If you have official distribution with project files included, you can use them directly without a need to call **genproj**.
**genproj** is a less flexible alternative to use of CMake build system (see @ref build_occt_win_cmake), but still has some small features useful for OCCT development.
@subsection build_genproj Configuration process
The environment is defined in the file *custom.sh* (on Linux and macOS) or *custom.bat* (on Windows) which can be edited directly:
* `ARCH` -- architecture (32 or 64), affects only `PATH` variable for execution
* `HAVE_*` -- flags to enable or disable use of optional third-party products
* `CSF_OPT_*` -- paths to search for includes and binaries of all used third-party products
* `SHORTCUT_HEADERS` -- defines method for population of folder *inc* by header files. Supported methods are:
* *Copy* - headers will be copied from *src*; * *Copy* - headers will be copied from *src*;
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*; * *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
* *HardLink* - hard links to headers located in *src* will be created. * "HardLink* - hard links to headers located in *src* will be created.
* `VCVER` -- specification of format of project files, defining also version of Visual Studio to be used, and default name of the sub-folder for binaries: * For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
* Add paths to includes of used third-party libraries in variable `CSF_OPT_INC`. ~~~~~
* Add paths to their binary libraries in variable `CSF_OPT_LIB64`. export HAVE_FREEIMAGE=false
* For optional third-party libraries, set corresponding environment variable `HAVE_<LIBRARY_NAME>` to either *false*, e.g. `export HAVE_FREEIMAGE=false`. ~~~~~
Alternatively, or when *custom.sh* or *custom.bat* does not exist, you can launch **genconf** tool to configure environment interactively:
@figure{/build/build_occt/images/genconf_linux.png}
Click "Save" to store the specified configuration in *custom.sh* or *custom.bat* file.
@subsubsection build_codeblocks_gen Projects generation
Launch **genproj** tool with option *cbp* to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files:
~~~~~
$ cd /dev/OCCT/opencascade-7.0.0
$ ./genproj cbp
~~~~~
The generated Code::Blocks project are placed into subfolder *adm/&lt;OS&gt;/cbp*.
@note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH.
@subsubsection build_codeblocks_build Building
To start **Code::Blocks**, launch script *codeblocks.sh*.
To build all toolkits, click **Build->Build workspace** in the menu bar.
To start *DRAWEXE*, which has been built with **Code::Blocks** on Mac OS X, run the script
~~~~~
./draw.sh cbp [d]
~~~~~
Option *d* is used if OCCT has been built in **Debug** mode.
@subsection build_occt_genproj Building with Genproj tool
This page describes steps to build OCCT libraries from a complete source archive on Windows with <b>MS Visual C++</b> using projects generated by **genproj** tool.
It is an alternative to use of CMake build system (see @ref build_occt_win_cmake).
**genproj** is a legacy tool (originated from command "wgenproj" in WOK) for generation of Visual Studio, Code.Blocks, and XCode project files used for building Open CASCADE Technology.
These project files are placed inside OCCT directory (in *adm* subfolder) and use relative paths, thus can be moved together with sources.
The project files included in official distribution of OCCT are generated by this tool.
If you have official distribution with project files included, you can use them directly without a need to call **genproj**.
@subsubsection build_msvc_3rdparty Third-party libraries
Before building OCCT, make sure to have all the required third-party libraries installed.
The easiest way to install third-party libraries is to download archive with pre-built binaries, corresponding to version of Visual Studio you are using, from https://opencascade.com/content/3rd-party-components.
You can also build third-party libraries from their sources, see @ref build_upgrade_building_3rdparty for instructions.
@subsubsection build_msvc_conf Configuration
If you have Visual Studio projects already available (pre-installed or generated), you can edit file *custom.bat* manually to adjust the environment:
* *VCVER* -- specification of format of project files, defining also version of Visual Studio to be used, and default name of the sub-folder for binaries:
| VCVER | Visual Studio version | Windows Platform | Binaries folder name | | VCVER | Visual Studio version | Windows Platform | Binaries folder name |
|-----------|-----------------------|----------------------------------|----------------------| |-----------|-----------------------|----------------------------------|----------------------|
@@ -325,85 +315,267 @@ The environment is defined in the file *custom.sh* (on Linux and macOS) or *cust
| vc142 | 2019 (16) | Desktop (Windows API) | vc14 | | vc142 | 2019 (16) | Desktop (Windows API) | vc14 |
| vc142-uwp | 2019 (16) | UWP (Universal Windows Platform) | vc14-uwp | | vc142-uwp | 2019 (16) | UWP (Universal Windows Platform) | vc14-uwp |
* *ARCH* -- architecture (32 or 64), affects only *PATH* variable for execution
* <i>HAVE_*</i> -- flags to enable or disable use of optional third-party products
* <i>CSF_OPT_*</i> -- paths to search for includes and binaries of all used third-party products
* *SHORTCUT_HEADERS* -- defines method for population of folder *inc* by header files. Supported methods are:
* *Copy* - headers will be copied from *src*;
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
* "HardLink* - hard links to headers located in *src* will be created.
Alternatively, you can launch **genconf**, a GUI tool allowing to configure build options interactively. Alternatively, you can launch **genconf**, a GUI tool allowing to configure build options interactively.
That tool will analyze your environment and propose you to choose available options: That tool will analyze your environment and propose you to choose available options:
* Type and version of project files to generate (from the list of installed ones, detected by presence of environment variables like `VS100COMNTOOLS` on Windows platform). * Version of Visual Studio to be used (from the list of installed ones, detected by presence of environment variables like *VS100COMNTOOLS*).
* Method to populate folder *inc* (short-cuts by default). * Method to populate folder *inc* (short-cuts by default).
* Location of third-party libraries (usually downloaded from OCCT web site, see above). * Location of third-party libraries (usually downloaded from OCCT web site, see above).
* Path to common directory where third-party libraries are located (optional). * Path to common directory where third-party libraries are located (optional).
* Paths to headers and binaries of the third-party libraries (found automatically basing on previous options; click button "Reset" to update). * Paths to headers and binaries of the third-party libraries (found automatically basing on previous options; click button "Reset" to update).
* Generation of PDB files within Release build ("Release with Debug info", false by default). * Generation of PDB files within Release build ("Release with Debug info", false by default).
Below are screenshots of **genconf** tool on various platforms (Windows and Linux):
@figure{/build/build_occt/images/genconf_windows.png} @figure{/build/build_occt/images/genconf_windows.png}
@figure{/build/build_occt/images/genconf_linux.png}
Click "Save" to store the specified configuration in *custom.bat* (Windows) or *custom.sh* (other systems) file. Click "Save" to store the specified configuration in *custom.bat* file.
@subsection build_genproj_generate Projects generation @subsubsection build_msvc_generate Projects generation
Launch **genproj** to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files. Launch **genproj** to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files.
@note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by `PATH`. @note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH.
If Tcl is not found, the tool may prompt you to enter the path to directory where Tcl can be found. If Tcl is not found, the tool may prompt you to enter the path to directory where Tcl can be found.
~~~~ ~~~~~
$ genproj.bat $ genproj.bat
~~~~ ~~~~~
Note that if *custom.bat* is not present, **genproj** will start **genconf** to configure environment. Note that if *custom.bat* is not present, **genproj** will start **genconf** to configure environment.
@subsection build_genproj_build Building @subsubsection build_msvc_build Building
@subsubsection build_msvc_build Visual Studio
Launch *msvc.bat* to start Visual Studio with all necessary environment variables defined, and build the whole solution or required toolkits. Launch *msvc.bat* to start Visual Studio with all necessary environment variables defined, and build the whole solution or required toolkits.
The MSVC project files are located in folders <i>adm\\msvc\\vc...</i>. Note: the MSVC project files are located in folders <i>adm\\msvc\\vc...</i>.
Binaries are produced in *win32* or *win64* folders. Binaries are produced in *win32* or *win64* folders.
To start DRAW, launch *draw.bat*. To start DRAW, launch *draw.bat*.
@subsubsection build_codeblocks_build Code::Blocks @section build_occt_linux Linux
Code::Blocks is a cross-platform IDE which can be used for building OCCT on Linux, macOS and Windows platforms. You may choose one of the following ways to generate, configure and build OCCT sources on Linux just keeping in mind
The generated Code::Blocks project could be found within subfolder *adm/&lt;OS&gt;/cbp*. this platform specific:
To start **Code::Blocks**, launch script *codeblocks.sh*. * @ref build_occt_win_cmake "Configuration, generation and building OCCT on Windows using CMake tool"
To build all toolkits, click **Build->Build workspace** in the menu bar. * @ref build_occt_code_blocks "Building on Mac OS X with Code::Blocks IDE"
To start *DRAWEXE*, which has been built with **Code::Blocks** on Mac OS X, run the script @section build_occt_crossplatform_cmake Android (cross-compiling)
~~~~
./draw.sh cbp [d]
~~~~
Option *d* is used if OCCT has been built in **Debug** mode.
@subsubsection build_occt_macos_xcode XCode This article describes the steps to build OCCT libraries for Android from a complete source package
with GNU make (makefiles). The steps on Windows 7 and Ubuntu 15.10 are similar. There is the only one difference:
makefiles are built with mingw32-make
on Windows and native GNU make on Ubuntu.
XCode is an IDE for development on macOS platform and targeting macOS and iOS platforms. Required tools (download and install if it is required):
**genproj** tool comes with a legacy XCode project files generator, but CMake is a preferred way for building OCCT on macOS platform. - CMake v3.0+ http://www.cmake.org/cmake/resources/software.html
- Cross-compilation toolchain for CMake https://github.com/taka-no-me/android-cmake
- Android NDK rev.10+ https://developer.android.com/tools/sdk/ndk/index.html
- GNU Make: MinGW v4.82+ for Windows (http://sourceforge.net/projects/mingw/files/), GNU Make 4.0 for Ubuntu.
To start **XCode**, launch script *xcode.sh*. Run GUI tool provided by CMake.
To build a certain toolkit, select it in **Scheme** drop-down list in XCode toolbar, press **Product** in the menu and click **Build** button.
@subsection build_occt_crossplatform_cmake_config Configuration
**Configure Tools**
- Specify the root folder of OCCT (<i>$CASROOT</i>, which contains *CMakelists.txt* file) by clicking **Browse Source**.
- Specify the location (build folder) for Cmake generated project files by clicking **Browse Build**.
@figure{/build/build_occt/images/android_image001.png}
Click **Configure** button. It opens the window with a drop-down list of generators supported by CMake project.
Select "MinGW MakeFiles" item from the list
- Choose "Specify toolchain file for cross-compiling"
- Click "Next"
@figure{/build/build_occt/images/android_image002.png}
- Specify a toolchain file at the next dialog by android.toolchain.cmake . It is contained by cross-compilation
toolchain for CMake
- Click "Finish"
@figure{/build/build_occt/images/android_image003.png}
If ANDROID_NDK environment variable is not defined in current OS, add cache entry ANDROID_NDK (entry type is PATH) --
path to the NDK folder ("Add Entry" button)
@figure{/build/build_occt/images/android_image004.png}
If on Windows the message is appeared: "CMake Error: CMake was unable to find a build program corresponding
to "MinGW Makefiles"
CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.",
specify **CMAKE_MAKE_PROGRAM** to mingw32-make executable.
@figure{/build/build_occt/images/android_image005.png}
**Configure OCCT**
How to configure OCCT, see "OCCT Configuration" section of @ref build_occt_win_cmake
"Configure, Generate, Build using CMake tool" taking into account the specific configuration variables for android:
- ANDROID_ABI = armeabi-v7a
- ANDROID_NATIVE_API_LEVEL = 15
- ANDROID_NDK_LAYOUT is equal to CMAKE_BUILD_TYPE variable
- **BUILD_MODULE_Draw = OFF**
@figure{/build/build_occt/images/android_image006.png}
@subsection build_occt_crossplatform_cmake_generation Generate Makefiles
Click **Generate** button and wait until the generation process is finished.
Then makefiles will appear in the build folder (e.g. <i> D:/tmp/occt-android </i>).
@subsection build_occt_crossplatform_cmake_building Build Makefiles
Open console and go to the build folder. Type "mingw32-make" (Windows) or "make" (Ubuntu) to start build process.
> mingw32-make
or
> make
Parallel building can be started with using **"-jN"** argument of "mingw32-make/make", where N is the number of
building threads.
> mingw32-make -j4
or
> make -j4
@subsection build_occt_crossplatform_cmake_install Install OCCT Libraries
Type "mingw32-make/make" with argument "install" to place the libraries to the install folder
> mingw32-make install
or
> make install
@section build_occt_macos Mac OS X
@subsection build_occt_macos_xcode Building with Xcode
This file describes steps to build OCCT libraries from sources on Mac OS X with **Xcode** projects, generated by OCCT legacy tool **genproj**.
<h2>Configuration</h2>
Before building it is necessary to set up build environment.
The environment is defined in the file *custom.sh* which can be edited directly:
* Add paths to includes of used third-party libraries in variable *CSF_OPT_INC* (use colon ":" as path separator).
* Add paths to their binary libraries in variable *CSF_OPT_LIB64*.
* Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
* *Copy* - headers will be copied from *src*;
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
* "HardLink* - hard links to headers located in *src* will be created.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
~~~~~
export HAVE_FREEIMAGE=false
~~~~~
Alternatively, or when *custom.sh* does not exist, you can launch *genconf.sh* to configure environment interactively:
@figure{/build/build_occt/images/genconf_osx.png}
Click "Save" to store the specified configuration in *custom.sh* file.
<h2>Projects generation</h2>
Launch **genproj** tool to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files.
@note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH.
For instance, in Terminal application:
~~~~~
$ cd /dev/OCCT/opencascade-7.0.0
$ ./genproj
~~~~~
<h2>Building</h2>
To start **Xcode**, launch script *xcode.sh*.
To build a certain toolkit, select it in **Scheme** drop-down list in Xcode toolbar, press **Product** in the menu and click **Build** button.
To build the entire OCCT: To build the entire OCCT:
* Create a new empty project (select **File -> New -> Project -> Empty project** in the menu; input the project name, e.g. *OCCT*; then click **Next** and **Create**). * Create a new empty project (select **File -> New -> Project -> Empty project** in the menu; input the project name, e.g. *OCCT*; then click **Next** and **Create**).
* Drag and drop the *OCCT* folder in the created *OCCT* project in the Project navigator. * Drag and drop the *OCCT* folder in the created *OCCT* project in the Project navigator.
* Select **File -> New -> Target -> Aggregate** in the menu. * Select **File -> New -> Target -> Aggregate** in the menu.
* Enter the project name (e.g. *OCCT*) and click **Finish**. The **Build Phases** tab will open. * Enter the project name (e.g. *OCCT*) and click **Finish**. The **Build Phases** tab will open.
* Click "+" button to add the necessary toolkits to the target project. It is possible to select all toolkits by pressing **Command+A** combination. * Click "+" button to add the necessary toolkits to the target project. It is possible to select all toolkits by pressing **Command+A** combination.
To start *DRAWEXE*, which has been built with XCode on Mac OS X, perform the following steps: <h2>Launching DRAW</h2>
To start *DRAWEXE*, which has been built with Xcode on Mac OS X, perform the following steps:
1.Open Terminal application 1.Open Terminal application
2.Enter `<OCCT_ROOT_DIR>`:
~~~~ 2.Enter <i>\<OCCT_ROOT_DIR\></i>:
~~~~~
cd \<OCCT_ROOT_DIR\> cd \<OCCT_ROOT_DIR\>
~~~~ ~~~~~
3.Run the script 3.Run the script
~~~~ ~~~~~
./draw.sh xcd [d] ./draw_cbp.sh xcd [d]
~~~~ ~~~~~
Option *d* is used if OCCT has been built in **Debug** mode. Option *d* is used if OCCT has been built in **Debug** mode.
@subsection build_occt_code_blocks Building with Code::Blocks
This file describes steps to build OCCT libraries from sources using **Code::Blocks**, a cross-platform IDE, using
project files generated by OCCT legacy tool **genproj**.
<h2>Configure</h2>
Before building it is necessary to set up build environment.
The environment is defined in the file *custom.sh* (on Linux and OS X) or *custom.bat* (on Windows) which can be edited
directly:
* Add paths to includes of used third-party libraries in variable *CSF_OPT_INC*.
* Add paths to their binary libraries in variable *CSF_OPT_LIB64*.
* Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
* *Copy* - headers will be copied from *src*;
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
* "HardLink* - hard links to headers located in *src* will be created.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
~~~~~
export HAVE_FREEIMAGE=false
~~~~~
Alternatively, or when *custom.sh* or *custom.bat* does not exist, you can launch **genconf** tool to configure
environment interactively:
@figure{/build/build_occt/images/genconf_linux.png}
Click "Save" to store the specified configuration in *custom.sh* or *custom.bat* file.
<h2>Generate Projects</h2>
Launch **genproj** tool with option *cbp* to update content of *inc* folder and generate project files after changes in
OCCT code affecting layout or composition of source files:
~~~~~
$ cd /dev/OCCT/opencascade-7.0.0
$ ./genproj cbp
~~~~~
The generated Code::Blocks project are placed into subfolder *adm/&lt;OS&gt;/cbp*.
@note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH.
<h2>Build</h2>
To start **Code::Blocks**, launch script *codeblocks.sh*.
To build all toolkits, click **Build->Build workspace** in the menu bar.
To start *DRAWEXE*, which has been built with **Code::Blocks** on Mac OS X, run the script
~~~~~
./draw_cbp.sh cbp [d]
~~~~~
Option *d* is used if OCCT has been built in **Debug** mode.

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

View File

@@ -48,11 +48,11 @@ For example, method *GetCoord* returns a triple of real values and is defined fo
Camel Case style is preferred for names. Camel Case style is preferred for names.
For example: For example:
~~~~{.cpp} ~~~~~{.cpp}
Standard_Integer awidthofbox; // this is bad Standard_Integer awidthofbox; // this is bad
Standard_Integer width_of_box; // this is bad Standard_Integer width_of_box; // this is bad
Standard_Integer aWidthOfBox; // this is OK Standard_Integer aWidthOfBox; // this is OK
~~~~ ~~~~~
@subsection occt_coding_rules_2_2 Names of development units @subsection occt_coding_rules_2_2 Names of development units
@@ -80,9 +80,9 @@ Toolkit names are prefixed by *TK*, followed by a meaningful part of the name ex
Names of public classes and other types (structures, enums, typedefs) should match the common pattern: name of the package followed by underscore and suffix (the own name of the type): Names of public classes and other types (structures, enums, typedefs) should match the common pattern: name of the package followed by underscore and suffix (the own name of the type):
~~~~{.cpp} ~~~~~
<package-name>_<class-name> <package-name>_<class-name>
~~~~ ~~~~~
Static methods related to the whole package are defined in the class with the same name as package (without suffix). Static methods related to the whole package are defined in the class with the same name as package (without suffix).
@@ -95,9 +95,9 @@ This rule also applies to complex types constructed by instantiation of template
Such types should be given own names using *typedef* statement, located in same-named header file. Such types should be given own names using *typedef* statement, located in same-named header file.
For example, see definition in the file *TColStd_IndexedDataMapOfStringString.hxx*: For example, see definition in the file *TColStd_IndexedDataMapOfStringString.hxx*:
~~~~{.cpp} ~~~~~
typedef NCollection_IndexedDataMap<TCollection_AsciiString,TCollection_AsciiString,TCollection_AsciiString> TColStd_IndexedDataMapOfStringString; typedef NCollection_IndexedDataMap<TCollection_AsciiString,TCollection_AsciiString,TCollection_AsciiString> TColStd_IndexedDataMapOfStringString;
~~~~ ~~~~~
### Names of functions ### Names of functions
@@ -109,7 +109,7 @@ The term **function** here is defined as:
It is preferred to start names of public methods from an upper case character and to start names of protected and private methods from a lower case character. It is preferred to start names of public methods from an upper case character and to start names of protected and private methods from a lower case character.
~~~~{.cpp} ~~~~~{.cpp}
class MyPackage_MyClass class MyPackage_MyClass
{ {
@@ -123,7 +123,7 @@ private:
void setIntegerValue (const Standard_Integer theValue); void setIntegerValue (const Standard_Integer theValue);
}; };
~~~~ ~~~~~
@subsection occt_coding_rules_2_3 Names of variables @subsection occt_coding_rules_2_3 Names of variables
@@ -137,13 +137,13 @@ The name of a variable should not start with an underscore.
See the following examples: See the following examples:
~~~~{.cpp} ~~~~~{.cpp}
Standard_Integer Elapsed_Time = 0; // this is bad - possible class name Standard_Integer Elapsed_Time = 0; // this is bad - possible class name
Standard_Integer gp = 0; // this is bad - existing package name Standard_Integer gp = 0; // this is bad - existing package name
Standard_Integer aGp = 0; // this is OK Standard_Integer aGp = 0; // this is OK
Standard_Integer _KERNEL = 0; // this is bad Standard_Integer _KERNEL = 0; // this is bad
Standard_Integer THE_KERNEL = 0; // this is OK Standard_Integer THE_KERNEL = 0; // this is OK
~~~~ ~~~~~
### Names of function parameters ### Names of function parameters
@@ -151,11 +151,11 @@ The name of a function (procedure, class method) parameter should start with pre
See the following examples: See the following examples:
~~~~{.cpp} ~~~~~{.cpp}
void Package_MyClass::MyFunction (const gp_Pnt& p); // this is bad void Package_MyClass::MyFunction (const gp_Pnt& p); // this is bad
void Package_MyClass::MyFunction (const gp_Pnt& theP); // this is OK void Package_MyClass::MyFunction (const gp_Pnt& theP); // this is OK
void Package_MyClass::MyFunction (const gp_Pnt& thePoint); // this is preferred void Package_MyClass::MyFunction (const gp_Pnt& thePoint); // this is preferred
~~~~ ~~~~~
### Names of class member variables ### Names of class member variables
@@ -163,11 +163,11 @@ The name of a class member variable should start with prefix *my* followed by th
See the following examples: See the following examples:
~~~~{.cpp} ~~~~~{.cpp}
Standard_Integer counter; // This is bad Standard_Integer counter; // This is bad
Standard_Integer myC; // This is OK Standard_Integer myC; // This is OK
Standard_Integer myCounter; // This is preferred Standard_Integer myCounter; // This is preferred
~~~~ ~~~~~
### Names of global variables ### Names of global variables
@@ -176,18 +176,18 @@ However, as soon as a global variable is necessary, its name should be prefixed
See the following examples: See the following examples:
~~~~{.cpp} ~~~~~{.cpp}
Standard_Integer MyPackage_myGlobalVariable = 0; Standard_Integer MyPackage_myGlobalVariable = 0;
Standard_Integer MyPackage_MyClass_myGlobalVariable = 0; Standard_Integer MyPackage_MyClass_myGlobalVariable = 0;
~~~~ ~~~~~
Static constants within the file should be written in upper-case and begin with prefix *THE_*: Static constants within the file should be written in upper-case and begin with prefix *THE_*:
~~~~{.cpp} ~~~~~{.cpp}
namespace namespace
{ {
static const Standard_Real THE_CONSTANT_COEF = 3.14; static const Standard_Real THE_CONSTANT_COEF = 3.14;
}; };
~~~~ ~~~~~
### Names of local variables ### Names of local variables
@@ -197,12 +197,12 @@ It is preferred to prefix local variable names with *a* and *an* (or *is*, *to*
See the following example: See the following example:
~~~~{.cpp} ~~~~~{.cpp}
Standard_Integer theI; // this is bad Standard_Integer theI; // this is bad
Standard_Integer i; // this is bad Standard_Integer i; // this is bad
Standard_Integer index; // this is bad Standard_Integer index; // this is bad
Standard_Integer anIndex; // this is OK Standard_Integer anIndex; // this is OK
~~~~ ~~~~~
### Avoid dummy names ### Avoid dummy names
Avoid dummy names, such as <i>i, j, k</i>. Such names are meaningless and easy to mix up. Avoid dummy names, such as <i>i, j, k</i>. Such names are meaningless and easy to mix up.
@@ -211,7 +211,7 @@ The code becomes more and more complicated when such dummy names are used there
See the following examples for preferred style: See the following examples for preferred style:
~~~~{.cpp} ~~~~~{.cpp}
void Average (const Standard_Real** theArray, void Average (const Standard_Real** theArray,
Standard_Integer theRowsNb, Standard_Integer theRowsNb,
Standard_Integer theRowLen, Standard_Integer theRowLen,
@@ -227,7 +227,7 @@ void Average (const Standard_Real** theArray,
theResult /= Standard_Real(aRowsNb * aRowLen); theResult /= Standard_Real(aRowsNb * aRowLen);
} }
} }
~~~~ ~~~~~
@section occt_coding_rules_3 Formatting rules @section occt_coding_rules_3 Formatting rules
@@ -262,7 +262,7 @@ Punctuation rules follow the rules of the English language.
* For better readability it is also recommended to surround conventional operators by a space character. * For better readability it is also recommended to surround conventional operators by a space character.
Examples: Examples:
~~~~{.cpp} ~~~~~{.cpp}
while (true) // NOT: while( true ) ... while (true) // NOT: while( true ) ...
{ {
DoSomething (theA, theB, theC, theD); // NOT: DoSomething(theA,theB,theC,theD); DoSomething (theA, theB, theC, theD); // NOT: DoSomething(theA,theB,theC,theD);
@@ -271,7 +271,7 @@ for (anIter = 0; anIter < 10; ++anIter) // NOT: for (anIter=0;anIter<10;++anIter
{ {
theA = (theB + theC) * theD; // NOT: theA=(theB+theC)*theD theA = (theB + theC) * theD; // NOT: theA=(theB+theC)*theD
} }
~~~~ ~~~~~
### Declaration of pointers and references ### Declaration of pointers and references
@@ -281,7 +281,7 @@ Since declaration of several variables with mixed pointer types contrudicts this
Examples: Examples:
~~~~{.cpp} ~~~~~{.cpp}
Standard_Integer *theVariable; // not recommended Standard_Integer *theVariable; // not recommended
Standard_Integer * theVariable; // not recommended Standard_Integer * theVariable; // not recommended
Standard_Integer* theVariable; // this is OK Standard_Integer* theVariable; // this is OK
@@ -295,7 +295,7 @@ Standard_Integer ** theVariable; // not recommended
Standard_Integer** theVariable; // this is OK Standard_Integer** theVariable; // this is OK
Standard_Integer *theA, theB, **theC; // not recommended (declare each variable independently) Standard_Integer *theA, theB, **theC; // not recommended (declare each variable independently)
~~~~ ~~~~~
### Separate logical blocks ### Separate logical blocks
@@ -303,7 +303,7 @@ Separate logical blocks of code with one blank line and comments.
See the following example: See the following example:
~~~~{.cpp} ~~~~~{.cpp}
// check arguments // check arguments
Standard_Integer anArgsNb = argCount(); Standard_Integer anArgsNb = argCount();
if (anArgsNb < 3 || isSmthInvalid) if (anArgsNb < 3 || isSmthInvalid)
@@ -318,7 +318,7 @@ if (anArgsNb < 3 || isSmthInvalid)
// do our job // do our job
... ...
... ...
~~~~ ~~~~~
Notice that multiple blank lines should be avoided. Notice that multiple blank lines should be avoided.
@@ -329,7 +329,7 @@ Each descriptive block should contain at least a function name and purpose descr
See the following example: See the following example:
~~~~{.cpp} ~~~~~{.cpp}
// ======================================================================= // =======================================================================
// function : TellMeSmthGood // function : TellMeSmthGood
// purpose : Gives me good news // purpose : Gives me good news
@@ -347,19 +347,19 @@ void TellMeSmthBad()
{ {
... ...
} }
~~~~ ~~~~~
### Block layout [MANDATORY] ### Block layout [MANDATORY]
Figure brackets <i>{ }</i> and each operator <i>(for, if, else, try, catch)</i> should be written on a dedicated line. Figure brackets <i>{ }</i> and each operator <i>(for, if, else, try, catch)</i> should be written on a dedicated line.
In general, the layout should be as follows: In general, the layout should be as follows:
~~~~{.cpp} ~~~~~{.cpp}
while (expression) while (expression)
{ {
... ...
} }
~~~~ ~~~~~
Entering a block increases and leaving a block decreases the indentation by one tabulation. Entering a block increases and leaving a block decreases the indentation by one tabulation.
@@ -367,7 +367,7 @@ Entering a block increases and leaving a block decreases the indentation by one
Single-line conditional operators <i>(if, while, for,</i> etc.) can be written without brackets on the following line. Single-line conditional operators <i>(if, while, for,</i> etc.) can be written without brackets on the following line.
~~~~{.cpp} ~~~~~{.cpp}
if (!myIsInit) return Standard_False; // bad if (!myIsInit) return Standard_False; // bad
if (thePtr == NULL) // OK if (thePtr == NULL) // OK
@@ -377,7 +377,7 @@ if (!theAlgo.IsNull()) // preferred
{ {
DoSomething(); DoSomething();
} }
~~~~ ~~~~~
Having all code in the same line is less convenient for debugging. Having all code in the same line is less convenient for debugging.
@@ -386,7 +386,7 @@ Having all code in the same line is less convenient for debugging.
In comparisons, put the variable (in the current context) on the left side and constant on the right side of expression. In comparisons, put the variable (in the current context) on the left side and constant on the right side of expression.
That is, the so called "Yoda style" is to be avoided. That is, the so called "Yoda style" is to be avoided.
~~~~{.cpp} ~~~~~{.cpp}
if (NULL != thePointer) // Yoda style, not recommended if (NULL != thePointer) // Yoda style, not recommended
if (thePointer != NULL) // OK if (thePointer != NULL) // OK
@@ -398,13 +398,13 @@ if (anIter <= theNbValues) // OK
if (THE_LIMIT == theValue) // bad style (global constant vs. variable) if (THE_LIMIT == theValue) // bad style (global constant vs. variable)
if (theValue == THE_LIMIT) // OK if (theValue == THE_LIMIT) // OK
~~~~ ~~~~~
### Alignment ### Alignment
Use alignment wherever it enhances the readability. See the following example: Use alignment wherever it enhances the readability. See the following example:
~~~~{.cpp} ~~~~~{.cpp}
MyPackage_MyClass anObject; MyPackage_MyClass anObject;
Standard_Real aMinimum = 0.0; Standard_Real aMinimum = 0.0;
Standard_Integer aVal = theVal; Standard_Integer aVal = theVal;
@@ -415,7 +415,7 @@ switch (aVal)
case 3: case 3:
default: computeSomethingElseYet(); break; default: computeSomethingElseYet(); break;
} }
~~~~ ~~~~~
### Indentation of comments ### Indentation of comments
@@ -425,7 +425,7 @@ The text of the comment should be separated from the slash character by a single
See the following example: See the following example:
~~~~{.cpp} ~~~~~{.cpp}
while (expression) //bad comment while (expression) //bad comment
{ {
// this is a long multi-line comment // this is a long multi-line comment
@@ -433,7 +433,7 @@ while (expression) //bad comment
DoSomething(); // maybe, enough DoSomething(); // maybe, enough
DoSomethingMore(); // again DoSomethingMore(); // again
} }
~~~~ ~~~~~
### Early return statement ### Early return statement
@@ -441,7 +441,7 @@ Use an early return condition rather than collect indentations.
Write like this: Write like this:
~~~~{.cpp} ~~~~~{.cpp}
Standard_Integer ComputeSumm (const Standard_Integer* theArray, Standard_Integer ComputeSumm (const Standard_Integer* theArray,
const Standard_Size theSize) const Standard_Size theSize)
{ {
@@ -454,11 +454,11 @@ Standard_Integer ComputeSumm (const Standard_Integer* theArray,
... computing summ ... ... computing summ ...
return aSumm; return aSumm;
} }
~~~~ ~~~~~
Rather than: Rather than:
~~~~{.cpp} ~~~~~{.cpp}
Standard_Integer ComputeSumm (const Standard_Integer* theArray, Standard_Integer ComputeSumm (const Standard_Integer* theArray,
const Standard_Size theSize) const Standard_Size theSize)
{ {
@@ -469,7 +469,7 @@ Standard_Integer ComputeSumm (const Standard_Integer* theArray,
} }
return aSumm; return aSumm;
} }
~~~~ ~~~~~
This helps to improve readability and reduce the unnecessary indentation depth. This helps to improve readability and reduce the unnecessary indentation depth.
@@ -490,7 +490,7 @@ An exception to the rule is ordering system headers generating a macros declarat
The source or header file should include only minimal set of headers necessary for compilation, without duplicates (considering nested includes). The source or header file should include only minimal set of headers necessary for compilation, without duplicates (considering nested includes).
~~~~{.cpp} ~~~~~{.cpp}
// the header file of implemented class // the header file of implemented class
#include <PackageName_ClassName.hxx> #include <PackageName_ClassName.hxx>
@@ -506,7 +506,7 @@ The source or header file should include only minimal set of headers necessary f
// system headers // system headers
#include <iostream> #include <iostream>
#include <windows.h> #include <windows.h>
~~~~ ~~~~~
@section occt_coding_rules_4 Documentation rules @section occt_coding_rules_4 Documentation rules
@@ -623,7 +623,7 @@ A class with virtual function(s) ought to have a virtual destructor.
Declaration of overriding method should contains specifiers "virtual" and "override" Declaration of overriding method should contains specifiers "virtual" and "override"
(using Standard_OVERRIDE alias for compatibility with old compilers). (using Standard_OVERRIDE alias for compatibility with old compilers).
~~~~{.cpp} ~~~~~{.cpp}
class MyPackage_BaseClass class MyPackage_BaseClass
{ {
@@ -641,7 +641,7 @@ public:
Standard_EXPORT virtual Standard_Boolean Perform() Standard_OVERRIDE; Standard_EXPORT virtual Standard_Boolean Perform() Standard_OVERRIDE;
}; };
~~~~ ~~~~~
This makes class definition more clear (virtual methods become highlighted). This makes class definition more clear (virtual methods become highlighted).
@@ -667,20 +667,20 @@ Avoid *goto* statement unless it is really needed.
Declare a cycle variable in the header of the *for()* statement if not used out of cycle. Declare a cycle variable in the header of the *for()* statement if not used out of cycle.
~~~~{.cpp} ~~~~~{.cpp}
Standard_Real aMinDist = Precision::Infinite(); Standard_Real aMinDist = Precision::Infinite();
for (NCollection_Sequence<gp_Pnt>::Iterator aPntIter (theSequence); for (NCollection_Sequence<gp_Pnt>::Iterator aPntIter (theSequence);
aPntIter.More(); aPntIter.Next()) aPntIter.More(); aPntIter.Next())
{ {
aMinDist = Min (aMinDist, theOrigin.Distance (aPntIter.Value())); aMinDist = Min (aMinDist, theOrigin.Distance (aPntIter.Value()));
} }
~~~~ ~~~~~
### Condition statements within zero ### Condition statements within zero
Avoid usage of C-style comparison for non-boolean variables: Avoid usage of C-style comparison for non-boolean variables:
~~~~{.cpp} ~~~~~{.cpp}
void Function (Standard_Integer theValue, void Function (Standard_Integer theValue,
Standard_Real* thePointer) Standard_Real* thePointer)
{ {
@@ -699,7 +699,7 @@ void Function (Standard_Integer theValue,
DoSome2(); DoSome2();
} }
} }
~~~~ ~~~~~
@section occt_coding_rules_7 Portability issues @section occt_coding_rules_7 Portability issues
@@ -791,11 +791,11 @@ In C++ use *new* and *delete* operators instead of *malloc()* and *free()*. Try
Use the same form of new and delete. Use the same form of new and delete.
~~~~{.cpp} ~~~~~{.cpp}
aPtr1 = new TypeA[n]; ... ; delete[] aPtr1; aPtr1 = new TypeA[n]; ... ; delete[] aPtr1;
aPtr2 = new TypeB(); ... ; delete aPtr2; aPtr2 = new TypeB(); ... ; delete aPtr2;
aPtr3 = Standard::Allocate (4096); ... ; Standard::Free (aPtr3); aPtr3 = Standard::Allocate (4096); ... ; Standard::Free (aPtr3);
~~~~ ~~~~~
### Methods managing dynamical allocation [MANDATORY] ### Methods managing dynamical allocation [MANDATORY]
@@ -805,10 +805,10 @@ Define a destructor, a copy constructor and an assignment operator for classes w
Every variable should be initialized. Every variable should be initialized.
~~~~{.cpp} ~~~~~{.cpp}
Standard_Integer aTmpVar1; // bad Standard_Integer aTmpVar1; // bad
Standard_Integer aTmpVar2 = 0; // OK Standard_Integer aTmpVar2 = 0; // OK
~~~~ ~~~~~
Uninitialized variables might be kept only within performance-sensitive code blocks and only when their initialization is guaranteed by subsequent code. Uninitialized variables might be kept only within performance-sensitive code blocks and only when their initialization is guaranteed by subsequent code.
@@ -824,12 +824,12 @@ In *operator=()* assign to all data members and check for assignment to self.
Don't check floats for equality or non-equality; check for GT, GE, LT or LE. Don't check floats for equality or non-equality; check for GT, GE, LT or LE.
~~~~{.cpp} ~~~~~{.cpp}
if (Abs (theFloat1 - theFloat2) < theTolerance) if (Abs (theFloat1 - theFloat2) < theTolerance)
{ {
DoSome(); DoSome();
} }
~~~~ ~~~~~
Package *Precision* provides standard values for SI units and widely adopted by existing modeling algorithms: Package *Precision* provides standard values for SI units and widely adopted by existing modeling algorithms:
@@ -872,7 +872,7 @@ Generally, try to reduce misaligned accesses since they impact the performance (
List class data members in the constructor's initialization list in the order they are declared. List class data members in the constructor's initialization list in the order they are declared.
~~~~{.cpp} ~~~~~{.cpp}
class MyPackage_MyClass class MyPackage_MyClass
{ {
@@ -892,19 +892,19 @@ private:
Standard_Integer myPropertyB; Standard_Integer myPropertyB;
}; };
~~~~ ~~~~~
### Initialization over assignment ### Initialization over assignment
Prefer initialization over assignment in class constructors. Prefer initialization over assignment in class constructors.
~~~~{.cpp} ~~~~~{.cpp}
MyPackage_MyClass() MyPackage_MyClass()
: myPropertyA (1) // preferred : myPropertyA (1) // preferred
{ {
myPropertyB = 2; // not recommended myPropertyB = 2; // not recommended
} }
~~~~ ~~~~~
### Optimize caching ### Optimize caching
@@ -912,23 +912,23 @@ When programming procedures with extensive memory access, try to optimize them i
On x86 this code On x86 this code
~~~~{.cpp} ~~~~~{.cpp}
Standard_Real anArray[4096][2]; Standard_Real anArray[4096][2];
for (Standard_Integer anIter = 0; anIter < 4096; ++anIter) for (Standard_Integer anIter = 0; anIter < 4096; ++anIter)
{ {
anArray[anIter][0] = anArray[anIter][1]; anArray[anIter][0] = anArray[anIter][1];
} }
~~~~ ~~~~~
is more efficient then is more efficient then
~~~~{.cpp} ~~~~~{.cpp}
Standard_Real anArray[2][4096]; Standard_Real anArray[2][4096];
for (Standard_Integer anIter = 0; anIter < 4096; ++anIter) for (Standard_Integer anIter = 0; anIter < 4096; ++anIter)
{ {
anArray[0][anIter] = anArray[1][anIter]; anArray[0][anIter] = anArray[1][anIter];
} }
~~~~ ~~~~~
since linear access does not invalidate cache too often. since linear access does not invalidate cache too often.
@@ -952,7 +952,7 @@ Command arguments should be validated before usage. The user should see a human-
Command should warn the user about unknown arguments, including cases when extra parameters have been pushed for the command with a fixed number of arguments. Command should warn the user about unknown arguments, including cases when extra parameters have been pushed for the command with a fixed number of arguments.
~~~~{.cpp} ~~~~~{.cpp}
if (theArgsNb != 3) if (theArgsNb != 3)
{ {
std::cout << "Syntax error - wrong number of arguments!\n"; std::cout << "Syntax error - wrong number of arguments!\n";
@@ -971,7 +971,7 @@ Command should warn the user about unknown arguments, including cases when extra
} }
DBRep::Set (aResName, aFaceShape); DBRep::Set (aResName, aFaceShape);
return 0; return 0;
~~~~ ~~~~~
### Message printing ### Message printing
@@ -984,9 +984,9 @@ Information printed into Draw Interpreter should be well-structured to allow usa
Any command with a long list of obligatory parameters should be considered as ill-formed by design. Any command with a long list of obligatory parameters should be considered as ill-formed by design.
Optional parameters should start with flag name (with '-' prefix) and followed by its values: Optional parameters should start with flag name (with '-' prefix) and followed by its values:
~~~~{.php} ~~~~~{.tcl}
myCommand -flag1 value1 value2 -flag2 value3 myCommand -flag1 value1 value2 -flag2 value3
~~~~ ~~~~~
### Arguments parser ### Arguments parser
@@ -996,7 +996,7 @@ myCommand -flag1 value1 value2 -flag2 value3
Functions *Draw::Atof()* and *Draw::Atoi()* support expressions and read values in C-locale. Functions *Draw::Atof()* and *Draw::Atoi()* support expressions and read values in C-locale.
~~~~{.cpp} ~~~~~{.cpp}
Standard_Real aPosition[3] = {0.0, 0.0, 0.0}; Standard_Real aPosition[3] = {0.0, 0.0, 0.0};
for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter) for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter)
{ {
@@ -1020,7 +1020,7 @@ Functions *Draw::Atof()* and *Draw::Atoi()* support expressions and read values
return 1; return 1;
} }
} }
~~~~ ~~~~~
@section occt_coding_rules_11 Examples @section occt_coding_rules_11 Examples
@@ -1051,7 +1051,7 @@ private: //! \@name private fields
@endverbatim @endverbatim
~~~~{.cpp} ~~~~~
#include <Package_Class.hxx> #include <Package_Class.hxx>
// ========================================================== // ==========================================================
// function : Square // function : Square
@@ -1071,11 +1071,11 @@ void Package_Class::increment()
{ {
++myCounter; ++myCounter;
} }
~~~~ ~~~~~
### TCL script for Draw Harness ### TCL script for Draw Harness
~~~~{.tcl} ~~~~~{.tcl}
# show fragments (solids) in shading with different colors # show fragments (solids) in shading with different colors
proc DisplayColored {theShape} { proc DisplayColored {theShape} {
set aSolids [uplevel #0 explode $theShape so] set aSolids [uplevel #0 explode $theShape so]
@@ -1106,10 +1106,10 @@ vzbufftrihedron
DisplayColored c DisplayColored c
vfit vfit
vdump $imagedir/${casename}.png 512 512 vdump $imagedir/${casename}.png 512 512
~~~~ ~~~~~
### GLSL program: ### GLSL program:
~~~~{.cpp} ~~~~~{.fs}
vec3 Ambient; //!< Ambient contribution of light sources vec3 Ambient; //!< Ambient contribution of light sources
vec3 Diffuse; //!< Diffuse contribution of light sources vec3 Diffuse; //!< Diffuse contribution of light sources
vec3 Specular; //!< Specular contribution of light sources vec3 Specular; //!< Specular contribution of light sources
@@ -1149,4 +1149,4 @@ void main()
normalize (View), normalize (View),
Position); Position);
} }
~~~~ ~~~~~

View File

@@ -152,11 +152,11 @@ The official repository contains:
Make sure to configure Git so that the user name is equal to your username Make sure to configure Git so that the user name is equal to your username
on the OCCT development portal, and set SafeCrLf option to true: on the OCCT development portal, and set SafeCrLf option to true:
~~~~ ~~~~~
> git config --global user.name "Your User Name" > git config --global user.name "Your User Name"
> git config --global user.email your@mail.address > git config --global user.email your@mail.address
> git config --global your@mail.address > git config --global your@mail.address
~~~~ ~~~~~
@section occt_gitguide_3 Getting access to the repository @section occt_gitguide_3 Getting access to the repository
@@ -213,9 +213,9 @@ The official repository contains:
On Windows, you might need to start **Git Bash** command prompt window. On Windows, you might need to start **Git Bash** command prompt window.
Use the following command to generate SSH keys: Use the following command to generate SSH keys:
~~~~ ~~~~~
> ssh-keygen -t rsa -C "your@mail.address" > ssh-keygen -t rsa -C "your@mail.address"
~~~~ ~~~~~
The last argument is an optional comment, which can be included with the public key and used to distinguish between different keys (if you have many). The common practice is to put here your mail address or workstation name. The last argument is an optional comment, which can be included with the public key and used to distinguish between different keys (if you have many). The common practice is to put here your mail address or workstation name.
@@ -290,9 +290,9 @@ Click **Save** to input the key to the system.
* From command line by command: * From command line by command:
~~~~ ~~~~~
> git clone gitolite@git.dev.opencascade.org:occt <path> > git clone gitolite@git.dev.opencascade.org:occt <path>
~~~~ ~~~~~
where <i>\<path\></i> is the path to the new folder which will be created for the repository. where <i>\<path\></i> is the path to the new folder which will be created for the repository.
@@ -314,9 +314,9 @@ Click **Save** to input the key to the system.
In the console: In the console:
~~~~ ~~~~~
> git checkout -b CR12345 origin/master > git checkout -b CR12345 origin/master
~~~~ ~~~~~
In TortoiseGit: In TortoiseGit:
* Go to the local copy of the repository. * Go to the local copy of the repository.
@@ -332,9 +332,9 @@ In TortoiseGit:
If you need to switch to another branch, use Git command checkout for that. If you need to switch to another branch, use Git command checkout for that.
In the console: In the console:
~~~~ ~~~~~
> git checkout CR12345 > git checkout CR12345
~~~~ ~~~~~
In TortoiseGit: right-click in the explorer window and select in the context menu **TortoiseGit** -> **Switch/Checkout**. In TortoiseGit: right-click in the explorer window and select in the context menu **TortoiseGit** -> **Switch/Checkout**.
@@ -351,11 +351,11 @@ In TortoiseGit:
* In the console: * In the console:
~~~~ ~~~~~
> git diff > git diff
> git commit -a -m "Write meaningful commit message here" > git commit -a -m "Write meaningful commit message here"
~~~~ ~~~~~
Option -a tells the command to automatically include (stage) files Option -a tells the command to automatically include (stage) files
that have been modified or deleted, but it will omit the new files that might have been added by you. that have been modified or deleted, but it will omit the new files that might have been added by you.
@@ -363,12 +363,12 @@ In TortoiseGit:
To find new unstaged files and them to commit, use commands: To find new unstaged files and them to commit, use commands:
~~~~ ~~~~~
> git status -s > git status -s
?? file1.hxx ?? file1.hxx
?? file2.cxx ?? file2.cxx
> git add file1.hxx file2.cxx > git add file1.hxx file2.cxx
~~~~ ~~~~~
* In TortoiseGit: right-click in the explorer window and select in the context menu <b>Git Commit -> CR…</b>: * In TortoiseGit: right-click in the explorer window and select in the context menu <b>Git Commit -> CR…</b>:
@@ -384,9 +384,9 @@ In TortoiseGit:
* In the console: * In the console:
~~~~ ~~~~~
> git push "origin" CR12345:CR12345 > git push "origin" CR12345:CR12345
~~~~ ~~~~~
* In TortoiseGit: right-click in the explorer window and select in the context menu, TortoiseGit -> **Push** * In TortoiseGit: right-click in the explorer window and select in the context menu, TortoiseGit -> **Push**
@@ -410,9 +410,9 @@ Note that Git forbids pushing a branch if the corresponding remote branch alread
Use Git command *fetch* with option *prune* to get the update of all branches from the remote repository and to clean your local repository from the remote branches that have been deleted. Use Git command *fetch* with option *prune* to get the update of all branches from the remote repository and to clean your local repository from the remote branches that have been deleted.
* In the console: * In the console:
~~~~ ~~~~~
> git fetch --prune > git fetch --prune
~~~~ ~~~~~
* In TortoiseGit: right-click in the explorer window and select in the context menu **TortoiseGit** -> **Fetch**. Check in **Prune** check-box. * In TortoiseGit: right-click in the explorer window and select in the context menu **TortoiseGit** -> **Fetch**. Check in **Prune** check-box.
@@ -423,9 +423,9 @@ Note that Git forbids pushing a branch if the corresponding remote branch alread
This operation is required in particular to update your local master branch when the remote master changes. This operation is required in particular to update your local master branch when the remote master changes.
* In console: * In console:
~~~~ ~~~~~
> git pull > git pull
~~~~ ~~~~~
* In TortoiseGit: right-click in the explorer window and select in the context menu **TortoiseGit** -> **Pull**. * In TortoiseGit: right-click in the explorer window and select in the context menu **TortoiseGit** -> **Pull**.
@@ -436,9 +436,9 @@ Note that the local branches of your repository are the primary place, where you
Remove the local branches that you do not need any more. Note that you cannot delete the current branch. It means that you need to switch to another one (e.g. master) if the branch you are going to delete is the current one. Remove the local branches that you do not need any more. Note that you cannot delete the current branch. It means that you need to switch to another one (e.g. master) if the branch you are going to delete is the current one.
* In the console: * In the console:
~~~~ ~~~~~
> git branch -d CR12345 > git branch -d CR12345
~~~~ ~~~~~
* In TortoiseGit: right-click in the explorer window and select in the context menu **TortoiseGit** -> **Git Show Log**. * In TortoiseGit: right-click in the explorer window and select in the context menu **TortoiseGit** -> **Git Show Log**.

File diff suppressed because it is too large Load Diff

View File

@@ -49,34 +49,34 @@ Open CASCADE Test Harness or @ref occt_user_guides__test_harness "DRAW" provides
In some cases the objects to be inspected are available in DRAW as results of DRAW commands. In other cases, however, it is necessary to inspect intermediate objects created by the debugged algorithm. To support this, DRAW provides a set of commands allowing the developer to store intermediate objects directly from the debugger stopped at some point during the program execution (usually at a breakpoint). In some cases the objects to be inspected are available in DRAW as results of DRAW commands. In other cases, however, it is necessary to inspect intermediate objects created by the debugged algorithm. To support this, DRAW provides a set of commands allowing the developer to store intermediate objects directly from the debugger stopped at some point during the program execution (usually at a breakpoint).
~~~~{.php} ~~~~~
const char* Draw_Eval (const char *theCommandStr) const char* Draw_Eval (const char *theCommandStr)
~~~~ ~~~~~
Evaluates a DRAW command or script. Evaluates a DRAW command or script.
A command is passed as a string parameter. A command is passed as a string parameter.
~~~~{.php} ~~~~~
const char* DBRep_Set (const char* theNameStr, void* theShapePtr) const char* DBRep_Set (const char* theNameStr, void* theShapePtr)
~~~~ ~~~~~
Sets the specified shape as a value of DRAW interpreter variable with the given name. Sets the specified shape as a value of DRAW interpreter variable with the given name.
- *theNameStr* -- the DRAW interpreter variable name to set. - *theNameStr* -- the DRAW interpreter variable name to set.
- *theShapePtr* -- a pointer to *TopoDS_Shape* variable. - *theShapePtr* -- a pointer to *TopoDS_Shape* variable.
~~~~{.php} ~~~~~
const char* DBRep_SetComp (const char* theNameStr, void* theListPtr) const char* DBRep_SetComp (const char* theNameStr, void* theListPtr)
~~~~ ~~~~~
Makes a compound from the specified list of shapes and sets it as a value of DRAW interpreter variable with the given name. Makes a compound from the specified list of shapes and sets it as a value of DRAW interpreter variable with the given name.
- *theNameStr* -- the DRAW interpreter variable name to set. - *theNameStr* -- the DRAW interpreter variable name to set.
- *theListPtr* -- a pointer to *TopTools_ListOfShape* variable. - *theListPtr* -- a pointer to *TopTools_ListOfShape* variable.
~~~~{.php} ~~~~~
const char* DrawTrSurf_Set (const char* theNameStr, void* theHandlePtr) const char* DrawTrSurf_Set (const char* theNameStr, void* theHandlePtr)
const char* DrawTrSurf_SetPnt (const char* theNameStr, void* thePntPtr) const char* DrawTrSurf_SetPnt (const char* theNameStr, void* thePntPtr)
const char* DrawTrSurf_SetPnt2d (const char* theNameStr, void* thePnt2dPtr) const char* DrawTrSurf_SetPnt2d (const char* theNameStr, void* thePnt2dPtr)
~~~~ ~~~~~
Sets the specified geometric object as a value of DRAW interpreter variable with the given name. Sets the specified geometric object as a value of DRAW interpreter variable with the given name.
- *theNameStr* -- the DRAW interpreter variable name to set. - *theNameStr* -- the DRAW interpreter variable name to set.
@@ -90,27 +90,27 @@ All these functions are defined in *TKDraw* toolkit and return a string indicati
The following functions are provided by *TKBRep* toolkit and can be used from debugger prompt: The following functions are provided by *TKBRep* toolkit and can be used from debugger prompt:
~~~~{.php} ~~~~~
const char* BRepTools_Write (const char* theFileNameStr, void* theShapePtr) const char* BRepTools_Write (const char* theFileNameStr, void* theShapePtr)
~~~~ ~~~~~
Saves the specified shape to a file with the given name. Saves the specified shape to a file with the given name.
- *theFileNameStr* -- the name of the file where the shape is saved. - *theFileNameStr* -- the name of the file where the shape is saved.
- *theShapePtr* -- a pointer to *TopoDS_Shape* variable. - *theShapePtr* -- a pointer to *TopoDS_Shape* variable.
~~~~{.php} ~~~~~
const char* BRepTools_Dump (void* theShapePtr) const char* BRepTools_Dump (void* theShapePtr)
const char* BRepTools_DumpLoc (void* theShapePtr) const char* BRepTools_DumpLoc (void* theShapePtr)
~~~~ ~~~~~
Dumps shape or its location to cout. Dumps shape or its location to cout.
- *theShapePtr* -- a pointer to *TopoDS_Shape* variable. - *theShapePtr* -- a pointer to *TopoDS_Shape* variable.
The following function is provided by *TKMesh* toolkit: The following function is provided by *TKMesh* toolkit:
~~~~{.php} ~~~~~
const char* BRepMesh_Dump (void* theMeshHandlePtr, const char* theFileNameStr) const char* BRepMesh_Dump (void* theMeshHandlePtr, const char* theFileNameStr)
~~~~ ~~~~~
Stores mesh produced in parametric space to BREP file. Stores mesh produced in parametric space to BREP file.
- *theMeshHandlePtr* -- a pointer to *Handle(BRepMesh_DataStructureOfDelaun)* variable. - *theMeshHandlePtr* -- a pointer to *Handle(BRepMesh_DataStructureOfDelaun)* variable.
@@ -118,10 +118,10 @@ Stores mesh produced in parametric space to BREP file.
The following functions are provided by *TKTopTest* toolkit: The following functions are provided by *TKTopTest* toolkit:
~~~~{.php} ~~~~~
const char* MeshTest_DrawLinks(const char* theNameStr, void* theFaceAttr) const char* MeshTest_DrawLinks(const char* theNameStr, void* theFaceAttr)
const char* MeshTest_DrawTriangles(const char* theNameStr, void* theFaceAttr) const char* MeshTest_DrawTriangles(const char* theNameStr, void* theFaceAttr)
~~~~ ~~~~~
Sets the edges or triangles from mesh data structure of type *Handle(BRepMesh_FaceAttribute)* as DRAW interpreter variables, assigning a unique name in the form "<theNameStr>_<index>" to each object. Sets the edges or triangles from mesh data structure of type *Handle(BRepMesh_FaceAttribute)* as DRAW interpreter variables, assigning a unique name in the form "<theNameStr>_<index>" to each object.
- *theNameStr* -- the prefix to use in names of objects. - *theNameStr* -- the prefix to use in names of objects.
@@ -129,9 +129,9 @@ Sets the edges or triangles from mesh data structure of type *Handle(BRepMesh_Fa
The following additional function is provided by *TKGeomBase* toolkit: The following additional function is provided by *TKGeomBase* toolkit:
~~~~{.php} ~~~~~
const char* GeomTools_Dump (void* theHandlePtr) const char* GeomTools_Dump (void* theHandlePtr)
~~~~ ~~~~~
Dump geometric object to cout. Dump geometric object to cout.
- *theHandlePtr* -- a pointer to the geometric variable (<i>Handle</i> to *Geom_Geometry* or *Geom2d_Curve* or descendant) to be set. - *theHandlePtr* -- a pointer to the geometric variable (<i>Handle</i> to *Geom_Geometry* or *Geom2d_Curve* or descendant) to be set.
@@ -174,7 +174,7 @@ It is implemented in 'vaspect' and 'boundingbox' commands.
Json output for Bnd_OBB (using command 'bounding v -obb -dumpJson'): Json output for Bnd_OBB (using command 'bounding v -obb -dumpJson'):
~~~~{.java} ~~~~~
"Bnd_OBB": { "Bnd_OBB": {
"Center": { "Center": {
"gp_XYZ": [1, 2, 3] "gp_XYZ": [1, 2, 3]
@@ -193,7 +193,7 @@ Json output for Bnd_OBB (using command 'bounding v -obb -dumpJson'):
"HDims[2]": 0, "HDims[2]": 0,
"IsAABox": 1, "IsAABox": 1,
} }
~~~~ ~~~~~
@section occt_debug_vstudio Using Visual Studio debugger @section occt_debug_vstudio Using Visual Studio debugger
@@ -206,18 +206,18 @@ When the execution is interrupted by a breakpoint, you can use this window to ca
For example, assume that you are debugging a function, where local variable *TopoDS_Edge* *anEdge1* is of interest. For example, assume that you are debugging a function, where local variable *TopoDS_Edge* *anEdge1* is of interest.
The following set of commands in the Command window will save this edge to file *edge1.brep*, then put it to DRAW variable *e1* and show it maximized in the axonometric DRAW view: The following set of commands in the Command window will save this edge to file *edge1.brep*, then put it to DRAW variable *e1* and show it maximized in the axonometric DRAW view:
~~~~{.php} ~~~~~
>? ({,,TKBRep.dll}BRepTools_Write)("d:/edge1.brep",(void*)&anEdge1) >? ({,,TKBRep.dll}BRepTools_Write)("d:/edge1.brep",(void*)&anEdge1)
0x04a2f234 "d:/edge1.brep" 0x04a2f234 "d:/edge1.brep"
>? ({,,TKDraw.dll}DBRep_Set)("e1",(void*)&anEdge1) >? ({,,TKDraw.dll}DBRep_Set)("e1",(void*)&anEdge1)
0x0369eba8 "e1" 0x0369eba8 "e1"
>? ({,,TKDraw.dll}Draw_Eval)("donly e1; axo; fit") >? ({,,TKDraw.dll}Draw_Eval)("donly e1; axo; fit")
0x029a48f0 "" 0x029a48f0 ""
~~~~ ~~~~~
For convenience it is possible to define aliases to commands in this window, for instance (here ">" is prompt provided by the command window; in the Immediate window this symbol should be entered manually): For convenience it is possible to define aliases to commands in this window, for instance (here ">" is prompt provided by the command window; in the Immediate window this symbol should be entered manually):
~~~~{.php} ~~~~~
>alias deval ? ({,,TKDraw}Draw_Eval) >alias deval ? ({,,TKDraw}Draw_Eval)
>alias dsetshape ? ({,,TKDraw}DBRep_Set) >alias dsetshape ? ({,,TKDraw}DBRep_Set)
>alias dsetcomp ? ({,,TKDraw}DBRep_SetComp) >alias dsetcomp ? ({,,TKDraw}DBRep_SetComp)
@@ -229,18 +229,18 @@ For convenience it is possible to define aliases to commands in this window, for
>alias dumploc ? ({,,TKBRep}BRepTools_DumpLoc) >alias dumploc ? ({,,TKBRep}BRepTools_DumpLoc)
>alias dumpmesh ? ({,,TKMesh}BRepMesh_Dump) >alias dumpmesh ? ({,,TKMesh}BRepMesh_Dump)
>alias dumpgeom ? ({,,TKGeomBase}GeomTools_Dump) >alias dumpgeom ? ({,,TKGeomBase}GeomTools_Dump)
~~~~ ~~~~~
Note that aliases are stored in the Visual Studio user's preferences and it is sufficient to define them once on a workstation. With these aliases, the above example can be reproduced easier (note the space symbol after alias name!): Note that aliases are stored in the Visual Studio user's preferences and it is sufficient to define them once on a workstation. With these aliases, the above example can be reproduced easier (note the space symbol after alias name!):
~~~~{.php} ~~~~~
>saveshape ("d:/edge1.brep",(void*)&anEdge1) >saveshape ("d:/edge1.brep",(void*)&anEdge1)
0x04a2f234 "d:/edge1.brep" 0x04a2f234 "d:/edge1.brep"
>dsetshape ("e1",(void*)&anEdge1) >dsetshape ("e1",(void*)&anEdge1)
0x0369eba8 "e1" 0x0369eba8 "e1"
>deval ("donly e1; axo; fit") >deval ("donly e1; axo; fit")
0x029a48f0 "" 0x029a48f0 ""
~~~~ ~~~~~
Note that there is no guarantee that the call will succeed and will not affect the program execution, thus use this feature at your own risk. In particular, the commands interacting with window system (such as *axo*, *vinit*, etc.) are known to cause application crash when the program is built in 64-bit mode. To avoid this, it is recommended to prepare all necessary view windows in advance, and arrange these windows to avoid overlapping with the Visual Studio window, to ensure that they are visible during debug. Note that there is no guarantee that the call will succeed and will not affect the program execution, thus use this feature at your own risk. In particular, the commands interacting with window system (such as *axo*, *vinit*, etc.) are known to cause application crash when the program is built in 64-bit mode. To avoid this, it is recommended to prepare all necessary view windows in advance, and arrange these windows to avoid overlapping with the Visual Studio window, to ensure that they are visible during debug.
@@ -252,7 +252,7 @@ In Visual Studio 2005-2010 the rules for this display are defined in file *autoe
### \[AutoExpand\] section ### \[AutoExpand\] section
~~~~{.cpp} ~~~~~
; Open CASCADE classes ; Open CASCADE classes
Standard_Transient=<,t> count=<count,d> Standard_Transient=<,t> count=<count,d>
Handle_Standard_Transient=<entity,x> count=<entity->count,d> <,t> Handle_Standard_Transient=<entity,x> count=<entity->count,d> <,t>
@@ -274,11 +274,11 @@ gp_Dir2d=<coord.x,g>, <coord.y,g>
gp_Vec2d=<coord.x,g>, <coord.y,g> gp_Vec2d=<coord.x,g>, <coord.y,g>
gp_Mat2d={<matrix[0][0],g>,<matrix[0][1],g>}, {<matrix[1][0],g>,<matrix[1][1],g>} gp_Mat2d={<matrix[0][0],g>,<matrix[0][1],g>}, {<matrix[1][0],g>,<matrix[1][1],g>}
gp_Ax1=loc={<loc.coord.x,g>, <loc.coord.y,g>, <loc.coord.z,g>} vdir={<vdir.coord.x,g>, <vdir.coord.y,g>, <vdir.coord.z,g>} gp_Ax1=loc={<loc.coord.x,g>, <loc.coord.y,g>, <loc.coord.z,g>} vdir={<vdir.coord.x,g>, <vdir.coord.y,g>, <vdir.coord.z,g>}
~~~~ ~~~~~
### \[Visualizer\] section ### \[Visualizer\] section
~~~~{.cpp} ~~~~~
; Open CASCADE classes ; Open CASCADE classes
NCollection_Handle<*> { NCollection_Handle<*> {
@@ -342,7 +342,7 @@ Handle_TCollection_HAsciiString {
#array( expr: ((TCollection_HAsciiString*)$e.entity)->myString.mystring[$i], #array( expr: ((TCollection_HAsciiString*)$e.entity)->myString.mystring[$i],
size: ((TCollection_HAsciiString*)$e.entity)->myString.mylength) ) ) size: ((TCollection_HAsciiString*)$e.entity)->myString.mylength) ) )
} }
~~~~ ~~~~~
In Visual Studio 2012 and later, visualizers can be put in a separate file in subdirectory *Visualizers*. See file *occt.natvis* for example. In Visual Studio 2012 and later, visualizers can be put in a separate file in subdirectory *Visualizers*. See file *occt.natvis* for example.
@@ -403,10 +403,7 @@ Example of configuration steps for Ubuntu:
7. Run DRAW and perform tests as usual, keeping in mind that running with sanitizer is much heavier than normal build: 7. Run DRAW and perform tests as usual, keeping in mind that running with sanitizer is much heavier than normal build:
> ./draw.sh relwithdeb <br> > ./draw.sh relwithdeb <br>
> Draw[]> testgrid -parallel 0
~~~~{.php}
Draw[]> testgrid -parallel 0
~~~~
Note that when running tests under sanitizers, behavior may be different. Note that when running tests under sanitizers, behavior may be different.
Known problems (as of CLang 6.0) are: Known problems (as of CLang 6.0) are:

View File

@@ -234,7 +234,7 @@ This module handles various problems of interoperability between CAD systems, ca
* @ref occt_user_guides__step "STEP" (AP203: Mechanical Design, this covers General 3D CAD; AP214: Automotive Design; AP242). * @ref occt_user_guides__step "STEP" (AP203: Mechanical Design, this covers General 3D CAD; AP214: Automotive Design; AP242).
* @ref occt_iges_1 "IGES" (up to 5.3). * @ref occt_iges_1 "IGES" (up to 5.3).
* **glTF** 2.0 reader and writer. * **glTF** 2.0 reader and writer.
* **OBJ** mesh file reader and writer. * **OBJ** mesh file reader.
* **VRML** converter translates Open CASCADE shapes to VRML 1.0 files (Virtual Reality Modeling Language). * **VRML** converter translates Open CASCADE shapes to VRML 1.0 files (Virtual Reality Modeling Language).
* **STL** converter translates Open CASCADE shapes to STL files. * **STL** converter translates Open CASCADE shapes to STL files.
STL (STtereoLithography) format is widely used for rapid prototyping (3D printing). STL (STtereoLithography) format is widely used for rapid prototyping (3D printing).
@@ -332,19 +332,23 @@ For more details, see @ref occt_user_guides__test_harness "Draw Test Harness Man
@section intro_req Requirements @section intro_req Requirements
Open CASCADE Technology is designed to be highly portable and is known to work on wide range of platforms. Open CASCADE Technology is designed to be highly portable and is known to
Current version is officially certified on Windows (x86-64), Linux (x86-64), OS X / macOS (x86-64, arm64), Android (arm64), and iOS (arm64) platforms. work on wide range of platforms.
Current version is officially certified on Windows (IA-32 and x86-64),
Linux (x86-64), OS X / macOS (x86-64), Android (armv7 and x86), and
iOS (armv7, arm64) platforms.
The tables below describe the recommended software configurations for which OCCT is certified to work. The tables below describe the recommended software configurations
for which OCCT is certified to work.
@subsection intro_req_cpp C++ Compiler / IDE @subsection intro_req_cpp C++ Compiler / IDE
| OS | Compiler | | OS | Compiler |
| --------- | ----------- | | --------- | ----------- |
| Windows | Microsoft Visual Studio: 2013 Update 5, 2015 Update 3, 2017 <sup>1</sup>, 2019, 2022 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)| | Windows | Microsoft Visual Studio: 2008 SP1, 2010 SP1, 2012 Update 4, 2013 Update 5, 2015 Update 3, 2017 <sup>1</sup>, 2019 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)|
| Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ | | Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ |
| OS X / macOS | XCode 6 or newer | | OS X / macOS | XCode 6 or newer |
| Android | NDK r12, GNU gcc 4.9 or newer | | Android | NDK r10, GNU gcc 4.8 or newer |
| Web | Emscripten SDK 1.39 or newer (CLang) | | Web | Emscripten SDK 1.39 or newer (CLang) |
1) VC++ 141 64-bit is used for regular testing and for building binary package of official release of OCCT on Windows. 1) VC++ 141 64-bit is used for regular testing and for building binary package of official release of OCCT on Windows.
@@ -352,35 +356,35 @@ The tables below describe the recommended software configurations for which OCCT
@subsection intro_req_libs Third-party libraries and tools @subsection intro_req_libs Third-party libraries and tools
The following third-party libraries and tools are not included in OCCT sources but are either required or can be optionally used for the indicated components of OCCT. The following third-party libraries and tools are not included in OCCT sources but are either required or can be optionally used for the indicated components of OCCT.
They are not needed if relevant component is not needed - it is possible building core OCCT modules without additional dependencies. They are not needed if relevant component is not needed.
Note that pre-built packages of many of the listed libraries are available at Note that pre-built packages of many of the listed libraries are available at
https://dev.opencascade.org/resources/download/3rd-party-components https://www.opencascade.com/content/3rd-party-components
| Component | Where to find | Used for | Purpose | | Component | Where to find | Used for | Required or optional |
| --------- | ------------- | -------- | -------------------- | | --------- | ------------- | -------- | -------------------- |
| CMake 2.8+ | https://cmake.org/ | Configuration | Build from sources | | CMake 2.8+ | https://cmake.org/ | Build from sources | Optional |
| Intel TBB 4.x or later | https://oneapi-src.github.io/oneTBB/ | All | Parallelization of algorithms (alternative to built-in thread pool) | | Intel TBB 4.x or later | https://www.threadingbuildingblocks.org/ | All | Optional (advanced parallelization of algorithms) |
| OpenGL 3.3+, OpenGL ES 2.0+ | System | Visualization | Required for using 3D Viewer | | OpenGL 3.3+, OpenGL ES 2.0+ | System | Visualization | Required |
| OpenVR 1.10+ | https://github.com/ValveSoftware/openvr | Visualization | VR (Virtual Reality) support in 3D Viewer | | OpenVR 1.10+ | https://github.com/ValveSoftware/openvr | Visualization | Optional (VR support) |
| FreeType 2.4+ | https://www.freetype.org/download.html | Visualization | Text rendering in 3D Viewer | | Direct3D 9 | Windows | Visualization | Optional (integration with GUI using Direct3D) |
| FreeImage 3.17+ | https://sourceforge.net/projects/freeimage/files | Visualization | Reading/writing image files | | FreeType 2.4.11-2.7.1 | https://sourceforge.net/projects/freetype/files/ | Visualization | Required |
| FFmpeg 3.1+ | https://www.ffmpeg.org/download.html | Visualization | Video recording | | FreeImage 3.17.0+ | https://sourceforge.net/projects/freeimage/files | Visualization | Optional (support of common 2D graphic formats) |
| VTK 6.1+ | https://www.vtk.org/download/ | IVtk | VTK integration module | | FFmpeg 3.1+ | https://www.ffmpeg.org/download.html | Visualization | Optional (video recording) |
| Flex 2.6.4+ and Bison 3.7.1+ | https://sourceforge.net/projects/winflexbison/ | Data Exchange | Updating STEP and ExprIntrp parsers | | VTK 6.1+ | https://www.vtk.org/download/ | Visualization | Optional (VTK integration) |
| RapidJSON 1.1+ | https://rapidjson.org/ | Data Exchange | Reading glTF files | | Flex 2.6.4+ and Bison 3.7.1+ | https://sourceforge.net/projects/winflexbison/ | Data Exchange | Optional (update of STEP and ExprIntrp parsers) |
| Draco 1.4.1+ | https://github.com/google/draco | Data Exchange | Reading compressed glTF files | | RapidJSON 1.1+ | https://rapidjson.org/ | Data Exchange | Optional (reading glTF files) |
| Tcl/Tk 8.6.3+ | https://www.tcl.tk/software/tcltk/download.html | DRAW Test Harness | Tcl interpretor in Draw module | | Tcl/Tk 8.6.3+ <br> or ActiveTcl 8.6 | https://www.tcl.tk/software/tcltk/download.html <br> https://www.activestate.com/activetcl/downloads | DRAW Test Harness | Required |
| Qt 5.3.2+ | https://www.qt.io/download/ | Inspector and Samples | Inspector Qt samples and | | Qt Desktop: Qt 4.8.6+ <br> Android: Qt 5.3.2+ | https://www.qt.io/download/ | Samples and demos | Optional (Qt samples) |
| Doxygen 1.8.5+ | https://www.doxygen.nl/download.html | Documentation | (Re)generating documentation | | Doxygen 1.8.5+ | https://www.doxygen.nl/download.html | Documentation | Required |
| Graphviz 2.38+ | https://graphviz.org/ | Documentation | Generating dependency graphs | | Graphviz 2.38+ | https://graphviz.org/ | Documentation | Optional (dependency graphs) |
@subsection intro_req_hw Hardware @subsection intro_req_hw Hardware
| Component | Requirement | | Component | Requirement |
| --------- | ----------- | | --------- | ----------- |
| Minimum memory | 512 MB, 1 GB recommended | | Minimum memory | 512 MB, 1 GB recommended |
| Free disk space (complete installation) | 1,5 GB approx. | | Free disk space (complete installation) | 600 MB approx. |
On desktop, 3D viewer for optimal performance requires graphics processing unit (GPU) supporting OpenGL 3.3 or above. On desktop, 3D viewer for optimal performance requires graphics processing unit (GPU) supporting OpenGL 3.3 or above.
Ray tracing requires OpenGL 4.0+ or OpenGL 3.3+ with *GL_ARB_texture_buffer_object_rgb32* extension. Ray tracing requires OpenGL 4.0+ or OpenGL 3.3+ with *GL_ARB_texture_buffer_object_rgb32* extension.
@@ -397,7 +401,7 @@ Don't forget to report these bugs to vendors.
@section intro_install Download and Installation @section intro_install Download and Installation
OCCT can be downloaded from https://dev.opencascade.org/release OCCT can be downloaded from https://www.opencascade.com/content/latest-release
In most cases you would want to rebuild OCCT from sources on your platform (OS, compiler) before In most cases you would want to rebuild OCCT from sources on your platform (OS, compiler) before
using it in your project, to ensure binary compatibility and appropriate configuration of the library. using it in your project, to ensure binary compatibility and appropriate configuration of the library.
@@ -431,7 +435,7 @@ The contents of the OCCT-7.4.0 directory (called further "OCCT root", or $CASROO
* **adm** This folder contains administration files, which allow rebuilding OCCT; * **adm** This folder contains administration files, which allow rebuilding OCCT;
* **adm/cmake** This folder contains files of CMake building procedure; * **adm/cmake** This folder contains files of CMake building procedure;
* **adm/msvc** This folder contains Visual Studio projects for Visual C++ 2013, 2015, 2017, 2019 and 2022 which allow rebuilding OCCT under Windows platform in 32 and 64-bit mode; * **adm/msvc** This folder contains Visual Studio projects for Visual C++ 2010, 2012, 2013, 2015, 2017 and 2019 which allow rebuilding OCCT under Windows platform in 32 and 64-bit mode;
* **adm/scripts** This folder contains auxiliary scripts for semi-automated building and packaging of OCCT for different platforms; * **adm/scripts** This folder contains auxiliary scripts for semi-automated building and packaging of OCCT for different platforms;
* **data** This folder contains CAD files in different formats, which can be used to test the OCCT functionality; * **data** This folder contains CAD files in different formats, which can be used to test the OCCT functionality;
* **doc** This folder contains OCCT documentation in HTML and PDF format; * **doc** This folder contains OCCT documentation in HTML and PDF format;
@@ -441,7 +445,7 @@ The contents of the OCCT-7.4.0 directory (called further "OCCT root", or $CASROO
* **src** This folder contains OCCT source files. They are organized in folders, one per development unit; * **src** This folder contains OCCT source files. They are organized in folders, one per development unit;
* **tests** This folder contains scripts for OCCT testing. * **tests** This folder contains scripts for OCCT testing.
* **tools** This folder contains sources of Inspector tool. * **tools** This folder contains sources of Inspector tool.
* **win64/vc14** This folder contains executable and library files built in optimize mode for Windows platform by Visual C++ 2015; * **win64/vc10** This folder contains executable and library files built in optimize mode for Windows platform by Visual C++ 2010;
@subsection intro_install_linux Linux @subsection intro_install_linux Linux
@@ -462,7 +466,7 @@ To run any Open CASCADE Technology application you need to set the environment v
You can define the environment variables with env.bat script located in the You can define the environment variables with env.bat script located in the
$CASROOT folder. This script accepts two arguments to be used: $CASROOT folder. This script accepts two arguments to be used:
the version of Visual Studio (vc12 -- vc142) and the architecture (win32 or win64). the version of Visual Studio (vc10 -- vc142) and the architecture (win32 or win64).
The additional environment settings necessary for compiling OCCT libraries and samples The additional environment settings necessary for compiling OCCT libraries and samples
by Microsoft Visual Studio can be set using script custom.bat located in the same folder. by Microsoft Visual Studio can be set using script custom.bat located in the same folder.
@@ -506,7 +510,7 @@ The scripts are located in the OCCT root folder.
* **CSF_ShadersDirectory** (optional) defines the directory for GLSL programs for Ray Tracing renderer (embedded resources are used when variable is undefined); * **CSF_ShadersDirectory** (optional) defines the directory for GLSL programs for Ray Tracing renderer (embedded resources are used when variable is undefined);
* **CSF_SHMessage** (optional) defines the path to the messages file for *ShapeHealing*; * **CSF_SHMessage** (optional) defines the path to the messages file for *ShapeHealing*;
* **CSF_XSMessage** (optional) defines the path to the messages file for **STEP** and **IGES** translators; * **CSF_XSMessage** (optional) defines the path to the messages file for **STEP** and **IGES** translators;
* **CSF_StandardDefaults**, **CSF_StandardLiteDefaults**, **CSF_XCAFDefaults**, and **CSF_PluginDefaults** define paths to directory where configuration files for OCAF persistence are located (required for open/save operations with OCAF documents); * **CSF_StandardDefaults**, **CSF_StandardLiteDefaults*, **CSF_XCAFDefaults**, and **CSF_PluginDefaults** define paths to directory where configuration files for OCAF persistence are located (required for open/save operations with OCAF documents);
* **CSF_IGESDefaults** and **CSF_STEPDefaults** (optional) define paths to directory where resource files of **IGES** and **STEP** translators are located; * **CSF_IGESDefaults** and **CSF_STEPDefaults** (optional) define paths to directory where resource files of **IGES** and **STEP** translators are located;
* **CSF_XmlOcafResource** is required in order to set the path to **XSD** resources, which defines XML grammar. * **CSF_XmlOcafResource** is required in order to set the path to **XSD** resources, which defines XML grammar.
* **CSF_MIGRATION_TYPES** is required in order to read documents that contain old data types, such as *TDataStd_Shape*; * **CSF_MIGRATION_TYPES** is required in order to read documents that contain old data types, such as *TDataStd_Shape*;
@@ -531,7 +535,7 @@ At minimum the following should be considered:
the application should be provided separately in a modifiable form, with all materials needed for the user to be able to run the application with a modified version of OCCT. the application should be provided separately in a modifiable form, with all materials needed for the user to be able to run the application with a modified version of OCCT.
If you want to use Open CASCADE Technology without being bound by LGPL requirements, If you want to use Open CASCADE Technology without being bound by LGPL requirements,
please <a href="https://dev.opencascade.org/webform/contact_us">contact Open CASCADE company</a> for a commercial license. please <a href="https://www.opencascade.com/contact">contact Open CASCADE company</a> for a commercial license.
Note that Open CASCADE Technology is provided on an "AS IS" basis, WITHOUT Note that Open CASCADE Technology is provided on an "AS IS" basis, WITHOUT
WARRANTY OF ANY KIND. The entire risk related to any use of the OCCT code and WARRANTY OF ANY KIND. The entire risk related to any use of the OCCT code and
@@ -592,10 +596,10 @@ If you need further information on VTK, refer to VTK Homepage https://www.vtk.or
**Doxygen** developed by Dimitri van Heesch is open source documentation system for **Doxygen** developed by Dimitri van Heesch is open source documentation system for
C++, C, Java, Objective-C, Python, IDL, PHP and C#. This product is used in Open CASCADE Technology C++, C, Java, Objective-C, Python, IDL, PHP and C#. This product is used in Open CASCADE Technology
for automatic creation of Technical Documentation from C++ header files. for automatic creation of Technical Documentation from C++ header files.
If you need further information on Doxygen, refer to https://www.doxygen.nl/index.html. If you need further information on Doxygen, refer to https://www.stack.nl/~dimitri/doxygen/index.html.
**Graphviz** is open source graph visualization software developed by John Ellson, Emden Gansner, Yifan Hu and Arif Bilgin. **Graphviz** is open source graph visualization software developed by John Ellson, Emden Gansner, Yifan Hu and Arif Bilgin.
Graph visualization is representation of structured information as diagrams of abstract graphs and networks. Graph visualization is representiation of structured information as diagrams of abstract graphs and networks.
This product is used together with Doxygen in Open CASCADE Technology for automatic creation of Technical Documentation This product is used together with Doxygen in Open CASCADE Technology for automatic creation of Technical Documentation
(generation of dependency graphs). Current versions of Graphviz are licensed on an open source (generation of dependency graphs). Current versions of Graphviz are licensed on an open source
basis under The Eclipse Public License (EPL) (https://www.graphviz.org/license/). basis under The Eclipse Public License (EPL) (https://www.graphviz.org/license/).
@@ -642,10 +646,6 @@ on this tool.
**RapidJSON** is an Open Source JSON parser and generator for C++. **RapidJSON** is an Open Source JSON parser and generator for C++.
RapidJSON is optionally used by OCCT for reading glTF files (https://rapidjson.org/). RapidJSON is optionally used by OCCT for reading glTF files (https://rapidjson.org/).
**Draco** is an Open Source JSON parser and generator for C++.
Draco is optionally used by OCCT for reading glTF files using KHR_draco_mesh_compression extension (https://github.com/google/draco).
Draco is available under Apache 2.0 license.
**DejaVu** fonts are a font family based on the Vera Fonts under a permissive license (MIT-like, https://dejavu-fonts.github.io/License.html). **DejaVu** fonts are a font family based on the Vera Fonts under a permissive license (MIT-like, https://dejavu-fonts.github.io/License.html).
DejaVu Sans (basic Latin sub-set) is used by OCCT as fallback font when no system font is available. DejaVu Sans (basic Latin sub-set) is used by OCCT as fallback font when no system font is available.

View File

@@ -21,6 +21,7 @@ FILE_PATTERNS = *.md *.dox
RECURSIVE = YES RECURSIVE = YES
SOURCE_BROWSER = NO SOURCE_BROWSER = NO
INLINE_SOURCES = YES INLINE_SOURCES = YES
COLS_IN_ALPHA_INDEX = 5
GENERATE_DOCSET = NO GENERATE_DOCSET = NO
GENERATE_CHI = NO GENERATE_CHI = NO
GENERATE_QHP = NO GENERATE_QHP = NO

View File

@@ -21,6 +21,7 @@ FILE_PATTERNS = *.md *.dox
RECURSIVE = YES RECURSIVE = YES
SOURCE_BROWSER = NO SOURCE_BROWSER = NO
INLINE_SOURCES = YES INLINE_SOURCES = YES
COLS_IN_ALPHA_INDEX = 5
GENERATE_DOCSET = NO GENERATE_DOCSET = NO
GENERATE_CHI = NO GENERATE_CHI = NO
GENERATE_QHP = NO GENERATE_QHP = NO

View File

@@ -1,911 +0,0 @@
AIS: Custom Presentation {#tutorials__ais_object}
========
@tableofcontents
@section intro Getting Started
OCCT provides a strong set of built-in Interactive Objects for rapid application development,
but the real power and flexibility of **Application Interactive Services** (@c AIS) could be revealed by subclassing and implementing custom presentations.
In this tutorial we will focus on the development of a custom @c AIS_InteractiveObject and show the basics step by step.
Let's start from the very beginning and try subclassing @c AIS_InteractiveObject object:
~~~~{.cpp}
class MyAisObject : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTI_INLINE(MyAisObject, AIS_InteractiveObject)
public:
MyAisObject() {}
public:
virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) override {}
virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode) override {}
virtual bool AcceptDisplayMode (const Standard_Integer theMode) const override
{ return true; }
};
~~~~
@c DEFINE_STANDARD_RTTI_INLINE() macro will register the new class within the OCCT Run-Time Type Information (RTTI) system.
This step is optional (you may skip it if you are not going to use methods like @c Standard_Transient::DynamicType() in application code), but it is a common practice while subclassing OCCT classes.
The @c AIS_InteractiveObject interface defines only a couple of pure virtual methods - @c @::Compute() defining an object presentation and @c @::ComputeSelection() defining a selectable (pickable) volume.
Selection and presentation are two independent mechanisms in **AIS**. Presentation rendering is done with help of OpenGL or a similar low-level graphics library, while selection doesn't depend on a graphic driver at all.
Providing an empty implementation of these two methods would be enough for adding the object to @c AIS_InteractiveContext (@c @::Display()), but obviously nothing will appear on the screen.
@section prs_builders Presentation builders
To go ahead, we need to define some presentation of our object.
OCCT provides a set of presentation building tools for common elements like arrows, shapes, boxes, etc.
These tools could be found within @c Prs3d, @c StdPrs and @c DsgPrs packages:
- **Prs3d**
provides builders for simple geometric elements.
- @c Prs3d_Arrow, @c Prs3d_BndBox, @c Prs3d_Point, @c Prs3d_Text, @c Prs3d_ToolCylinder, @c Prs3d_ToolDisk, @c Prs3d_ToolSector, @c Prs3d_ToolSphere, @c Prs3d_ToolTorus
- **StdPrs**
provides builders for analytical geometry and B-Rep shapes (@c TopoDS_Shape).
- @c StdPrs_WFShape, @c StdPrs_ShadedShape, @c StdPrs_BRepTextBuilder
- **DsgPrs**
provides builders for datums, dimensions and relations.
Presentation builders are reusable bricks for constructing @c AIS objects.
Standard OCCT interactive objects highly rely on them, so that you may easily replicate @c AIS_Shape presentation for displaying a shape with just a couple of lines calling @c StdPrs_ShadedShape:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0);
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer);
}
...
Handle(AIS_InteractiveContext) theCtx;
Handle(MyAisObject) aPrs = new MyAisObject();
theCtx->Display (aPrs, true);
~~~~
@figure{ais_object_step1_shaded.png,"@c StdPrs_ShadedShape presentation builder.",409} height=409px
@c PrsMgr_PresentableObject::Compute() method takes three arguments:
- **Presentation Manager** (@c PrsMgr_PresentationManager).
Rarely used parameter, but might be necessary for some advanced use cases.
- **Presentation** (@c Prs3d_Presentation or @c Graphic3d_Structure).
Defines the structure to fill in with presentation elements.
- **Display Mode** (integer number).
Specifies the display mode to compute.
**0** is a default display mode, if not overridden by @c AIS_InteractiveObject::SetDisplayMode() or by @c AIS_InteractiveContext::Display().
For each supported display mode, the **Presentation Manager** creates a dedicated @c Prs3d_Presentation and stores it within the object itself as a list of presentations @c PrsMgr_PresentableObject::Presentations().
It is a good practice to reject unsupported display modes within @c @::Compute() method:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
if (theMode != 0) { return; } // reject non-zero display modes
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0);
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer);
}
~~~~
This wouldn't, however, prevent application from displaying the object with another display mode like this:
~~~~{.cpp}
Handle(AIS_InteractiveContext) theCtx;
Handle(MyAisObject) aPrs = new MyAisObject();
theCtx->Display (aPrs, 100, -1, true);
~~~~
The code above will display @c MyAisObject with display mode equal to 100, and after @c @::Compute() modifications nothing will be displayed on the screen.
@c AIS will still create a presentation with specified display mode, but it will be empty - method @c @::AcceptDisplayMode() could be overridden to disallow even creation of an empty presentation:
~~~~{.cpp}
bool MyAisObject::AcceptDisplayMode (const Standard_Integer theMode) const
{
return theMode == 0; // reject non-zero display modes
}
~~~~
@c AIS_InteractiveContext::Display() checks if requested display mode is actually supported by the object, and uses default display mode (_**0**_) if it is not.
@c StdPrs_ShadedShape prepares a shaded (triangulated) presentation of a shape, while @c StdPrs_WFShape creates a wireframe presentation with B-Rep wire boundaries:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
if (!AcceptDisplayMode (theMode)) { return; }
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0);
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer); // add shading
StdPrs_WFShape::Add (thePrs, aShape, myDrawer); // add wireframe
}
~~~~
@figure{ais_object_step1_shaded_wf.png,"Result of @c StdPrs_ShadedShape + @c StdPrs_WFShape presentation builders.",409} height=409px
Presentation builders take the @c Prs3d_Drawer object defining various attributes - material of shaded shape, number of isolines in wireframe mode, tessellation quality, line colors and many others.
@c PrsMgr_PresentableObject defines @c myDrawer property with default attributes.
@c StdPrs makes it easy to display topological shapes.
With the help of @c Prs3d tools we may display elements like arrows, boxes or text labels.
Let's extend our presentation with a second **display mode 1** showing a bounding box using @c Prs3d_BndBox builder:
~~~~{.cpp}
bool MyAisObject::AcceptDisplayMode (const Standard_Integer theMode) const
{
return theMode == 0 || theMode == 1;
}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0);
if (theMode == 0)
{
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer);
StdPrs_WFShape::Add (thePrs, aShape, myDrawer); // add wireframe
}
else if (theMode == 1)
{
Bnd_Box aBox;
BRepBndLib::Add (aShape, aBox);
Prs3d_BndBox::Add (thePrs, aBox, myDrawer);
}
}
~~~~
Now, displaying an object with **display mode 1** will show a box:
~~~~{.cpp}
Handle(AIS_InteractiveContext) theCtx;
Handle(MyAisObject) aPrs = new MyAisObject();
theCtx->Display (aPrs, 1, 0, true);
~~~~
@figure{ais_object_step1_bndbox.png,"@c Prs3d_BndBox presentation builder.",409} height=409px
@c AIS disallows activating multiple display modes at the same time, so that these presentation modes should be alternatives to each other.
But @c AIS may use non-active display mode for highlighting purposes - like wireframe (@c AIS_Wireframe) presentation displayed on top of shaded (@c AIS_Shaded) presentation for selected @c AIS_Shape objects.
Let's define a dedicated enumeration for display modes supported by our interactive object and setup the 1st (@c MyDispMode_Highlight) display mode for highlighting with help of @c PrsMgr_PresentableObject::SetHilightMode():
~~~~{.cpp}
class MyAisObject : public AIS_InteractiveObject
{
public:
enum MyDispMode { MyDispMode_Main = 0, MyDispMode_Highlight = 1 };
...
MyAisObject::MyAisObject()
{
SetDisplayMode (MyDispMode_Main); // main (active) display mode
SetHilightMode (MyDispMode_Highlight); // auxiliary (highlighting) mode
}
...
Handle(AIS_InteractiveContext) theCtx;
Handle(MyAisObject) aPrs = new MyAisObject();
theCtx->Display (aPrs, MyAisObject::MyDispMode_Main, 0, false);
theCtx->HilightWithColor (aPrs, aPrs->HilightAttributes(), false);
theCtx->CurrentViewer()->Redraw();
~~~~
@figure{ais_object_step1_highlight.png,"Highlighting by color (left) and highlighting by another display mode (right).",818} height=409px
In this particular use case we've used the method @c AIS_InteractiveContext::HilightWithColor() instead of @c @::SetSelected() - just because our object is not selectable yet and @c @::SetSelected() wouldn't work.
Highlighted presentation appears on the screen with modulated color (see left screenshot above).
Using a dedicated display mode for highlighting (right screenshot above) allows customizing presentation in selected / highlighted states.
@section prim_arrays Primitive arrays
@c Prs3d_Presentation might be filled in by the following **primitives**:
- **Triangles**
- @c Graphic3d_ArrayOfTriangles
- @c Graphic3d_ArrayOfTriangleFans
- @c Graphic3d_ArrayOfTriangleStrips
- **Lines**
- @c Graphic3d_ArrayOfSegments
- @c Graphic3d_ArrayOfPolylines
- **Points** or **Markers**
- @c Graphic3d_ArrayOfPoints
This triplet of primitives is what graphics hardware is capable of rendering, so that it could be transferred directly to low-level graphics libraries in the form of *Vertex Buffer Objects* (VBO).
Each **primitive array** consists of an array of vertex attributes (_**position**, **normal**, **texture coordinates**, **vertex colors**_, etc.) and optional **array of indices**.
The latter one avoids duplicating vertices shared between connected elements (triangles, polylines) in attributes array.
@c Graphic3d_ArrayOfPrimitives and it's subclasses provide a convenient interface for filling in primitive arrays:
- Constructor takes a number of vertices, number of edges (indices) and a bitmask of optional vertex attributes.
- @c Graphic3d_ArrayOfPrimitives::AddVertex() appends a vertex with specified attributes to the end of the array (within the range specified at construction time).
- @c Graphic3d_ArrayOfPrimitives::AddEdges() appends indices, starting with 1.
Each line segment is defined by two consequential edges, each triangle is defined by three consequential edges.
Let's extend our sample and display a cylinder section contour defined by array of indexed segments (e.g. a polyline of four vertices):
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight);
if (theMode == MyDispMode_Main)
{
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer);
//StdPrs_WFShape::Add (thePrs, aShape, myDrawer);
Handle(Graphic3d_ArrayOfSegments) aSegs = new Graphic3d_ArrayOfSegments (4, 4 * 2, Graphic3d_ArrayFlags_None);
aSegs->AddVertex (gp_Pnt (0.0, -aRadius, 0.0));
aSegs->AddVertex (gp_Pnt (0.0, -aRadius, aHeight));
aSegs->AddVertex (gp_Pnt (0.0, aRadius, aHeight));
aSegs->AddVertex (gp_Pnt (0.0, aRadius, 0.0));
aSegs->AddEdges (1, 2);
aSegs->AddEdges (2, 3);
aSegs->AddEdges (3, 4);
aSegs->AddEdges (4, 1);
Handle(Graphic3d_Group) aGroupSegs = thePrs->NewGroup();
aGroupSegs->SetGroupPrimitivesAspect (myDrawer->WireAspect()->Aspect());
aGroupSegs->AddPrimitiveArray (aSegs);
}
else if (theMode == MyDispMode_Highlight) { ... }
}
~~~~
@figure{ais_object_step2_segments.png,"Displaying @c Graphic3d_ArrayOfSegments.",409} height=409px
The process is quite straightforward:
- Create a new @c Graphic3d_Group using @c Prs3d_Presentation::NewGroup();
- Specify presentation aspects using @c Graphic3d_Group::SetGroupPrimitivesAspect();
- Create and add an array of primitives using @c Graphic3d_Group::AddPrimitiveArray().
Standard presentation builders like @c StdPrs_ShadedShape / @c StdPrs_WFShape internally do exactly the same thing - a tessellated representation of a shape is added to presentation in form of triangles (shaded),
line segments (wireframe and free edges) and markers (free shape vertices).
A single @c Graphic3d_Group normally defines just a single primitive array, but it is technically possible adding more arrays to the same group @c Graphic3d_Group::AddPrimitiveArray()
and with different aspects @c Graphic3d_Group::SetPrimitivesAspect(), which might be considered in advanced scenarios.
Method @c Graphic3d_Group::AddText() allows adding text labels to a presentation.
Internally, text labels are rendered as an array of textured triangles using texture atlas created from a font, but this complex logic is hidden from the user.
@section prim_aspects Primitive aspects
@c Graphic3d_Aspects is a class defining **display properties** of a primitive array (@c Graphic3d_Group::SetGroupPrimitivesAspect()) -
_**material**, **shading model**, **color**, **texture maps**, **blending mode**, **line width**_ and others.
There are also subclasses @c Graphic3d_AspectFillArea3d (triangles), @c Graphic3d_AspectLine3d (lines), @c Graphic3d_AspectMarker3d (markers)
and @c Graphic3d_AspectText3d (text labels) defined as specializations for a specific primitive array type.
These subclasses exist for historical reasons and are treated by renderers in exactly the same way.
It is technically possible to create transient aspects directly within @c @::Compute() method like this:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
Handle(Graphic3d_Aspects) anAspects = new Graphic3d_Aspects();
anAspects->SetShadingModel (Graphic3d_TypeOfShadingModel_Unlit);
anAspects->SetColor (Quantity_NOC_RED);
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
aGroup->SetGroupPrimitivesAspect (anAspects);
...
}
~~~~
While this code would work as expected, but prevents further dynamic updates of presentation aspects without recomputing entire presentation.
Instead, it is preferred taking attributes from @c PrsMgr_PresentableObject::myDrawer / @c @::Attributes() or storing custom attributes as class fields.
@c Prs3d_Drawer defines a set of attributes used by @c AIS presentation builders, but the same parameters might be used by a custom builder as well.
It is also preferred preallocating attributes in the class constructor.
This would allow changing attributes without recomputing the entire presentation - just by calling @c PrsMgr_PresentableObject::SynchronizeAspects() after modifications.
Our custom object uses @c myDrawer->ShadingAspect() and @c myDrawer->WireAspect() aspects, so let's initialize them explicitly - assign silver material for shading and green color to line segments:
~~~~{.cpp}
MyAisObject::MyAisObject()
{
SetHilightMode (MyDispMode_Highlight);
myDrawer->SetupOwnShadingAspect();
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NameOfMaterial_Silver);
myDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_GREEN, Aspect_TOL_SOLID, 2.0));
}
~~~~
@section quadric_builders Quadric builders
Previously, we've used @c StdPrs_ShadedShape for displaying cylinder geometry.
The @c Prs3d package provides a simpler way for displaying geometry like cylinders, spheres and toruses - based on the @c Prs3d_ToolQuadric interface.
This interface allows bypassing creation of a complex B-Rep (@c TopoDS_Shape) definition of a simple geometry, and to avoid using general-purpose tessellators like @c BRepMesh.
> This difference could be negligible for a small number of such objects, but might become considerable for larger amounts.
> The B-Rep definition of a valid cylinder includes 2 unique @c TopoDS_Vertex, 3 @c TopoDS_Edge, 3 @c TopoDS_Wire, 3 @c TopoDS_Face, 1 @c TopoDS_Shell and 1 @c TopoDS_Solid.
> Internally each @c TopoDS_Edge also defines curves (@c Geom_Curve as well as 2D parametric @c Geom2d_Curve) and each @c TopoDS_Face defines analytical surface (@c Geom_Surface).
> Meshing such geometry with the help of @c BRepMesh is much more complicated than one may think.
> A plenty of data structures (memory!) and computations (time!) for displaying a geometry that could be triangulated by a simple for loop.
@c Prs3d_ToolQuadric solves this problem by creating a triangulation for such kinds of shapes in a straight-forward way.
Let's try using @c Prs3d_ToolCylinder in our sample:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight);
if (theMode == MyDispMode_Main)
{
//StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer); // add shading
//StdPrs_WFShape::Add (thePrs, aShape, myDrawer); // add wireframe
Handle(Graphic3d_ArrayOfTriangles) aTris =
Prs3d_ToolCylinder::Create (aRadius, aRadius, aHeight, 10, 10, gp_Trsf());
Handle(Graphic3d_Group) aGroupTris = thePrs->NewGroup();
aGroupTris->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroupTris->AddPrimitiveArray (aTris);
...
}
...
}
~~~~
@figure{ais_object_step3_quadrics_10.png,"@c Prs3d_ToolCylinder (10 slices).",409} height=409px
Well... that looks a little bit edgy.
Quadric builder creates a triangulation taking the following parameters:
- Geometry parameters.
(in case of a cylinder - base radius, top radius and height).
- Number of subdivisions along U (slices) and V (stacks) parameters.
In some cases only one parametric scope matters.
- Transformation @c gp_Trsf to apply
(original geometry is defined within some reference coordinate system).
Let's increase number of subdivisions from _10_ to _25_:
~~~~{.cpp}
Handle(Graphic3d_ArrayOfTriangles) aTris =
Prs3d_ToolCylinder::Create (aRadius, aRadius, aHeight, 25, 25, gp_Trsf());
~~~~
@figure{ais_object_step3_quadrics_25.png,"@c Prs3d_ToolCylinder (25 slices).",409} height=409px
It looks much better now! Note that @c Prs3d_ToolCylinder could be used for building both cones and cylinders depending on top/bottom radius definition.
There is one issue though - our cylinder doesn't have top and bottom anymore!
To fix this problem we will use one more quadric builder @c Prs3d_ToolDisk:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
if (theMode == MyDispMode_Main)
{
Prs3d_ToolCylinder aCyl (aRadius, aRadius, aHeight, 25, 25);
Prs3d_ToolDisk aDisk (0.0, aRadius, 25, 1);
Handle(Graphic3d_ArrayOfTriangles) aTris =
new Graphic3d_ArrayOfTriangles (aCyl.VerticesNb() + 2 * aDisk.VerticesNb(),
3 * (aCyl.TrianglesNb() + 2 * aDisk.TrianglesNb()),
Graphic3d_ArrayFlags_VertexNormal);
aCyl .FillArray (aTris, gp_Trsf());
aDisk.FillArray (aTris, gp_Trsf());
gp_Trsf aDisk2Trsf;
aDisk2Trsf.SetTransformation (gp_Ax3 (gp_Pnt (0.0, 0.0, aHeight), -gp::DZ(), gp::DX()), gp::XOY());
aDisk.FillArray (aTris, aDisk2Trsf);
Handle(Graphic3d_Group) aGroupTris = thePrs->NewGroup();
aGroupTris->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroupTris->AddPrimitiveArray (aTris);
aGroupTris->SetClosed (true);
...
}
}
~~~~
Now our cylinder looks solid! The sample above merges two triangulations into a single one instead of appending each primitive array individually.
This looks like a minor difference, but it might have a _dramatic impact on performance_ in case of a large scene,
as each `Graphic3d_ArrayOfPrimitives` is mapped into a dedicated draw call at graphic driver (OpenGL) level.
@figure{ais_object_step3_quadrics_fin.png,"@c Prs3d_ToolCylinder + @c Prs3d_ToolDisk.",409} height=409px
As an exercise, let's try computing a triangulation for cylinder disk without help of @c Prs3d_ToolDisk builder:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
if (theMode == MyDispMode_Main)
{
const int aNbSlices = 25;
Prs3d_ToolCylinder aCyl (aRadius, aRadius, aHeight, aNbSlices, aNbSlices);
Handle(Graphic3d_ArrayOfTriangles) aTris =
new Graphic3d_ArrayOfTriangles (aCyl.VerticesNb(),
3 * (aCyl.TrianglesNb()),
Graphic3d_ArrayFlags_VertexNormal);
aCyl.FillArray (aTris, gp_Trsf());
Handle(Graphic3d_ArrayOfTriangles) aTris2 =
new Graphic3d_ArrayOfTriangles (aNbSlices + 1, aNbSlices * 3, Graphic3d_ArrayFlags_VertexNormal);
aTris2->AddVertex (gp_Pnt (0.0, 0.0, aHeight), -gp::DZ());
for (int aSliceIter = 0; aSliceIter < aNbSlices; ++aSliceIter)
{
double anAngle = M_PI * 2.0 * double(aSliceIter) / double(aNbSlices);
aTris2->AddVertex (gp_Pnt (Cos (anAngle) * aRadius, Sin (anAngle) * aRadius, aHeight), -gp::DZ());
}
for (int aSliceIter = 0; aSliceIter < aNbSlices; ++aSliceIter)
{
aTris2->AddEdges (1, aSliceIter + 2, aSliceIter + 1 < aNbSlices ? (aSliceIter + 3) : 2);
}
Handle(Graphic3d_Group) aGroupTris = thePrs->NewGroup();
aGroupTris->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroupTris->AddPrimitiveArray (aTris);
aGroupTris->AddPrimitiveArray (aTris2);
...
}
}
~~~~
@figure{ais_object_step3_quadrics_disk.png,"Manually triangulated disk.",409} height=409px
The disk is here, but it has a strange color - like it is not affected by lighting.
This happens when vertex normals are defined incorrectly.
In our case we defined disk normal as @c -DZ (see the second argument of @c Graphic3d_ArrayOfTriangles::AddVertex()),
but normal direction should be also aligned to triangulation winding rule.
Graphic driver defines the front side of triangle using clockwise order of triangle nodes, and normal should be defined for a front side of triangle - e.g. it should be @c gp::DZ() in our case.
After reversing vertex normal direction, cylinder looks exactly like when @c Prs3d_ToolDisk was used.
Front / back face orientation might be displayed using different material based on @c Graphic3d_Aspects::SetDistinguish() flag and @c @::FrontMaterial() / @c @::BackMaterial() setup.
@section ais_selection Computing selection
In the first part of the tutorial we have created a custom @c AIS object @c MyAisObject computing presentation by implementing the @c PrsMgr_PresentableObject::Compute() interface.
In this part we will extend our object with interactive capabilities and make it selectable through implementing @c SelectMgr_SelectableObject interface.
Let's do the first step and put into @c @::ComputeSelection() method some logic.
This method should fill in the @c SelectMgr_Selection argument with @c SelectMgr_SensitiveEntity entities defining selectable elements - triangulations, polylines, points and their composition.
@c Select3D_SensitiveBox is probably the simplest way to define selectable volume - by it's bounding box:
~~~~{.cpp}
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight);
Bnd_Box aBox;
BRepBndLib::Add (aShape, aBox);
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this);
Handle(Select3D_SensitiveBox) aSensBox = new Select3D_SensitiveBox (anOwner, aBox);
theSel->Add (aSensBox);
}
~~~~
@c SelectMgr_EntityOwner is a key object in selection logic - it serves as an identifier of a pickable object or it's part.
You may see this object in methods like @c AIS_InteractiveContext::DetectedOwner(), **Owners** are stored within the list of selection objects @c AIS_Selection
and it received by methods like @c AIS_InteractiveContext::SetSelected() and @c AIS_InteractiveContext::AddOrRemoveSelected().
From the Selector's point of view, @c AIS_InteractiveObject is just a drawer for @c SelectMgr_EntityOwner.
The _**0th selection mode**_ normally defines a single Owner of the entire object.
To make a composite object selectable as whole, we add to Selection as many SensitiveEntity as necessary referring to the same Owner.
It might look confusing from first glance, that @c SelectMgr_SensitiveEntity stores @c SelectMgr_EntityOwner as a class field, and not in the opposite way
(@c SelectMgr_EntityOwner doesn't store the list of @c SelectMgr_SensitiveEntity defining it's picking volume).
For local selection (selection of object parts) we create individual Owners for each part and add SensitiveEntity to Selection in the same way.
Owner may store an additional identifier as a class field, like @c StdSelect_BRepOwner stores @c TopoDS_Shape as an identifier of picked sub-shape with @c AIS_Shape object.
In a similar way as @c StdPrs_ShadedShape is a **presentation builder** for @c TopoDS_Shape, the @c StdSelect_BRepSelectionTool can be seen as a standard **selection builder** for shapes:
~~~~{.cpp}
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight);
Standard_Real aDefl = StdPrs_ToolTriangulatedShape::GetDeflection (aShape, myDrawer);
StdSelect_BRepSelectionTool::Load (theSel, this, aShape, TopAbs_SHAPE, aDefl,
myDrawer->DeviationAngle(),
myDrawer->IsAutoTriangulation());
}
~~~~
Internally, @c StdSelect_BRepSelectionTool iterates over sub-shapes and appends to the Selection (@c theSel) entities like @c Select3D_SensitiveTriangulation (for faces) and @c Select3D_SensitiveCurve (for edges).
Previously, we have used @c Prs3d_ToolCylinder to triangulate a cylinder, so let's try to construct @c Select3D_SensitivePrimitiveArray from the same triangulation:
~~~~{.cpp}
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this);
Handle(Graphic3d_ArrayOfTriangles) aTris =
Prs3d_ToolCylinder::Create (aRadius, aRadius, aHeight, 25, 25, gp_Trsf());
Handle(Select3D_SensitivePrimitiveArray) aSensTri =
new Select3D_SensitivePrimitiveArray (anOwner);
aSensTri->InitTriangulation (aTris->Attributes(), aTris->Indices(),
TopLoc_Location());
theSel->Add (aSensTri);
}
~~~~
Selection is computed independently from presentation, so that they don't have to match each other.
But inconsistency between presentation and selection might confuse a user, when he will not be able to pick an object clearly displayed under the mouse cursor.
These issues might happen, for example, when selection uses tessellated representation of the same geometry computed with different parameters (different number of subdivisions, or different deflection parameters).
As in case of @c @::Compute(), it makes sense defining some enumeration of **selection modes** supported by specific object and reject unsupported ones to avoid unexpected behavior:
~~~~{.cpp}
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
if (theMode != 0) { return; }
...
}
~~~~
Unlike display modes, @c AIS_InteractiveContext allows activating an arbitrary combination of selection modes.
A user should be careful to activate only the modes that actually make sense and may work together.
Selection mode to activate could be specified while displaying the object (passing _**-1**_ instead of _**0**_ would display an object with deactivated selection):
~~~~{.cpp}
Handle(AIS_InteractiveContext) theCtx;
Handle(MyAisObject) aPrs = new MyAisObject();
theCtx->Display (aPrs, MyAisObject::MyDispMode_Main, 0, false);
~~~~
Later on @c AIS_InteractiveContext::SetSelectionModeActive(), or it's wrappers @c AIS_InteractiveContext::Activate() and @c AIS_InteractiveContext::Deactivate(),
could be used to enable or disable desired selection modes one by one.
@section sel_owner_highlight Highlighting selection owner
As has been mentioned in the previous section, @c SelectMgr_EntityOwner is a key object which can be used as an identifier of selectable part(s).
Naturally, you might want to subclass it to put some application-specific ids for identification of selected parts.
But there are more things you may do with the Owner class like customized highlighting.
Let's start from the beginning and define a custom Owner class:
~~~~{.cpp}
class MyAisOwner : public SelectMgr_EntityOwner
{
DEFINE_STANDARD_RTTI_INLINE(MyAisOwner, SelectMgr_EntityOwner)
public:
MyAisOwner (const Handle(MyAisObject)& theObj, int thePriority = 0)
: SelectMgr_EntityOwner (theObj, thePriority) {}
virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode) override
{ base_type::HilightWithColor (thePrsMgr, theStyle, theMode); }
virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Standard_Integer theMode) override
{ base_type::Unhilight (thePrsMgr, theMode); }
protected:
Handle(Prs3d_Presentation) myPrs;
};
~~~~
@c SelectMgr_EntityOwner doesn't define any pure virtual methods, and can be instanced straight ahead, like it was done within @c MyAisObject::ComputeSelection() implementation above.
Let's revert usage of a dedicated display mode for highlighting (remove @c SetHilightMode() in @c MyAisObject constructor) and use our new class @c MyAisOwner within @c @::ComputeSelection():
~~~~{.cpp}
MyAisObject::MyAisObject()
{
//SetHilightMode (MyDispMode_Highlight);
myDrawer->SetupOwnShadingAspect();
...
}
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
Handle(MyAisOwner) anOwner = new MyAisOwner (this);
...
}
~~~~
The further logic creating sensitive entities and filling in Selection could be left as is.
Substitution of @c SelectMgr_EntityOwner with @c MyAisOwner currently doesn't change behavior and we see highlighting of the entire object through color modulation.
This is because default implementation of @c SelectMgr_EntityOwner for highlighting logic looks like this (simplified):
~~~~{.cpp}
void SelectMgr_EntityOwner::HilightWithColor (
const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
const Graphic3d_ZLayerId aHiLayer =
theStyle->ZLayer() != Graphic3d_ZLayerId_UNKNOWN
? theStyle->ZLayer()
: mySelectable->ZLayer();
thePrsMgr->Color (mySelectable, theStyle, theMode, NULL, aHiLayer);
}
~~~~
@figure{ais_object_step4_highlight1.png,"Default behavior of @c SelectMgr_EntityOwner::HilightWithColor().",409} height=409px
Now, let's override the @c SelectMgr_EntityOwner::HilightWithColor() method and display a bounding box presentation:
~~~~{.cpp}
void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
if (myPrs.IsNull())
{
myPrs = new Prs3d_Presentation (thePrsMgr->StructureManager());
MyAisObject* anObj = dynamic_cast<MyAisObject*> (mySelectable);
anObj->Compute (thePrsMgr, myPrs, MyAisObject::MyDispMode_Highlight);
}
if (!thePrsMgr->IsImmediateModeOn())
{
myPrs->Display();
}
}
~~~~
@c SelectMgr_EntityOwner::HilightWithColor() doesn't receive a presentation to fill in as an argument; highlight presentation should be manually created and even explicitly displayed on the screen.
To avoid code duplication, the code above reuses @c MyAisObject::Compute() already implementing computation of highlight presentation.
@figure{ais_object_step4_highlight2.png,"Result of custom implementation @c MyAisOwner::HilightWithColor().",409} height=409px
The visual result of the selected object looks exactly the same as when we've used a dedicated highlight mode.
One thing became broken, though - highlighting remains displayed even after clearing selection.
To fix this issue, we need implementing @c SelectMgr_EntityOwner::Unhilight() and hide our custom presentation explicitly:
~~~~{.cpp}
void MyAisOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Standard_Integer theMode)
{
if (!myPrs.IsNull()) { myPrs->Erase(); }
}
~~~~
Another problem is that the object is no longer dynamically highlighted.
To fix that we need to handle @c PrsMgr_PresentationManager::IsImmediateModeOn() specifically.
Within this mode turned ON, presentation should be displayed on the screen with help of @c PrsMgr_PresentationManager::AddToImmediateList() method
(it will be cleared from the screen automatically on the next mouse movement):
~~~~{.cpp}
void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
if (myPrs.IsNull())
{
myPrs = new Prs3d_Presentation (thePrsMgr->StructureManager());
MyAisObject* anObj = dynamic_cast<MyAisObject*> (mySelectable);
anObj->Compute (thePrsMgr, myPrs, MyAisObject::MyDispMode_Highlight);
}
if (thePrsMgr->IsImmediateModeOn())
{
Handle(Prs3d_PresentationShadow) aShadow =
new Prs3d_PresentationShadow (thePrsMgr->StructureManager(), myPrs);
aShadow->SetZLayer (Graphic3d_ZLayerId_Top);
aShadow->Highlight (theStyle);
thePrsMgr->AddToImmediateList (aShadow);
}
else
{
myPrs->Display();
}
}
~~~~
We may create two dedicated presentations for dynamic highlighting or reuse existing one for both cases with help of a transient object @c Prs3d_PresentationShadow.
Let's go further and make dynamic highlighting a little bit more interesting - by drawing a surface normal at the point where mouse picked the object:
~~~~{.cpp}
void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
MyAisObject* anObj = dynamic_cast<MyAisObject*> (mySelectable);
if (thePrsMgr->IsImmediateModeOn())
{
Handle(StdSelect_ViewerSelector) aSelector =
anObj->InteractiveContext()->MainSelector();
SelectMgr_SortCriterion aPickPnt;
for (int aPickIter = 1; aPickIter <= aSelector->NbPicked(); ++aPickIter)
{
if (aSelector->Picked (aPickIter) == this)
{
aPickPnt = aSelector->PickedData (aPickIter);
break;
}
}
Handle(Prs3d_Presentation) aPrs = mySelectable->GetHilightPresentation (thePrsMgr);
aPrs->SetZLayer (Graphic3d_ZLayerId_Top);
aPrs->Clear();
Handle(Graphic3d_Group) aGroup = aPrs->NewGroup();
aGroupPnt->SetGroupPrimitivesAspect (theStyle->ArrowAspect()->Aspect());
gp_Trsf aTrsfInv = mySelectable->LocalTransformation().Inverted();
gp_Dir aNorm (aPickPnt.Normal.x(), aPickPnt.Normal.y(), aPickPnt.Normal.z());
Handle(Graphic3d_ArrayOfTriangles) aTris =
Prs3d_Arrow::DrawShaded (gp_Ax1(aPickPnt.Point, aNorm).Transformed (aTrsfInv),
1.0, 15.0,
3.0, 4.0, 10);
aGroupPnt->AddPrimitiveArray (aTris);
thePrsMgr->AddToImmediateList (aPrs);
}
}
~~~~
Code above does not store our new highlight presentation as a property of @c MyAisOwner, and instead uses @c SelectMgr_SelectableObject::GetHilightPresentation() method
to create a presentation stored directly inside of our interactive object.
Next trick is passing through the last picking results in @c StdSelect_ViewerSelector.
Dynamic highlighting is expected to be called right after picking, so that highlighted Owner should be always found in picking results.
@c StdSelect_ViewerSelector::Picked() returns entities in the descending order of their distance from picking ray origin (mouse cursor);
normally our Owner should be the very first one in this list when no selection filters are assigned to @c AIS_InteractiveContext.
@c SelectMgr_SortCriterion provides us useful information like 3D point on detected object lying on the picking ray, and surface normal direction at this point (actually, it would be a normal to a picked triangle),
which we display as an arrow with help of @c Prs3d_Arrow presentation builder.
@figure{ais_object_step4_highlight3.png,"Surface normal on mouse over.",409} height=409px
Result looks pretty nice on the screenshot, but has interaction problems - once displayed, an arrow is no longer updated with further mouse movements.
But this behavior is not a bug - @c AIS calls @c MyAisOwner::HilightWithColor() only when picking Owner changes to avoid unnecessary Viewer updates.
To override this behavior, we may override @c SelectMgr_EntityOwner::IsForcedHilight() option:
~~~~{.cpp}
class MyAisOwner : public SelectMgr_EntityOwner
{
...
virtual bool IsForcedHilight() const override { return true; }
};
~~~~
This solves the problem within our specific use case.
Keep in mind that most objects don't need updating highlight presentation on every mouse move;
overriding this flag everywhere would be a waste of resources and may cause performance issues - use it sparingly.
@section highlight_apporaches Highlighting approaches
@c AIS provides one more alternative to handle presentation highlighting, which is managed by option @c SelectMgr_SelectableObject::IsAutoHilight().
By default, this option is turned ON and redirects highlighting logic to @c SelectMgr_EntityOwner::HilightWithColor() demonstrated in the previous section.
Turning this option OFF redirects highlighting logic to the interactive object itself @c SelectMgr_SelectableObject::HilightSelected().
Apart from moving the logic from Owner to Interactive Object, this approach allows handling highlighting of all selected Owners within the same Object at once and sharing a common presentation
instead of per-Owner presentation - improving performance and reducing memory utilization in case of a large number of small selectable elements, like mesh nodes in @c MeshVS_Mesh object.
The further optimization of such a scenario would be using a single Owner for the entire Object
storing the list of selected elements within the Owner itself - as utilized by @c AIS_PointCloud object for highlighting individual points.
We wouldn't describe these advanced techniques here in detail - let's just summarize main highlighting approaches available in @c AIS:
- Highlighting of a main presentation of Interactive Object (active display mode)
filled in by @c PrsMgr_PresentableObject::Compute()
and displayed with color modulation by @c AIS logic.
- Example: @c AIS_TextLabel.
- Highlighting of a secondary presentation of Interactive Object
filled in by @c PrsMgr_PresentableObject::Compute()
and displayed with color modulation by @c AIS logic.
- Example: @c AIS_Shape, displayed in @c AIS_Shaded display mode and highlighted using @c AIS_Wireframe display mode (default behavior).
See also @c PrsMgr_PresentableObject::SetHilightMode().
- Highlight presentation stored within a custom @c SelectMgr_EntityOwner
and managed by @c SelectMgr_EntityOwner::HilightWithColor().
- Example: @c StdSelect_BRepOwner for selection of sub-shapes.
- Custom highlight presentation stored within Interactive Object itself
(see @c SelectMgr_SelectableObject::GetHilightPresentation() / @c @::GetSelectPresentation() methods).
- Filled in by @c SelectMgr_EntityOwner::HilightWithColor()
with @c SelectMgr_SelectableObject::IsAutoHilight() turned ON.<br>
Example: @c AIS_PointCloud.
- Filled in by @c SelectMgr_SelectableObject::HilightSelected()
with @c SelectMgr_SelectableObject::IsAutoHilight() turned OFF.<br>
Example: @c MeshVS_Mesh.
- Main presentation of Interactive Object (active display mode)
filled in by @c PrsMgr_PresentableObject::Compute()
and manually updated (recomputed or modified aspects) on highlight events.
- Example: @c AIS_Manipulator.
The number of options looks overwhelming but in general, it is better to stick to the simplest approach working for you and consider alternatives only when you have to.
@section mouse_click Mouse click
Dynamic highlighting is only one of scenarios where @c SelectMgr_EntityOwner could be useful.
Another feature is an interface for handling a mouse click @c SelectMgr_EntityOwner @c @::HandleMouseClick().
This interface is useful for defining some user interface elements like buttons, and most likely your application will use a more comprehensive GUI framework for this purpose instead of @c AIS.
But let's have some fun and make our object to change a color on each mouse click:
~~~~{.cpp}
class MyAisOwner : public SelectMgr_EntityOwner
{
...
virtual bool HandleMouseClick (const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButton,
Aspect_VKeyFlags theModifiers,
bool theIsDoubleClick) override;
};
bool MyAisOwner::HandleMouseClick (const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButton,
Aspect_VKeyFlags theModifiers,
bool theIsDoubleClick)
{
static math_BullardGenerator aRandGen;
Quantity_Color aRandColor (float(aRandGen.NextInt() % 256) / 255.0f,
float(aRandGen.NextInt() % 256) / 255.0f,
float(aRandGen.NextInt() % 256) / 255.0f,
Quantity_TOC_sRGB);
mySelectable->Attributes()->ShadingAspect()->SetColor(aRandColor);
mySelectable->SynchronizeAspects();
return true;
}
~~~~
Looks pretty simple. Now let's make things more interesting and launch some simple object animation on each click.
We use a couple of global (@c static) variables in our sample for simplicity - don't do that in a real production code.
~~~~{.cpp}
class MyAisOwner : public SelectMgr_EntityOwner
{
...
void SetAnimation (const Handle(AIS_Animation)& theAnim)
{ myAnim = theAnim; }
...
Handle(AIS_Animation) myAnim;
};
bool MyAisOwner::HandleMouseClick (const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButton,
Aspect_VKeyFlags theModifiers,
bool theIsDoubleClick)
{
static bool isFirst = true;
isFirst = !isFirst;
MyAisObject* anObj = dynamic_cast<MyAisObject*> (mySelectable);
gp_Trsf aTrsfTo;
aTrsfTo.SetRotation (gp_Ax1 (gp::Origin(), gp::DX()),
isFirst ? M_PI * 0.5 : -M_PI * 0.5);
gp_Trsf aTrsfFrom = anObj->LocalTransformation();
Handle(AIS_AnimationObject) anAnim =
new AIS_AnimationObject ("MyAnim", anObj->InteractiveContext(),
anObj, aTrsfFrom, aTrsfTo);
anAnim->SetOwnDuration (2.0);
myAnim->Clear();
myAnim->Add (anAnim);
myAnim->StartTimer (0.0, 1.0, true);
return true;
}
~~~~
Animation is a complex topic that is worth a dedicated article - let's not go too deep in detail here.
To perform animation in a non-interrupted way, it should be handled by some class like @c AIS_ViewController, which is responsible for managing user input events and for 3D viewer updates.
To utilize it, you need adding a custom object animation to @c AIS_ViewController::ObjectsAnimation() or adding custom view animation to @c AIS_ViewController::ViewAnimation().
Somewhere in application this might look like this:
~~~~{.cpp}
Handle(AIS_InteractiveContext) theCtx;
Handle(AIS_ViewController) theViewCtrl;
Handle(MyAisObject) aPrs = new MyAisObject();
aPrs->SetAnimation (theViewCtrl->ObjectsAnimation());
theCtx->Display (aPrs, MyAisObject::MyDispMode_Main, 0, false);
~~~~
@section final Final result
The final sample could be seen by calling @c QATutorialAisObject command from Draw Harness plugin @c QAcommands (@c TKQADraw toolkit):
~~~~
pload VISUALIZATION QAcommands
vinit View1
QATutorialAisObject p
vfit
~~~~
You may also take a look onto source code of this command at @c src/QADraw/QADraw_Tutorials.cxx if you have some problems following the tutorial.

View File

@@ -1,4 +1,4 @@
Draw: Demo Scripts {#samples__draw_scripts} Draw Demo Scripts {#samples__draw_scripts}
================ ================
All demo scripts are provided with OCCT sources and locate in <i>CASROOT/samples/tcl</i>. To play around them please All demo scripts are provided with OCCT sources and locate in <i>CASROOT/samples/tcl</i>. To play around them please

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

View File

@@ -1,115 +0,0 @@
Novice Guide {#samples__novice_guide}
=======
@tableofcontents
@section diffs Modeling with OCCT: Key differences
Open CASCADE Technology (OCCT) is an object-oriented C++ framework designed for rapid production of sophisticated CAD/CAM/CAE applications.
In other words, it provides endless possibilities for raw 2D and 3D modeling in C++ environment.
Unlike end-user software, it is used by the application developers and therefore strongly differs from the most popular CAD/CAM/CAE software packages.
OCCT provides building blocks enough for modeling, editing, visualization, and data interoperability of 2D and 3D objects.
By using OCCT, users can create the objects of their desire (or edit already existing ones) using raw code commands.
It is a more complicated process than using GUI-based software, but it provides much more flexibility than even script-based manipulations that are available within existing CAD/CAM/CAE applications.
However, to fully grasp the possibilities of OCCT it is best for the user to have previous experience in C++ at least at a basic level.
@section basics Understanding the principles
If you don't have any programming skills, grasping the full magnitude of OCCT workflow is still an option.
The documentation for OCCT contains several entry points for new users.
It will not explain all OCCT classes but will help to comprehend the workflow and help start thinking in terms of Open CASCADE Technology.
The most basic workflow is described in the @ref occt__tutorial "OCCT Tutorial" - this is an excellent starting point for new users.
In this tutorial you will create a solid model step-by-step using different classes and methods.
Each step of the tutorial contains code snippets and images.
The basics involved in the modeling process are explained.
When the basics of OCCT are clear, the next logical step is to check out @ref samples "sample applications" and examine those that suit your needs.
For these, the best starting point is **OCCTOverview** located in /samples/qt subfolder of OCCT installation.
This sample provides code examples for several actions as well as visualization of these code snippets output.
The Overview interface is dynamically changing based on selected **Category** at the menu.
Additional menu buttons will appear, providing users with subcategories and relevant commands to select one of the actions.
The result will appear in the viewer window, the code will appear at the top right, and in several cases the output will be produced at the bottom right window.
@figure{sample_overview_qt_viewers.png,"Comparison of 3D and 2D viewer windows",240} height=420px
The 3D viewer window has a row of preset interface buttons to customize the visual output.
Those buttons can be grouped into three types, left to right:
- View controls: **Fit all** and **Isometric**, will center the view and reset the camera angles respectively;
- Display mode customization: **HLR,** e.g. "Hidden line removal" (works only when shading is disabled) can be turned on and off;
solid models may be displayed either in **Shading** or **Wireframe** modes. **Transparency** level may be set for models in shading mode;
- The last four buttons in a row are beautifiers enabling Ray-tracing engine and configuring it's parameters.
At the bottom left of the screen the orientation cube (trihedron) is located.
The trihedron interactively shows the position of the camera in relation to the XYZ axis of the displayed data.
The sides of the trihedron are labeled to help with orientation.
Click on a side of the box to orient the camera view along the preferred axis.
The 2D viewer window lacks most of these elements and only have **Fit all** button.
The **Geometry** category of the Overview focuses on primitive objects like dots, lines (including vectors) or planes.
These objects will appear in the viewer after the subcategory is selected.
This section will demonstrate these entities both in 2D and 3D view mode and provide basic examples of parametric creation and data analysis.
@figure{sample_overview_qt_geometry.png,"",240} height=440px
The usage of the functions shown in the Overview is described more thoroughly at the @ref occt_user_guides__modeling_data "Modeling data" section of the documentation.
Additionally, @ref occt_user_guides__modeling_algos "Modeling Algorithms" are used in more complex cases.
The **Topology** section of the Overview demonstrates the functions used in 3D operations.
Multiple use cases are provided, including different object intersections, modifying and calculations.
Some of these use cases are described in the documentation, such as @ref occt_user_guides__inspector "Inspector" usage.
@figure{sample_overview_qt_topology.png,"",240} height=440px
The subsections are grouped as shown on the screenshot before.
Most shapes and primitive objects are introduced and then followed by a set of operations and interactions.
The **Triangulation** segment allows computing the number of triangles on a shape.
This may be inspected via [Poly_Triangulation Class Reference](https://dev.opencascade.org/doc/refman/html/class_poly___triangulation.html) -
a part of the [Reference manual](https://dev.opencascade.org/doc/refman/html/index.html),
an overall Open CASCADE code guide that may be used to inspect the key points in classes and their connections.
@figure{sample_overview_qt_triangulation.png,"",240} height=440px
The triangulation uses some of Mesh-related classes - see full description at @ref occt_user_guides__mesh "Mesh" documentation section.
The **Data exchange** section provides examples of how to export and import files of several different formats.
@figure{sample_overview_qt_xde.png,"",240} height=440px
The **OCAF** section gives an introduction for the @ref intro_overview_ocaf "Open CASCADE Application Framework" functionality.
To test these functions, create an object first (box or cylinder).
After that, the object may be modified and saved. Actions are recorded and may be undone or redone.
@figure{sample_overview_qt_ocaf.png,"",240} height=440px
**Viewers** section demonstrates examples of the 2D and 3D visualization outputs.
Check @ref occt_user_guides__visualization "Visualization" section of the documentation for a detailed description.
In addition to these two samples, there are much more that might be of use to a new user based on their particular use case.
Check Readme files in the sample directories to learn more about samples compilation.
**Note:** source code for OCCTOverview is stored at 'samples/qt/OCCTOverview/src' folder in your OCCT root,
and the source code files for examples presented in subsections are stored at 'samples/OCCTOverview/code folder'.
Several utility classes that are not presented in the example window may be found in example source code files.
The overall classes introduction may be found in the @ref occt_user_guides__foundation_classes "Foundation Classes" section of the documentation.
The "Introduction" section contains short descriptions of the most massive entries in the documentation.
@section helps Additional assistance
There are several places that may be of use for new users.
The first one is [Training & E-learning](https://dev.opencascade.org/resources/trainings) page that lists available trainings and describes their specifics.
The second one is the Overview documentation (this document is a part of it) - here you can find information that suits most of the use cases.
This may seem overwhelming at first, but if you have the clear understanding of what do you seek, you will most likely find the required information.
Aside from the Overview documentation itself, the [Reference manual](https://dev.opencascade.org/doc/refman/html/index.html) is present.
Use it to check classes descriptions, dependencies and examples.
Additionally, there is a [Forum](https://dev.opencascade.org/forums) where you can contact the OCCT community and developers.

View File

@@ -1,76 +1,82 @@
OCAF: Usage Tutorial {#samples__ocaf} OCAF Usage {#samples__ocaf}
======== ========
## Getting Started ## Getting Started
At the beginning of your development, you first define an application class by inheriting from the Application abstract class.
You only have to create and determine the resources of the application for specifying the format of your documents (you generally use the standard one) and their file extension.
Then, you design the application data model by organizing attributes you choose among those provided with OCAF.
You can specialize these attributes using the User attribute. For example, if you need a reflection coefficient,
you aggregate a User attribute identified as a reflection coefficient
with a Real attribute containing the value of the coefficient (as such, you don't define a new class).
If you need application specific data not provided with OCAF, for example, to incorporate a finite element model in the data structure,
you define a new attribute class containing the mesh, and you include its persistent homologue in a new file format.
Once you have implemented the commands which create and modify the data structure according to your specification, OCAF provides you, without any additional programming:
* Persistent reference to any data, including geometric elements - several documents can be linked with such reference;
* Document-View association;
* Ready-to-use functions such as:
* Undo-redo;
* Save and open application data.
Finally, you develop the application's graphical user interface using the toolkit of your choice, for example:
* KDE Qt or GNOME GTK+ on Linux;
* Microsoft Foundation Classes (MFC) on Windows Motif on Sun;
* Other commercial products such as Ilog Views.
You can also implement the user interface in the Java language using the Swing-based Java Application Desktop component (JAD) provided with OCAF.
At the beginning of your development, you first define an application class by inheriting from the Application abstract class.
You only have to create and determine the resources of the application
for specifying the format of your documents (you generally use the standard one) and their file extension.
Then, you design the application data model by organizing attributes you choose among those provided with OCAF.
You can specialize these attributes using the User attribute. For example, if you need a reflection coefficient,
you aggregate a User attribute identified as a reflection coefficient
with a Real attribute containing the value of the coefficient (as such, you don't define a new class).
If you need application specific data not provided with OCAF, for example,
to incorporate a finite element model in the data structure,
you define a new attribute class containing the mesh,
and you include its persistent homologue in a new file format.
Once you have implemented the commands which create and modify the data structure
according to your specification, OCAF provides you, without any additional programming:
* Persistent reference to any data, including geometric elements â€" several documents can be linked with such reference;
* Document-View association;
* Ready-to-use functions such as :
* Undo-redo;
* Save and open application data.
Finally, you develop the application's graphical user interface using the toolkit of your choice, for example:
* KDE Qt or GNOME GTK+ on Linux;
* Microsoft Foundation Classes (MFC) on Windows Motif on Sun;
* Other commercial products such as Ilog Views.
You can also implement the user interface in the Java language using
the Swing-based Java Application Desktop component (JAD) provided with OCAF.
## An example of OCAF usage ## An example of OCAF usage
To create a useful OCAF-based application, it is necessary to redefine two deferred methods: <i>Formats</i> and <i>ResourcesName</i> To create a useful OCAF-based application, it is necessary to redefine two deferred methods: <i> Formats</i> and <i> ResourcesName</i>
In the <i>Formats</i> method, add the format of the documents, which need to be read by the application and may have been built in other applications. In the <i> Formats </i> method, add the format of the documents, which need to be read by the application and may have been built in other applications.
For example: For example:
~~~~{.cpp} ~~~~
void myApplication::Formats(TColStd_SequenceOfExtendedString& Formats) void myApplication::Formats(TColStd_SequenceOfExtendedString& Formats)
{ {
Formats.Append(TCollection_ExtendedString ("OCAF-myApplication")); Formats.Append(TCollection_ExtendedString ("OCAF-myApplication"));
} }
~~~~ ~~~~
In the <i>ResourcesName</i> method, you only define the name of the resource file. In the <i> ResourcesName</i> method, you only define the name of the resource file. This
This file contains several definitions for the saving and opening mechanisms associated with each format and calling of the plug-in file. file contains several definitions for the saving and opening mechanisms associated
with each format and calling of the plug-in file.
~~~~{.cpp} ~~~~
Standard_CString myApplication::ResourcesName() Standard_CString myApplication::ResourcesName()
{ {
return Standard_CString ("Resources"); return Standard_CString ("Resources");
} }
~~~~ ~~~~
To obtain the saving and opening mechanisms, it is necessary to set two environment variables: <i>CSF_PluginDefaults</i>, which defines the path of the plug-in file, To obtain the saving and opening mechanisms, it is necessary to set two environment variables: <i> CSF_PluginDefaults</i>, which defines the path of the plug-in file, and <i> CSF_ResourcesDefault</i>, which defines the resource file:
and <i>CSF_ResourcesDefault</i>, which defines the resource file:
~~~~{.cpp} ~~~~
SetEnvironmentVariable ("CSF_ResourcesDefaults", myDirectory); SetEnvironmentVariable ( "CSF_ResourcesDefaults",myDirectory);
SetEnvironmentVariable ("CSF_PluginDefaults", myDirectory); SetEnvironmentVariable ( "CSF_PluginDefaults",myDirectory);
~~~~ ~~~~
The plugin and the resource files of the application will be located in <i>myDirector</i>. The plugin and the resource files of the application will be located in <i> myDirector</i>.
The name of the plugin file must be <i>Plugin</i>. The name of the plugin file must be <i>Plugin</i>.
### Resource File ### Resource File
The resource file describes the documents (type and extension) and the type of data that the application can manipulate The resource file describes the documents (type and extension) and
the type of data that the application can manipulate
by identifying the storage and retrieval drivers appropriate for this data. by identifying the storage and retrieval drivers appropriate for this data.
Each driver is unique and identified by a GUID generated, for example, with the <i>uuidgen</i> tool in Windows. Each driver is unique and identified by a GUID generated, for example, with the <i> uuidgen </i> tool in Windows.
Five drivers are required to use all standard attributes provided within OCAF: Five drivers are required to use all standard attributes provided within OCAF:
@@ -80,7 +86,8 @@ Five drivers are required to use all standard attributes provided within OCAF:
* the attribute storage driver (47b0b826-d931-11d1-b5da-00a0c9064368) * the attribute storage driver (47b0b826-d931-11d1-b5da-00a0c9064368)
* the attribute retrieval driver (47b0b827-d931-11d1-b5da-00a0c9064368) * the attribute retrieval driver (47b0b827-d931-11d1-b5da-00a0c9064368)
These drivers are provided as plug-ins and are located in the <i>PappStdPlugin</i> library. These drivers are provided as plug-ins and are located in the <i> PappStdPlugin</i> library.
For example, this is a resource file, which declares a new model document OCAF-MyApplication: For example, this is a resource file, which declares a new model document OCAF-MyApplication:
@@ -97,11 +104,12 @@ OCAF-MyApplication.AttributeRetrievalPlugin: 47b0b827-d931-11d1-b5da-00a0c906436
### Plugin File ### Plugin File
The plugin file describes the list of required plug-ins to run the application and the libraries in which plug-ins are located. The plugin file describes the list of required plug-ins to run the application and the
libraries in which plug-ins are located.
You need at least the <i>FWOSPlugin</i> and the plug-in drivers to run an OCAF application. You need at least the <i> FWOSPlugin</i> and the plug-in drivers to run an OCAF application.
The syntax of each item is <i>Identification.Location Library_Name</i>, where: The syntax of each item is <i> Identification.Location Library_Name, </i> where:
* Identification is GUID. * Identification is GUID.
* Location defines the location of the Identification (where its definition is found). * Location defines the location of the Identification (where its definition is found).
* Library_Name is the name (and path to) the library, where the plug-in is located. * Library_Name is the name (and path to) the library, where the plug-in is located.
@@ -117,414 +125,412 @@ ad696002-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin
47b0b826-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin 47b0b826-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin
47b0b827-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin 47b0b827-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin
~~~~ ~~~~
## Implementation of Attribute Transformation in a HXX file ## Implementation of Attribute Transformation in a HXX file
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
#include <TDF_Attribute.hxx> \#include <TDF_Attribute.hxx>
#include <gp_Ax3.hxx> \#include <gp_Ax3.hxx>
#include <gp_Pnt.hxx> \#include <gp_Pnt.hxx>
#include <gp_Vec.hxx> \#include <gp_Vec.hxx>
#include <gp_Trsf.hxx> \#include <gp_Trsf.hxx>
//! This attribute implements a transformation data container //! This attribute implements a transformation data container
class MyPackage_Transformation : public TDF_Attribute class MyPackage_Transformation : public TDF_Attribute
{ {
public: //!@ name Static methods public:
//!@ name Static methods
//! The method returns a unique GUID of this attribute. //! The method returns a unique GUID of this attribute.
//! By means of this GUID this attribute may be identified //! By means of this GUID this attribute may be identified
//! among other attributes attached to the same label. //! among other attributes attached to the same label.
Standard_EXPORT static const Standard_GUID& GetID (); Standard_EXPORT static const Standard_GUID& GetID ();
//! Finds or creates the attribute attached to <theLabel>. //! Finds or creates the attribute attached to <theLabel>.
//! The found or created attribute is returned. //! The found or created attribute is returned.
Standard_EXPORT static Handle(MyPackage_Transformation) Set (const TDF_Label theLabel); Standard_EXPORT static Handle(MyPackage_Transformation) Set (const TDF_Label theLabel);
public: //!@ name Methods for access to the attribute data //!@ name Methods for access to the attribute data
//! The method returns the transformation.
Standard_EXPORT gp_Trsf Get () const;
//! The method returns the transformation. //!@ name Methods for setting the data of transformation
Standard_EXPORT gp_Trsf Get () const;
public: //!@ name Methods for setting the data of transformation //! The method defines a rotation type of transformation.
Standard_EXPORT void SetRotation (const gp_Ax1& theAxis, Standard_Real theAngle);
//! The method defines a rotation type of transformation. //! The method defines a translation type of transformation.
Standard_EXPORT void SetRotation (const gp_Ax1& theAxis, Standard_Real theAngle); Standard_EXPORT void SetTranslation (const gp_Vec& theVector);
//! The method defines a translation type of transformation. //! The method defines a point mirror type of transformation (point symmetry).
Standard_EXPORT void SetTranslation (const gp_Vec& theVector); Standard_EXPORT void SetMirror (const gp_Pnt& thePoint);
//! The method defines a point mirror type of transformation (point symmetry). //! The method defines an axis mirror type of transformation (axial symmetry).
Standard_EXPORT void SetMirror (const gp_Pnt& thePoint); Standard_EXPORT void SetMirror (const gp_Ax1& theAxis);
//! The method defines an axis mirror type of transformation (axial symmetry). //! The method defines a point mirror type of transformation (planar symmetry).
Standard_EXPORT void SetMirror (const gp_Ax1& theAxis); Standard_EXPORT void SetMirror (const gp_Ax2& thePlane);
//! The method defines a point mirror type of transformation (planar symmetry). //! The method defines a scale type of transformation.
Standard_EXPORT void SetMirror (const gp_Ax2& thePlane); Standard_EXPORT void SetScale (const gp_Pnt& thePoint, Standard_Real theScale);
//! The method defines a scale type of transformation.
Standard_EXPORT void SetScale (const gp_Pnt& thePoint, Standard_Real theScale);
//! The method defines a complex type of transformation from one coordinate system to another. //! The method defines a complex type of transformation from one coordinate system to another.
Standard_EXPORT void SetTransformation (const gp_Ax3& theCoordinateSystem1, const gp_Ax3& theCoordinateSystem2); Standard_EXPORT void SetTransformation (const gp_Ax3& theCoordinateSystem1, const gp_Ax3& theCoordinateSystem2);
public: //!@ name Overridden methods from TDF_Attribute //!@ name Overridden methods from TDF_Attribute
//! The method returns a unique GUID of the attribute.
//! By means of this GUID this attribute may be identified among other attributes attached to the same label.
Standard_EXPORT const Standard_GUID& ID () const;
//! The method returns a unique GUID of the attribute. //! The method is called on Undo / Redo.
//! By means of this GUID this attribute may be identified among other attributes attached to the same label. //! It copies the content of theAttribute into this attribute (copies the fields).
Standard_EXPORT const Standard_GUID& ID () const; Standard_EXPORT void Restore (const Handle(TDF_Attribute)& theAttribute);
//! The method is called on Undo / Redo. //! It creates a new instance of this attribute.
//! It copies the content of theAttribute into this attribute (copies the fields). //! It is called on Copy / Paste, Undo / Redo.
Standard_EXPORT void Restore (const Handle(TDF_Attribute)& theAttribute);
//! It creates a new instance of this attribute.
//! It is called on Copy / Paste, Undo / Redo.
Standard_EXPORT Handle(TDF_Attribute) NewEmpty () const; Standard_EXPORT Handle(TDF_Attribute) NewEmpty () const;
//! The method is called on Copy / Paste. //! The method is called on Copy / Paste.
//! It copies the content of this attribute into theAttribute (copies the fields). //! It copies the content of this attribute into theAttribute (copies the fields).
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theAttribute, const Handle(TDF_RelocationTable)& theRelocationTable); Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theAttribute, const Handle(TDF_RelocationTable)& theRelocationTable);
//! Prints the content of this attribute into the stream. //! Prints the content of this attribute into the stream.
Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS); Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS);
public: //!@ name Constructor //!@ name Constructor
//! The C++ constructor of this attribute class. //! The C++ constructor of this attribute class.
//! Usually it is never called outside this class. //! Usually it is never called outside this class.
Standard_EXPORT MyPackage_Transformation(); Standard_EXPORT MyPackage_Transformation();
private: private:
gp_TrsfForm myType; gp_TrsfForm myType;
// Axes (Ax1, Ax2, Ax3) // Axes (Ax1, Ax2, Ax3)
gp_Ax1 myAx1; gp_Ax1 myAx1;
gp_Ax2 myAx2; gp_Ax2 myAx2;
gp_Ax3 myFirstAx3; gp_Ax3 myFirstAx3;
gp_Ax3 mySecondAx3; gp_Ax3 mySecondAx3;
// Scalar values // Scalar values
Standard_Real myAngle; Standard_Real myAngle;
Standard_Real myScale; Standard_Real myScale;
// Points // Points
gp_Pnt myFirstPoint; gp_Pnt myFirstPoint;
gp_Pnt mySecondPoint; gp_Pnt mySecondPoint;
}; };
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## Implementation of Attribute Transformation in a CPP file ## Implementation of Attribute Transformation in a CPP file
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
#include <MyPackage_Transformation.hxx> \#include <MyPackage_Transformation.hxx>
//=======================================================================
//function : GetID
//purpose : The method returns a unique GUID of this attribute.
// By means of this GUID this attribute may be identified
// among other attributes attached to the same label.
//=======================================================================
const Standard_GUID& MyPackage_Transformation::GetID()
{
static Standard_GUID ID("4443368E-C808-4468-984D-B26906BA8573");
return ID;
}
//=======================================================================
//function : Set
//purpose : Finds or creates the attribute attached to <theLabel>.
// The found or created attribute is returned.
//=======================================================================
Handle(MyPackage_Transformation) MyPackage_Transformation::Set(const TDF_Label& theLabel)
{
Handle(MyPackage_Transformation) T;
if (!theLabel.FindAttribute(MyPackage_Transformation::GetID(), T))
{
T = new MyPackage_Transformation();
theLabel.AddAttribute(T);
}
return T;
}
//=======================================================================
//function : Get
//purpose : The method returns the transformation.
//=======================================================================
gp_Trsf MyPackage_Transformation::Get() const
{
gp_Trsf transformation;
switch (myType)
{
case gp_Identity:
{
break;
}
case gp_Rotation:
{
transformation.SetRotation(myAx1, myAngle);
break;
}
case gp_Translation:
{
transformation.SetTranslation(myFirstPoint, mySecondPoint);
break;
}
case gp_PntMirror:
{
transformation.SetMirror(myFirstPoint);
break;
}
case gp_Ax1Mirror:
{
transformation.SetMirror(myAx1);
break;
}
case gp_Ax2Mirror:
{
transformation.SetMirror(myAx2);
break;
}
case gp_Scale:
{
transformation.SetScale(myFirstPoint, myScale);
break;
}
case gp_CompoundTrsf:
{
transformation.SetTransformation(myFirstAx3, mySecondAx3);
break;
}
case gp_Other:
{
break;
}
}
return transformation;
}
//=======================================================================
//function : SetRotation
//purpose : The method defines a rotation type of transformation.
//=======================================================================
void MyPackage_Transformation::SetRotation(const gp_Ax1& theAxis, const Standard_Real theAngle)
{
Backup();
myType = gp_Rotation;
myAx1 = theAxis;
myAngle = theAngle;
}
//=======================================================================
//function : SetTranslation
//purpose : The method defines a translation type of transformation.
//=======================================================================
void MyPackage_Transformation::SetTranslation(const gp_Vec& theVector)
{
Backup();
myType = gp_Translation;
myFirstPoint.SetCoord(0, 0, 0);
mySecondPoint.SetCoord(theVector.X(), theVector.Y(), theVector.Z());
}
//=======================================================================
//function : SetMirror
//purpose : The method defines a point mirror type of transformation
// (point symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Pnt& thePoint)
{
Backup();
myType = gp_PntMirror;
myFirstPoint = thePoint;
}
//=======================================================================
//function : SetMirror
//purpose : The method defines an axis mirror type of transformation
// (axial symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Ax1& theAxis)
{
Backup();
myType = gp_Ax1Mirror;
myAx1 = theAxis;
}
//=======================================================================
//function : SetMirror
//purpose : The method defines a point mirror type of transformation
// (planar symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Ax2& thePlane)
{
Backup();
myType = gp_Ax2Mirror;
myAx2 = thePlane;
}
//=======================================================================
//function : SetScale
//purpose : The method defines a scale type of transformation.
//=======================================================================
void MyPackage_Transformation::SetScale(const gp_Pnt& thePoint, const Standard_Real theScale)
{
Backup();
myType = gp_Scale;
myFirstPoint = thePoint;
myScale = theScale;
}
//=======================================================================
//function : SetTransformation
//purpose : The method defines a complex type of transformation
// from one coordinate system to another.
//=======================================================================
void MyPackage_Transformation::SetTransformation(const gp_Ax3& theCoordinateSystem1,
const gp_Ax3& theCoordinateSystem2)
{
Backup();
myFirstAx3 = theCoordinateSystem1;
mySecondAx3 = theCoordinateSystem2;
}
//=======================================================================
//function : ID
//purpose : The method returns a unique GUID of the attribute.
// By means of this GUID this attribute may be identified
// among other attributes attached to the same label.
//=======================================================================
const Standard_GUID& MyPackage_Transformation::ID() const
{
return GetID();
}
//=======================================================================
//function : Restore
//purpose : The method is called on Undo / Redo.
// It copies the content of <theAttribute>
// into this attribute (copies the fields).
//=======================================================================
void MyPackage_Transformation::Restore(const Handle(TDF_Attribute)& theAttribute)
{
Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute);
myType = theTransformation->myType;
myAx1 = theTransformation->myAx1;
myAx2 = theTransformation->myAx2;
myFirstAx3 = theTransformation->myFirstAx3;
mySecondAx3 = theTransformation->mySecondAx3;
myAngle = theTransformation->myAngle;
myScale = theTransformation->myScale;
myFirstPoint = theTransformation->myFirstPoint;
mySecondPoint = theTransformation->mySecondPoint;
}
//=======================================================================
//function : NewEmpty
//purpose : It creates a new instance of this attribute.
// It is called on Copy / Paste, Undo / Redo.
//=======================================================================
Handle(TDF_Attribute) MyPackage_Transformation::NewEmpty() const
{
return new MyPackage_Transformation();
}
//=======================================================================
//function : Paste
//purpose : The method is called on Copy / Paste.
// It copies the content of this attribute into
// <theAttribute> (copies the fields).
//=======================================================================
void MyPackage_Transformation::Paste(const Handle(TDF_Attribute)& theAttribute,
const Handle(TDF_RelocationTable)& ) const
{
Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute);
theTransformation->myType = myType;
theTransformation->myAx1 = myAx1;
theTransformation->myAx2 = myAx2;
theTransformation->myFirstAx3 = myFirstAx3;
theTransformation->mySecondAx3 = mySecondAx3;
theTransformation->myAngle = myAngle;
theTransformation->myScale = myScale;
theTransformation->myFirstPoint = myFirstPoint;
theTransformation->mySecondPoint = mySecondPoint;
}
//=======================================================================
//function : Dump
//purpose : Prints the content of this attribute into the stream.
//=======================================================================
Standard_OStream& MyPackage_Transformation::Dump(Standard_OStream& anOS) const
{
anOS = "Transformation: ";
switch (myType)
{
case gp_Identity:
{
anOS = "gp_Identity";
break;
}
case gp_Rotation:
{
anOS = "gp_Rotation";
break;
}
case gp_Translation:
{
anOS = "gp_Translation";
break;
}
case gp_PntMirror:
{
anOS = "gp_PntMirror";
break;
}
case gp_Ax1Mirror:
{
anOS = "gp_Ax1Mirror";
break;
}
case gp_Ax2Mirror:
{
anOS = "gp_Ax2Mirror";
break;
}
case gp_Scale:
{
anOS = "gp_Scale";
break;
}
case gp_CompoundTrsf:
{
anOS = "gp_CompoundTrsf";
break;
}
case gp_Other:
{
anOS = "gp_Other";
break;
}
}
return anOS;
}
//======================================================================= //=======================================================================
//function : GetID //function : MyPackage_Transformation
//purpose : The method returns a unique GUID of this attribute. //purpose : A constructor.
// By means of this GUID this attribute may be identified
// among other attributes attached to the same label.
//======================================================================= //=======================================================================
const Standard_GUID& MyPackage_Transformation::GetID() MyPackage_Transformation::MyPackage_Transformation():myType(gp_Identity){
{
static Standard_GUID ID("4443368E-C808-4468-984D-B26906BA8573");
return ID;
} }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//======================================================================= ## Implementation of typical actions with standard OCAF attributes.
//function : Set
//purpose : Finds or creates the attribute attached to <theLabel>.
// The found or created attribute is returned.
//=======================================================================
Handle(MyPackage_Transformation) MyPackage_Transformation::Set(const TDF_Label& theLabel)
{
Handle(MyPackage_Transformation) T;
if (!theLabel.FindAttribute(MyPackage_Transformation::GetID(), T))
{
T = new MyPackage_Transformation();
theLabel.AddAttribute(T);
}
return T;
}
//======================================================================= There are four sample files provided in the directory 'OpenCasCade/ros/samples/ocafsamples'. They present typical actions with OCAF services (mainly for newcomers).
//function : Get
//purpose : The method returns the transformation.
//=======================================================================
gp_Trsf MyPackage_Transformation::Get() const
{
gp_Trsf transformation;
switch (myType)
{
case gp_Identity:
{
break;
}
case gp_Rotation:
{
transformation.SetRotation(myAx1, myAngle);
break;
}
case gp_Translation:
{
transformation.SetTranslation(myFirstPoint, mySecondPoint);
break;
}
case gp_PntMirror:
{
transformation.SetMirror(myFirstPoint);
break;
}
case gp_Ax1Mirror:
{
transformation.SetMirror(myAx1);
break;
}
case gp_Ax2Mirror:
{
transformation.SetMirror(myAx2);
break;
}
case gp_Scale:
{
transformation.SetScale(myFirstPoint, myScale);
break;
}
case gp_CompoundTrsf:
{
transformation.SetTransformation(myFirstAx3, mySecondAx3);
break;
}
case gp_Other:
{
break;
}
}
return transformation;
}
//=======================================================================
//function : SetRotation
//purpose : The method defines a rotation type of transformation.
//=======================================================================
void MyPackage_Transformation::SetRotation(const gp_Ax1& theAxis, const Standard_Real theAngle)
{
Backup();
myType = gp_Rotation;
myAx1 = theAxis;
myAngle = theAngle;
}
//=======================================================================
//function : SetTranslation
//purpose : The method defines a translation type of transformation.
//=======================================================================
void MyPackage_Transformation::SetTranslation(const gp_Vec& theVector)
{
Backup();
myType = gp_Translation;
myFirstPoint.SetCoord(0, 0, 0);
mySecondPoint.SetCoord(theVector.X(), theVector.Y(), theVector.Z());
}
//=======================================================================
//function : SetMirror
//purpose : The method defines a point mirror type of transformation
// (point symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Pnt& thePoint)
{
Backup();
myType = gp_PntMirror;
myFirstPoint = thePoint;
}
//=======================================================================
//function : SetMirror
//purpose : The method defines an axis mirror type of transformation
// (axial symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Ax1& theAxis)
{
Backup();
myType = gp_Ax1Mirror;
myAx1 = theAxis;
}
//=======================================================================
//function : SetMirror
//purpose : The method defines a point mirror type of transformation
// (planar symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Ax2& thePlane)
{
Backup();
myType = gp_Ax2Mirror;
myAx2 = thePlane;
}
//=======================================================================
//function : SetScale
//purpose : The method defines a scale type of transformation.
//=======================================================================
void MyPackage_Transformation::SetScale(const gp_Pnt& thePoint, const Standard_Real theScale)
{
Backup();
myType = gp_Scale;
myFirstPoint = thePoint;
myScale = theScale;
}
//=======================================================================
//function : SetTransformation
//purpose : The method defines a complex type of transformation
// from one coordinate system to another
//=======================================================================
void MyPackage_Transformation::SetTransformation (const gp_Ax3& theCoordinateSystem1,
const gp_Ax3& theCoordinateSystem2)
{
Backup();
myFirstAx3 = theCoordinateSystem1;
mySecondAx3 = theCoordinateSystem2;
}
//=======================================================================
//function : ID
//purpose : The method returns a unique GUID of the attribute.
// By means of this GUID this attribute may be identified
// among other attributes attached to the same label.
//=======================================================================
const Standard_GUID& MyPackage_Transformation::ID() const
{
return GetID();
}
//=======================================================================
//function : Restore
//purpose : The method is called on Undo / Redo.
// It copies the content of <theAttribute>
// into this attribute (copies the fields).
//=======================================================================
void MyPackage_Transformation::Restore(const Handle(TDF_Attribute)& theAttribute)
{
Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute);
myType = theTransformation->myType;
myAx1 = theTransformation->myAx1;
myAx2 = theTransformation->myAx2;
myFirstAx3 = theTransformation->myFirstAx3;
mySecondAx3 = theTransformation->mySecondAx3;
myAngle = theTransformation->myAngle;
myScale = theTransformation->myScale;
myFirstPoint = theTransformation->myFirstPoint;
mySecondPoint = theTransformation->mySecondPoint;
}
//=======================================================================
//function : NewEmpty
//purpose : It creates a new instance of this attribute.
// It is called on Copy / Paste, Undo / Redo.
//=======================================================================
Handle(TDF_Attribute) MyPackage_Transformation::NewEmpty() const
{
return new MyPackage_Transformation();
}
//=======================================================================
//function : Paste
//purpose : The method is called on Copy / Paste.
// It copies the content of this attribute into
// <theAttribute> (copies the fields).
//=======================================================================
void MyPackage_Transformation::Paste (const Handle(TDF_Attribute)& theAttribute,
const Handle(TDF_RelocationTable)& ) const
{
Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute);
theTransformation->myType = myType;
theTransformation->myAx1 = myAx1;
theTransformation->myAx2 = myAx2;
theTransformation->myFirstAx3 = myFirstAx3;
theTransformation->mySecondAx3 = mySecondAx3;
theTransformation->myAngle = myAngle;
theTransformation->myScale = myScale;
theTransformation->myFirstPoint = myFirstPoint;
theTransformation->mySecondPoint = mySecondPoint;
}
//=======================================================================
//function : Dump
//purpose : Prints the content of this attribute into the stream.
//=======================================================================
Standard_OStream& MyPackage_Transformation::Dump(Standard_OStream& theOS) const
{
anOS << "Transformation: ";
switch (myType)
{
case gp_Identity:
{
anOS << "gp_Identity";
break;
}
case gp_Rotation:
{
anOS << "gp_Rotation";
break;
}
case gp_Translation:
{
anOS << "gp_Translation";
break;
}
case gp_PntMirror:
{
anOS << "gp_PntMirror";
break;
}
case gp_Ax1Mirror:
{
anOS << "gp_Ax1Mirror";
break;
}
case gp_Ax2Mirror:
{
anOS << "gp_Ax2Mirror";
break;
}
case gp_Scale:
{
anOS << "gp_Scale";
break;
}
case gp_CompoundTrsf:
{
anOS << "gp_CompoundTrsf";
break;
}
case gp_Other:
{
anOS << "gp_Other";
break;
}
}
return anOS;
}
//=======================================================================
//function : MyPackage_Transformation
//purpose : A constructor.
//=======================================================================
MyPackage_Transformation::MyPackage_Transformation()
: myType (gp_Identity)
{
//
}
~~~~
## Implementation of typical actions with standard OCAF attributes.
There are four sample files provided in the directory 'OpenCasCade/ros/samples/ocafsamples'.
They present typical actions with OCAF services (mainly for newcomers).
The method *Sample()* of each file is not dedicated for execution 'as is', it is rather a set of logical actions using some OCAF services. The method *Sample()* of each file is not dedicated for execution 'as is', it is rather a set of logical actions using some OCAF services.
### TDataStd_Sample.cxx ### TDataStd_Sample.cxx
@@ -543,7 +549,7 @@ This sample contains templates for typical actions with the following standard O
- TDataXtd_Constraint attribute management; - TDataXtd_Constraint attribute management;
- TDataStd_Directory attribute management; - TDataStd_Directory attribute management;
- TDataStd_TreeNode attribute management. - TDataStd_TreeNode attribute management.
### TDocStd_Sample.cxx ### TDocStd_Sample.cxx
This sample contains template for the following typical actions: This sample contains template for the following typical actions:
- creating application; - creating application;
@@ -554,7 +560,7 @@ This sample contains template for the following typical actions:
- closing a document; - closing a document;
- opening the document stored in the file; - opening the document stored in the file;
- copying content of a document to another document with possibility to update the copy in the future. - copying content of a document to another document with possibility to update the copy in the future.
### TPrsStd_Sample.cxx ### TPrsStd_Sample.cxx
This sample contains template for the following typical actions: This sample contains template for the following typical actions:
- starting with data framework; - starting with data framework;
@@ -571,7 +577,7 @@ This sample contains template for the following typical actions:
- updating and displaying presentation of the attribute to be displayed; - updating and displaying presentation of the attribute to be displayed;
- setting a color to the displayed attribute; - setting a color to the displayed attribute;
- getting transparency of the displayed attribute; - getting transparency of the displayed attribute;
- modify attribute; - modify attribute;
- updating presentation of the attribute in viewer. - updating presentation of the attribute in viewer.
### TNaming_Sample.cxx ### TNaming_Sample.cxx
@@ -585,3 +591,4 @@ The following scenario is used:
- creating a Fillet (using the selected edges) and pushing the result as a modification of Box1; - creating a Fillet (using the selected edges) and pushing the result as a modification of Box1;
- creating a Cut (Box1, Box2) as a modification of Box1 and push it in DF; - creating a Cut (Box1, Box2) as a modification of Box1 and push it in DF;
- recovering the result from DF. - recovering the result from DF.

View File

@@ -1,4 +1,4 @@
OCAF: Function Mechanism {#samples__ocaf_func} Function Mechanism Usage {#samples__ocaf_func}
======================== ========================
Let us describe the usage of the "Function Mechanism" of Open CASCADE Application Framework on a simple example. Let us describe the usage of the "Function Mechanism" of Open CASCADE Application Framework on a simple example.
@@ -160,7 +160,7 @@ drivers for a function driver table with the help of *TFunction_DriverTable* cl
This is an example of the code for iteration and execution of functions. This is an example of the code for iteration and execution of functions.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
// The scope of functions is defined. // The scope of functions is defined.
Handle(TFunction_Scope) scope = TFunction_Scope::Set( anyLabel ); Handle(TFunction_Scope) scope = TFunction_Scope::Set( anyLabel );
@@ -180,7 +180,7 @@ drivers for a function driver table with the help of *TFunction_DriverTable* cl
const TDF_LabelList&amp; currentFunctions = iterator.Current(); const TDF_LabelList&amp; currentFunctions = iterator.Current();
//The list of current functions is iterated. //The list of current functions is iterated.
TDF_ListIteratorOfLabelList currentterator( currentFunctions ); TDF_ListIteratorOfLabelList currentterator( currentFucntions );
for (; currentIterator.More(); currentIterator.Next()) for (; currentIterator.More(); currentIterator.Next())
{ {
// An interface for the function is created. // An interface for the function is created.
@@ -200,14 +200,14 @@ drivers for a function driver table with the help of *TFunction_DriverTable* cl
} // end of iteration of current functions } // end of iteration of current functions
} // end of iteration of functions. } // end of iteration of functions.
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### Example 2: Cylinder function driver ### Example 2: Cylinder function driver
This is an example of the code for a cylinder function driver. To make the things clearer, the methods This is an example of the code for a cylinder function driver. To make the things clearer, the methods
<i>\::Arguments()</i> and <i>\::Results()</i> from the base class are also mentioned. <i>\::Arguments()</i> and <i>\::Results()</i> from the base class are also mentioned.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
// A virtual method ::Arguments() returns a list of arguments of the function. // A virtual method ::Arguments() returns a list of arguments of the function.
CylinderDriver::Arguments( TDF_LabelList&amp; args ) CylinderDriver::Arguments( TDF_LabelList&amp; args )
@@ -283,4 +283,4 @@ drivers for a function driver table with the help of *TFunction_DriverTable* cl
return 0; return 0;
} }
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -1,62 +1,176 @@
Tutorials and Samples {#samples} Tutorials and Samples {#samples}
===================== =====================
- @subpage samples__tutorials Tutorial: Modelling a Bottle
* @ref samples__novice_guide ----------------------------
<br>A document providing an introductory information to newcomers. The Qt programming tutorial teaches how to use Open CASCADE Technology services to model a 3D object.
* @ref samples__draw_scripts The purpose of the tutorial is not to explain all OCCT classes but
<br>A set of demo scripts demonstrating OCCT functionality from DRAW. to help start thinking in terms of the Open CASCADE Technology.
These scripts can be also considered as a tutorials on **Tcl** usage within @ref occt_user_guides__test_harness "Draw Harness".
* @ref occt__tutorial
<br>A programming tutorial teaching how to use OCCT services to model a 3D object.
See also @ref samples_qt_tutorial
* @ref samples__ocaf
<br>A set of code snippets performing typical actions with @ref occt_user_guides__ocaf "OCAF" services for newcomers.
* @ref samples__ocaf_func
<br>A simple example dedicated to the usage of "Function Mechanism" of @ref occt_user_guides__ocaf "OCCT Application Framework".
* @ref tutorials__ais_object
<br>A programming tutorial teaching how to compute presentation within AIS_InteractiveObject subclass for displaying in @ref occt_user_guides__visualization "OCCT 3D Viewer".
- @subpage samples__projects
* @ref samples_qt_iesample
<br>A cross-platform multi-document 3D Viewer sample with CAD import / export functionality based on **Qt Widgets** framework.
* @ref samples_qml_android_occt
<br>A cross-platform 3D Viewer sample with CAD import based on **QtQuick** framework.
* @ref samples_qt_tutorial
<br>A cross-platform sample application based on **Qt Widgets** framework and implementing @ref occt__tutorial.
* @ref samples_qt_overview
<br>A sample application interactively demonstrating OCCT C++ usage with code snippets for newcomers.
* @ref samples_mfc_standard
<br>A set of projects for Windows platform demonstrating OCCT usage based on **Microsoft Foundation Class** (**MFC**) library.
* @ref samples_csharp_occt
<br>A Multi-document 3D Viewer sample with CAD import / export functionality based on .NET and **Windows Forms** or **WPF**.
* @ref samples_csharp_direct3d
<br>3D Viewer sample wrapped into Direct3D context based on .NET and **Windows Presentation Foundation** (**WPF**).
* @ref occt_samples_webgl
<br>3D Viewer sample based on **Emscripten SDK** representing a static HTML page to be opened in Web Browser.
* @ref samples_java_android_occt
<br>3D Viewer sample with CAD import for Android mobile platform based on Android SDK and JNI layer.
* @ref occt_samples_ios_uikit
<br>3D Viewer sample for iOS platform based on Apple **UIKit** framework.
* @ref occt_samples_glfw
<br>A cross-platform 3D Viewer sample using **GLFW** library.
@page samples__tutorials Tutorials and Demos This tutorial assumes that the user has experience in using and setting up C++.
- @subpage samples__novice_guide From the viewpoint of programming, Open CASCADE Technology is designed
- @subpage samples__draw_scripts to enhance user's C++ tools with high performance modeling classes, methods and functions.
- @subpage occt__tutorial The combination of these resources allows creating substantial applications.
- @subpage samples__ocaf
- @subpage samples__ocaf_func
- @subpage tutorials__ais_object
@page samples__projects Sample Projects Read more about @subpage occt__tutorial
- @subpage samples_qt_iesample
- @subpage samples_qml_android_occt MFC
- @subpage samples_qt_tutorial ---------
- @subpage samples_qt_overview
- @subpage samples_mfc_standard Visual C++ programming samples containing 10 Visual C++ projects
- @subpage samples_csharp_occt illustrating how to use a particular module or functionality.
- @subpage samples_csharp_direct3d
- @subpage occt_samples_webgl The list of MFC samples:
- @subpage samples_java_android_occt
- @subpage occt_samples_ios_uikit * Geometry
- @subpage occt_samples_glfw * Modeling
* Viewer2d
* Viewer3d
* ImportExport
* Ocaf
* Triangulation
* HLR
* Animation
* Convert
@figure{/samples/images/samples_mvc.png}
**Remarks:**
* MFC samples are available only on Windows platform;
* To start a sample use Open CASCADE Technology\\Samples\\Mfc\\ item of the Start\\Programs menu;
* Read carefully readme.txt to learn about launching and compilation options.
See @subpage samples_mfc_standard "Readme" for details.
Qt
---
OCCT includes several samples based on Qt application framework.
These samples are available on all supported desktop platforms.
To start a sample on Windows use Open CASCADE Technology\\Samples\\Qt\\ item of the Start\\Programs menu.
Import Export
-------------
Import Export programming sample contains 3D Viewer and Import / Export functionality.
@figure{/samples/images/samples_qt.png}
Tutorial
---------
The Qt programming tutorial teaches how to use Open CASCADE Technology services to model a 3D object.
The purpose of the tutorial is not to explain all OCCT classes but
to help start thinking in terms of the Open CASCADE Technology.
This tutorial assumes that the user has experience in using and setting up C++.
From the viewpoint of programming, Open CASCADE Technology is designed
to enhance user's C++ tools with high performance modeling classes, methods and functions.
The combination of these resources allows creating substantial applications.
**See also:** @ref occt__tutorial "OCCT Tutorial"
Overview
---------
The Qt application providing samples for basic usage of C++ API of various OCCT functionality.
The samples are organized in several categories according to relevant module of OCCT:
* Geometry
* Topology,
* Triangulation
* DataExchange
* OCAF
* Viewer 2d
* Viewer 3d
Each sample presents geometry view, C++ code fragment and sample output window.
@figure{/samples/images/sample_overview_qt.png}
See \subpage samples_qt_overview "Readme" for details.
C#
---
C# sample demonstrates integration of OCCT 3D Viewer and Import / Export functionality into .NET applications (using Windows Forms and WPF front ends).
@figure{/samples/images/samples_c__ie.png}
Import:
* BRep
* Iges
* Step
Export:
* Brep
* Iges
* Step
* Stl
* Vrml
See @subpage samples_csharp_occt "C# sample Readme" for details.
There is also another C# example with the same functionality, which demonstrates the integration of Direct3D Viewer into .NET applications using WPF front end.
See @subpage samples_csharp_direct3d "Direct3D C# sample Readme" for details.
Android
---------
There are two samples are representing usage OCCT framework on Android mobile platform. They represent an OCCT-based 3D-viewer with CAD import support in formats BREP, STEP and IGES: jniviewer (java) and AndroidQt (qt+qml)
jniviewer
@figure{/samples/images/samples_java_android_occt.jpg}
Java -- See @subpage samples_java_android_occt "Android Java sample Readme" for details.
AndroidQt
@figure{/samples/images/samples_qml_android_occt.jpg}
Qt -- See \subpage samples_qml_android_occt "Android Qt sample Readme" for details.
iOS
---
There is a sample demonstrating usage of OCCT on iOS with Apple UIKit framework.
@figure{/samples/images/sample_ios_uikit.png}
See @subpage occt_samples_ios_uikit "iOS sample Readme" for details.
Web
---------
WebGL Viewer sample demonstrating usage of OCCT 3D Viewer in Web browser with Emscripten SDK can be found in `samples/webgl`.
@figure{/samples/images/sample_webgl.png}
See @subpage occt_samples_webgl "WebGL sample Readme" for details.
OCAF Usage Sample
------------------
The provided set of samples dedicates to get initial knowledge about typical actions with OCAF services. It may be
useful for newcomers.
Read more about @subpage samples__ocaf
OCAF Function Mechanism Usage
-----------------------------
This simple example dedicates to the usage of "Function Mechanism" of OCCT Application Framework. It represents a "nail"
composed by a cone and two cylinders of different radius and height.
Read more about @subpage samples__ocaf_func
Draw Demo Scripts
------------------
A set of demo scripts demonsrates using OCCT functionality from DRAW. These scripts can be also considered as a
tutorials on tcl usage within Draw.
Read more about @subpage samples__draw_scripts

View File

@@ -811,7 +811,7 @@ The following example illustrates how to use the GF algorithm:
#### Usage of the GF algorithm on C++ level #### Usage of the GF algorithm on C++ level
~~~~{.cpp} ~~~~
BOPAlgo_Builder aBuilder; BOPAlgo_Builder aBuilder;
// Setting arguments // Setting arguments
TopTools_ListOfShape aLSObjects = …; // Objects TopTools_ListOfShape aLSObjects = …; // Objects
@@ -865,7 +865,7 @@ const TopoDS_Shape& aResult = aBuilder.Shape();
#### Usage of the GF algorithm on Tcl level #### Usage of the GF algorithm on Tcl level
~~~~{.cpp} ~~~~
# prepare the arguments # prepare the arguments
box b1 10 10 10 box b1 10 10 10
box b2 3 4 5 10 10 10 box b2 3 4 5 10 10 10
@@ -1199,7 +1199,7 @@ It is based on the General Fuse algorithm, thus all options of the General Fuse
@subsubsection specification__boolean_8_3_1 API @subsubsection specification__boolean_8_3_1 API
On the low level the Splitter algorithm is implemented in class *BOPAlgo_Splitter*. The usage of this algorithm looks as follows: On the low level the Splitter algorithm is implemented in class *BOPAlgo_Splitter*. The usage of this algorithm looks as follows:
~~~~{.cpp} ~~~~~
BOPAlgo_Splitter aSplitter; BOPAlgo_Splitter aSplitter;
// Setting arguments and tools // Setting arguments and tools
TopTools_ListOfShape aLSObjects = …; // Objects TopTools_ListOfShape aLSObjects = …; // Objects
@@ -1218,12 +1218,12 @@ if (aSplitter.HasErrors()) { //check error status
} }
// //
const TopoDS_Shape& aResult = aSplitter.Shape(); // result of the operation const TopoDS_Shape& aResult = aSplitter.Shape(); // result of the operation
~~~~ ~~~~~
@subsubsection specification__boolean_8_3_2 DRAW @subsubsection specification__boolean_8_3_2 DRAW
The command *bsplit* implements the Splitter algorithm in DRAW. Similarly to the *bbuild* command for the General Fuse algorithm, the *bsplit* command should be used after the Pave Filler is filled. The command *bsplit* implements the Splitter algorithm in DRAW. Similarly to the *bbuild* command for the General Fuse algorithm, the *bsplit* command should be used after the Pave Filler is filled.
~~~~{.cpp} ~~~~~
# s1 s2 s3 - objects # s1 s2 s3 - objects
# t1 t2 t3 - tools # t1 t2 t3 - tools
bclearobjects bclearobjects
@@ -1232,7 +1232,7 @@ baddobjects s1 s2 s3
baddtools t1 t2 t3 baddtools t1 t2 t3
bfillds bfillds
bsplit result bsplit result
~~~~ ~~~~~
@subsection specification__boolean_8_4 Examples @subsection specification__boolean_8_4 Examples
@@ -1240,7 +1240,7 @@ bsplit result
Splitting a face by the set of edges: Splitting a face by the set of edges:
~~~~{.cpp} ~~~~
# draw script for reproducing # draw script for reproducing
bclearobjects bclearobjects
bcleartools bcleartools
@@ -1286,7 +1286,7 @@ bsplit result
Splitting a plate by the set of cylinders: Splitting a plate by the set of cylinders:
~~~~{.cpp} ~~~~
# draw script for reproducing: # draw script for reproducing:
bclearobjects bclearobjects
bcleartools bcleartools
@@ -2182,7 +2182,7 @@ This option is useful e.g. for building a solid from the faces of one shell or f
#### C++ Level #### C++ Level
The usage of the algorithm on the API level: The usage of the algorithm on the API level:
~~~~{.cpp} ~~~~
BOPAlgo_MakerVolume aMV; BOPAlgo_MakerVolume aMV;
// Set the arguments // Set the arguments
TopTools_ListOfShape aLS = …; // arguments TopTools_ListOfShape aLS = …; // arguments
@@ -2206,7 +2206,7 @@ const TopoDS_Shape& aResult = aMV.Shape(); // result of the operation
#### Tcl Level #### Tcl Level
To use the algorithm in Draw the command mkvolume has been implemented. The usage of this command is following: To use the algorithm in Draw the command mkvolume has been implemented. The usage of this command is following:
~~~~{.php} ~~~~
Usage: mkvolume r b1 b2 ... [-c] [-ni] [-ai] Usage: mkvolume r b1 b2 ... [-c] [-ni] [-ai]
Options: Options:
-c - use this option to have input compounds considered as set of separate arguments (allows passing multiple arguments as one compound); -c - use this option to have input compounds considered as set of separate arguments (allows passing multiple arguments as one compound);
@@ -2309,7 +2309,7 @@ aResult = aCBuilder.Shape(); // the result
#### DRAW usage #### DRAW usage
The following set of new commands has been implemented to run the algorithm in DRAW Test Harness: The following set of new commands has been implemented to run the algorithm in DRAW Test Harness:
~~~~{.php} ~~~~
bcbuild : Initialization of the Cells Builder. Use: *bcbuild r* bcbuild : Initialization of the Cells Builder. Use: *bcbuild r*
bcadd : Add parts to result. Use: *bcadd r s1 (0,1) s2 (0,1) ... [-m material [-u]]* bcadd : Add parts to result. Use: *bcadd r s1 (0,1) s2 (0,1) ... [-m material [-u]]*
bcaddall : Add all parts to result. Use: *bcaddall r [-m material [-u]]* bcaddall : Add all parts to result. Use: *bcaddall r [-m material [-u]]*
@@ -2320,7 +2320,7 @@ bcmakecontainers : Make containers from the parts added to result. Use: *bcmakec
~~~~ ~~~~
Here is the example of the algorithm use on the DRAW level: Here is the example of the algorithm use on the DRAW level:
~~~~{.php} ~~~~
psphere s1 15 psphere s1 15
psphere s2 15 psphere s2 15
psphere s3 15 psphere s3 15
@@ -2343,7 +2343,7 @@ bcremoveint res
@subsection specification__boolean_10c_Cells_2 Examples @subsection specification__boolean_10c_Cells_2 Examples
The following simple example illustrates the possibilities of the algorithm working on a cylinder and a sphere intersected by a plane: The following simple example illustrates the possibilities of the algorithm working on a cylinder and a sphere intersected by a plane:
~~~~{.php} ~~~~
pcylinder c 10 30 pcylinder c 10 30
psphere s 15 psphere s 15
ttranslate s 0 0 30 ttranslate s 0 0 30
@@ -2353,7 +2353,7 @@ mkface f p -25 30 -17 17
@figure{/specification/boolean_operations/images/cells_algorithm_001.png,"Arguments",160} @figure{/specification/boolean_operations/images/cells_algorithm_001.png,"Arguments",160}
~~~~{.php} ~~~~
bclearobjects bclearobjects
bcleartools bcleartools
baddobjects c s f baddobjects c s f
@@ -2363,7 +2363,7 @@ bcbuild r
#### 1. Common for all arguments #### 1. Common for all arguments
~~~~{.php} ~~~~
bcremoveall bcremoveall
bcadd res c 1 s 1 f 1 bcadd res c 1 s 1 f 1
~~~~ ~~~~
@@ -2372,7 +2372,7 @@ bcadd res c 1 s 1 f 1
#### 2. Common between cylinder and face #### 2. Common between cylinder and face
~~~~{.php} ~~~~
bcremoveall bcremoveall
bcadd res f 1 c 1 bcadd res f 1 c 1
~~~~ ~~~~
@@ -2381,7 +2381,7 @@ bcadd res f 1 c 1
#### 3. Common between cylinder and sphere #### 3. Common between cylinder and sphere
~~~~{.php} ~~~~
bcremoveall bcremoveall
bcadd res c 1 s 1 bcadd res c 1 s 1
~~~~ ~~~~
@@ -2390,7 +2390,7 @@ bcadd res c 1 s 1
#### 4. Fuse of cylinder and sphere #### 4. Fuse of cylinder and sphere
~~~~{.php} ~~~~
bcremoveall bcremoveall
bcadd res c 1 -m 1 bcadd res c 1 -m 1
bcadd res s 1 -m 1 bcadd res s 1 -m 1
@@ -2401,7 +2401,7 @@ bcremoveint res
#### 5. Parts of the face inside solids - FUSE(COMMON(f, c), COMMON(f, s)) #### 5. Parts of the face inside solids - FUSE(COMMON(f, c), COMMON(f, s))
~~~~{.php} ~~~~
bcremoveall bcremoveall
bcadd res f 1 s 1 -m 1 bcadd res f 1 s 1 -m 1
bcadd res f 1 c 1 -m 1 bcadd res f 1 c 1 -m 1
@@ -2409,7 +2409,7 @@ bcadd res f 1 c 1 -m 1
@figure{/specification/boolean_operations/images/cells_algorithm_006_1.png,"Parts of the face inside solids",160} @figure{/specification/boolean_operations/images/cells_algorithm_006_1.png,"Parts of the face inside solids",160}
~~~~{.php} ~~~~
bcremoveint res bcremoveint res
~~~~ ~~~~
@@ -2417,7 +2417,7 @@ bcremoveint res
#### 6. Part of the face outside solids #### 6. Part of the face outside solids
~~~~{.php} ~~~~
bcremoveall bcremoveall
bcadd res f 1 c 0 s 0 bcadd res f 1 c 0 s 0
~~~~ ~~~~
@@ -2426,7 +2426,7 @@ bcadd res f 1 c 0 s 0
#### 7. Fuse operation (impossible using standard Boolean Fuse operation) #### 7. Fuse operation (impossible using standard Boolean Fuse operation)
~~~~{.php} ~~~~
bcremoveall bcremoveall
bcadd res c 1 -m 1 bcadd res c 1 -m 1
bcadd res s 1 -m 1 bcadd res s 1 -m 1
@@ -2788,7 +2788,7 @@ For setting the Gluing options in DRAW it is necessary to call the <i>bglue</i>
* 1 - for partial coincidence; * 1 - for partial coincidence;
* 2 - for full coincidence * 2 - for full coincidence
~~~~{.php} ~~~~
bglue 1 bglue 1
~~~~ ~~~~
@@ -2836,7 +2836,7 @@ To enable the safe processing mode for the operation in DRAW, it is necessary to
* 0 - default value, the safe mode is switched off; * 0 - default value, the safe mode is switched off;
* 1 - the safe mode will be switched on. * 1 - the safe mode will be switched on.
~~~~{.php} ~~~~
bnondestructive 1 bnondestructive 1
~~~~ ~~~~
@@ -2867,7 +2867,7 @@ To enable/disable the classification of the solids in DRAW, it is necessary to c
* 0 - disabling the classification; * 0 - disabling the classification;
* 1 - default value, enabling the classification. * 1 - default value, enabling the classification.
~~~~{.php} ~~~~
bcheckinverted 0 bcheckinverted 0
~~~~ ~~~~
@@ -2893,7 +2893,7 @@ aGF.SetUseOBB(Standard_True);
To enable/disable the usage of OBB in the operation in DRAW it is necessary to call the *buseobb* command with the appropriate value: To enable/disable the usage of OBB in the operation in DRAW it is necessary to call the *buseobb* command with the appropriate value:
* 0 - disabling the usage of OBB; * 0 - disabling the usage of OBB;
* 1 - enabling the usage of OBB. * 1 - enabling the usage of OBB.
~~~~{.php} ~~~~
buseobb 1 buseobb 1
~~~~ ~~~~
@@ -2919,7 +2919,7 @@ Note that messages corresponding to errors and warnings are defined in resource
These messages can be localized; for that put translated version to separate file and load it in the application by call to *Message_MsgFile::Load()* . These messages can be localized; for that put translated version to separate file and load it in the application by call to *Message_MsgFile::Load()* .
Here is the example of how to use this system: Here is the example of how to use this system:
~~~~{.php} ~~~~~
BOPAlgo_PaveFiller aPF; BOPAlgo_PaveFiller aPF;
aPF.SetArguments(...); aPF.SetArguments(...);
aPF.Perform(); aPF.Perform();
@@ -2934,12 +2934,12 @@ if (aPF.HasErrors()) {
} }
... ...
} }
~~~~ ~~~~~
DRAW commands executing Boolean operations output errors and warnings generated by these operations in textual form. DRAW commands executing Boolean operations output errors and warnings generated by these operations in textual form.
Additional option allows saving shapes for which warnings have been generated, as DRAW variables. Additional option allows saving shapes for which warnings have been generated, as DRAW variables.
To activate this option, run command *bdrawwarnshapes* with argument 1 (or with 0 to deactivate): To activate this option, run command *bdrawwarnshapes* with argument 1 (or with 0 to deactivate):
~~~~{.php} ~~~~
bdrawwarnshapes 1 bdrawwarnshapes 1
~~~~ ~~~~
@@ -2978,7 +2978,7 @@ But if the faces are fully coinciding, the result must be empty, and both faces
Example of the overlapping faces: Example of the overlapping faces:
~~~~{.php} ~~~~
plane p 0 0 0 0 0 1 plane p 0 0 0 0 0 1
mkface f1 p -10 10 -10 10 mkface f1 p -10 10 -10 10
mkface f2 p 0 20 -10 10 mkface f2 p 0 20 -10 10
@@ -3005,7 +3005,7 @@ Thus, each of the input edges will be Modified into its two splits.
But in the CUT operation on the same edges, the tool edge will be Deleted from the result and, thus, will not have any Modified shapes. But in the CUT operation on the same edges, the tool edge will be Deleted from the result and, thus, will not have any Modified shapes.
Example of the intersecting edges: Example of the intersecting edges:
~~~~{.php} ~~~~
line l1 0 0 0 1 0 0 line l1 0 0 0 1 0 0
mkedge e1 l1 -10 10 mkedge e1 l1 -10 10
@@ -3051,7 +3051,7 @@ Two intersecting edges will both have the intersection vertices Generated from t
As for the operation with intersecting faces, consider the following example: As for the operation with intersecting faces, consider the following example:
~~~~{.php} ~~~~
plane p1 0 0 0 0 0 1 plane p1 0 0 0 0 0 1
mkface f1 p1 -10 10 -10 10 mkface f1 p1 -10 10 -10 10
@@ -3115,7 +3115,7 @@ For controlling this possibility in DRAW the command **bsimplify** has been impl
Here is the simple example of simplification of the result of Fuse operation of two boxes: Here is the simple example of simplification of the result of Fuse operation of two boxes:
~~~~{.php} ~~~~
bsimplify -f 1 bsimplify -f 1
box b1 10 10 15 box b1 10 10 15
@@ -3173,7 +3173,7 @@ The following example illustrates how to use General Fuse operator:
#### C++ Level #### C++ Level
~~~~{.cpp} ~~~~
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
#include <BRepAlgoAPI_BuilderAlgo.hxx> #include <BRepAlgoAPI_BuilderAlgo.hxx>
@@ -3205,7 +3205,7 @@ The following example illustrates how to use General Fuse operator:
#### Tcl Level #### Tcl Level
~~~~{.php} ~~~~
# prepare the arguments # prepare the arguments
box b1 10 10 10 box b1 10 10 10
box b2 3 4 5 10 10 10 box b2 3 4 5 10 10 10
@@ -3231,7 +3231,7 @@ The following example illustrates how to use the Splitter operator:
#### C++ Level #### C++ Level
~~~~{.cpp} ~~~~
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
#include <BRepAlgoAPI_Splitter.hxx> #include <BRepAlgoAPI_Splitter.hxx>
@@ -3265,7 +3265,7 @@ const TopoDS_Shape& aResult = aSplitter.Shape();
#### Tcl Level #### Tcl Level
~~~~{.php} ~~~~
# prepare the arguments # prepare the arguments
# objects # objects
box b1 10 10 10 box b1 10 10 10
@@ -3297,7 +3297,7 @@ The following example illustrates how to use Common operation:
#### C++ Level #### C++ Level
~~~~{.cpp} ~~~~
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
#include < BRepAlgoAPI_Common.hxx> #include < BRepAlgoAPI_Common.hxx>
@@ -3336,7 +3336,7 @@ The following example illustrates how to use Common operation:
#### Tcl Level #### Tcl Level
~~~~{.php} ~~~~
# prepare the arguments # prepare the arguments
box b1 10 10 10 box b1 10 10 10
box b2 7 0 4 10 10 10 box b2 7 0 4 10 10 10
@@ -3364,7 +3364,7 @@ The following example illustrates how to use Fuse operation:
#### C++ Level #### C++ Level
~~~~{.cpp} ~~~~
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
#include < BRepAlgoAPI_Fuse.hxx> #include < BRepAlgoAPI_Fuse.hxx>
@@ -3403,7 +3403,7 @@ The following example illustrates how to use Fuse operation:
#### Tcl Level #### Tcl Level
~~~~{.php} ~~~~
# prepare the arguments # prepare the arguments
box b1 10 10 10 box b1 10 10 10
box b2 7 0 4 10 10 10 box b2 7 0 4 10 10 10
@@ -3431,7 +3431,7 @@ The following example illustrates how to use Cut operation:
#### C++ Level #### C++ Level
~~~~{.cpp} ~~~~
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
#include < BRepAlgoAPI_Cut.hxx> #include < BRepAlgoAPI_Cut.hxx>
@@ -3470,7 +3470,7 @@ The following example illustrates how to use Cut operation:
#### Tcl Level #### Tcl Level
~~~~{.php} ~~~~
# prepare the arguments # prepare the arguments
box b1 10 10 10 box b1 10 10 10
box b2 7 0 4 10 10 10 box b2 7 0 4 10 10 10
@@ -3499,7 +3499,7 @@ The following example illustrates how to use Section operation:
#### C++ Level #### C++ Level
~~~~{.cpp} ~~~~
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
#include < BRepAlgoAPI_Section.hxx> #include < BRepAlgoAPI_Section.hxx>
@@ -3538,7 +3538,7 @@ The following example illustrates how to use Section operation:
#### Tcl Level #### Tcl Level
~~~~{.php} ~~~~
# prepare the arguments # prepare the arguments
box b1 10 10 10 box b1 10 10 10
box b2 3 4 5 10 10 10 box b2 3 4 5 10 10 10

View File

@@ -35,12 +35,12 @@ Each of these methods has two arguments:
The following sample code reads a shape from ASCII file and writes it to a binary one: The following sample code reads a shape from ASCII file and writes it to a binary one:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
TopoDS_Shape aShape; TopoDS_Shape aShape;
if (BRepTools::Read (aShape, "source_file.txt")) { if (BRepTools::Read (aShape, "source_file.txt")) {
BinTools::Write (aShape, "result_file.bin"); BinTools::Write (aShape, "result_file.bin");
} }
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@section specification__brep_format_3 Format Common Structure @section specification__brep_format_3 Format Common Structure
@@ -250,7 +250,7 @@ The example record is interpreted as a line which passes through a point *P*=(1
**BNF-like Definition** **BNF-like Definition**
~~~~{.cpp} ~~~~
<3D curve record 2> = "2" <_> <3D circle center> <_> <3D circle N> <_> <3D circle Dx> <_> <3D circle Dy> <_> <3D circle radius> <_\n>; <3D curve record 2> = "2" <_> <3D circle center> <_> <3D circle N> <_> <3D circle Dx> <_> <3D circle Dy> <_> <3D circle radius> <_\n>;
<3D circle center> = <3D point>; <3D circle center> = <3D point>;
@@ -283,7 +283,7 @@ The example record is interpreted as a circle which has its center *P*=(1, 2, 3
**BNF-like Definition** **BNF-like Definition**
~~~~{.cpp} ~~~~
<3D curve record 3> = "3" <_> <3D ellipse center> <_> <3D ellipse N> <_> <3D ellipse Dmaj> <_> <3D ellipse Dmin> <_> <3D ellipse Rmaj> <_> <3D ellipse Rmin> <_\n>; <3D curve record 3> = "3" <_> <3D ellipse center> <_> <3D ellipse N> <_> <3D ellipse Dmaj> <_> <3D ellipse Dmin> <_> <3D ellipse Rmaj> <_> <3D ellipse Rmin> <_\n>;
<3D ellipse center> = <3D point>; <3D ellipse center> = <3D point>;
@@ -318,7 +318,7 @@ The example record is interpreted as an ellipse which has its center *P*=(1, 2,
**BNF-like Definition** **BNF-like Definition**
~~~~{.cpp} ~~~~
<3D curve record 4> = "4" <_> <3D parabola origin> <_> <3D parabola N> <_> <3D parabola Dx> <_> <3D parabola Dy> <_> <3D parabola focal length> <_\n>; <3D curve record 4> = "4" <_> <3D parabola origin> <_> <3D parabola N> <_> <3D parabola Dx> <_> <3D parabola Dy> <_> <3D parabola focal length> <_\n>;
<3D parabola origin> = <3D point>; <3D parabola origin> = <3D point>;
@@ -352,7 +352,7 @@ The example record is interpreted as a parabola in plane which passes through a
**BNF-like Definition** **BNF-like Definition**
~~~~{.cpp} ~~~~
<3D curve record 5> = "5" <_> <3D hyperbola origin> <_> <3D hyperbola N> <_> <3D hyperbola Dx> <_> <3D hyperbola Dy> <_> <3D hyperbola Kx> <_> <3D hyperbola Ky> <_\n>; <3D curve record 5> = "5" <_> <3D hyperbola origin> <_> <3D hyperbola N> <_> <3D hyperbola Dx> <_> <3D hyperbola Dy> <_> <3D hyperbola Kx> <_> <3D hyperbola Ky> <_\n>;
<3D hyperbola origin> = <3D point>; <3D hyperbola origin> = <3D point>;
@@ -428,7 +428,7 @@ The example record is interpreted as a Bezier curve with a rational flag *r*=1,
**BNF-like Definition** **BNF-like Definition**
~~~~{.cpp} ~~~~
<3D curve record 7> = "7" <_> <3D B-spline rational flag> <_> "0" <_> <3D B-spline degree> <_> <3D curve record 7> = "7" <_> <3D B-spline rational flag> <_> "0" <_> <3D B-spline degree> <_>
<3D B-spline pole count> <_> <3D B-spline multiplicity knot count> <3D B-spline weight poles> <3D B-spline pole count> <_> <3D B-spline multiplicity knot count> <3D B-spline weight poles>
<_\n> <3D B-spline multiplicity knots> <_\n>; <_\n> <3D B-spline multiplicity knots> <_\n>;
@@ -492,7 +492,7 @@ The example record is interpreted as a B-spline curve with a rational flag *r*=
**BNF-like Definition** **BNF-like Definition**
~~~~{.cpp} ~~~~
<3D curve record 8> = "8" <_> <3D trimmed curve u min> <_> <3D trimmed curve u max> <_\n> <3D curve record>; <3D curve record 8> = "8" <_> <3D trimmed curve u min> <_> <3D trimmed curve u max> <_\n> <3D curve record>;
<3D trimmed curve u min> = <real>; <3D trimmed curve u min> = <real>;
@@ -764,7 +764,7 @@ where @f$ V(v)=(5,2,0)+4 \cdot (cos(v) \cdot (1,0,0)+sin(v) \cdot (0,1,0)), V_{D
**BNF-like Definition** **BNF-like Definition**
~~~~{.cpp} ~~~~
<surface record 8> = "8" <_> <Bezier surface u rational flag> <_> <Bezier surface v rational flag> <_> <Bezier surface u degree> <_> <Bezier surface v degree> <_> <surface record 8> = "8" <_> <Bezier surface u rational flag> <_> <Bezier surface v rational flag> <_> <Bezier surface u degree> <_> <Bezier surface v degree> <_>
<Bezier surface weight poles>; <Bezier surface weight poles>;
@@ -1076,7 +1076,7 @@ The example record is interpreted as a line which passes through a point *P*=(3
**BNF-like Definition** **BNF-like Definition**
~~~~{.cpp} ~~~~
<2D curve record 2> = "2" <_> <2D circle center> <_> <2D circle Dx> <_> <2D circle Dy> <_> <2D circle radius> <_\n>; <2D curve record 2> = "2" <_> <2D circle center> <_> <2D circle Dx> <_> <2D circle Dy> <_> <2D circle radius> <_\n>;
<2D circle center> = <2D point>; <2D circle center> = <2D point>;
@@ -1247,7 +1247,7 @@ The example record is interpreted as a Bezier curve with a rational flag *r*=1,
**BNF-like Definition** **BNF-like Definition**
~~~~{.cpp} ~~~~
<2D curve record 7> = "7" <_> <2D B-spline rational flag> <_> "0" <_> <2D B-spline degree> <_> <2D B-spline pole count> <_> <2D B-spline multiplicity knot count> <2D B-spline weight poles> <_\n> <2D B-spline multiplicity knots> <_\n>; <2D curve record 7> = "7" <_> <2D B-spline rational flag> <_> "0" <_> <2D B-spline degree> <_> <2D B-spline pole count> <_> <2D B-spline multiplicity knot count> <2D B-spline weight poles> <_\n> <2D B-spline multiplicity knots> <_\n>;
<2D B-spline rational flag> = <flag>; <2D B-spline rational flag> = <flag>;
@@ -1430,7 +1430,7 @@ The example record describes a polyline from *m*=2 nodes with a parameter prese
**BNF-like Definition** **BNF-like Definition**
~~~~{.cpp} ~~~~
<triangulations> = <triangulation header> <_\n> <triangulation records>; <triangulations> = <triangulation header> <_\n> <triangulation records>;
<triangulation header> = "Triangulations" <_> <triangulation count>; <triangulation header> = "Triangulations" <_> <triangulation count>;
@@ -1785,7 +1785,7 @@ The usage of \<vertex data representation u parameter\> *U* is described belo
**BNF-like Definition** **BNF-like Definition**
~~~~{.cpp} ~~~~
<edge data> = <_> <edge data tolerance> <_> <edge data same parameter flag> <_> edge data same range flag> <_> <edge data degenerated flag> <_\n> <edge data representations>; <edge data> = <_> <edge data tolerance> <_> <edge data same parameter flag> <_> edge data same range flag> <_> <edge data degenerated flag> <_\n> <edge data representations>;
<edge data tolerance> = <real>; <edge data tolerance> = <real>;
@@ -1855,7 +1855,7 @@ Flags \<edge data same parameter flag\>, \<edge data same range flag\> and \<edg
**BNF-like Definition** **BNF-like Definition**
~~~~{.cpp} ~~~~
<face data> = <face data natural restriction flag> <_> <face data tolerance> <_> <surface number> <_> <location number> <\n> ["2" <_> <triangulation number>]; <face data> = <face data natural restriction flag> <_> <face data tolerance> <_> <surface number> <_> <location number> <\n> ["2" <_> <triangulation number>];
<face data natural restriction flag> = <flag>; <face data natural restriction flag> = <flag>;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

@@ -1,4 +1,4 @@
Modeling: Bottle Tutorial {#occt__tutorial} Tutorial {#occt__tutorial}
======= =======
@tableofcontents @tableofcontents
@@ -18,7 +18,7 @@ From a programming standpoint, Open CASCADE Technology is designed to enhance yo
To illustrate the use of classes provided in the 3D geometric modeling toolkits, you will create a bottle as shown: To illustrate the use of classes provided in the 3D geometric modeling toolkits, you will create a bottle as shown:
@figure{/tutorial/images/tutorial_image001.png,"",240} height=350px @figure{/tutorial/images/tutorial_image001.png,"",240}
In the tutorial we will create, step-by-step, a function that will model a bottle as shown above. You will find the complete source code of this tutorial, including the very function *MakeBottle* in the distribution of Open CASCADE Technology. The function body is provided in the file samples/qt/Tutorial/src/MakeBottle.cxx. In the tutorial we will create, step-by-step, a function that will model a bottle as shown above. You will find the complete source code of this tutorial, including the very function *MakeBottle* in the distribution of Open CASCADE Technology. The function body is provided in the file samples/qt/Tutorial/src/MakeBottle.cxx.
@@ -34,7 +34,7 @@ We first define the bottle specifications as follows:
In addition, we decide that the bottle's profile (base) will be centered on the origin of the global Cartesian coordinate system. In addition, we decide that the bottle's profile (base) will be centered on the origin of the global Cartesian coordinate system.
@figure{/tutorial/images/tutorial_image002.png,"",240} height=350px @figure{/tutorial/images/tutorial_image002.png,"",240}
This modeling requires four steps: This modeling requires four steps:
@@ -66,19 +66,19 @@ To choose the best class for this application, consider the following:
Since all the points you will define are only used to create the profile's curves, an object with a limited lifetime will do. Choose the *gp_Pnt* class. Since all the points you will define are only used to create the profile's curves, an object with a limited lifetime will do. Choose the *gp_Pnt* class.
To instantiate a *gp_Pnt* object, just specify the X, Y, and Z coordinates of the points in the global Cartesian coordinate system: To instantiate a *gp_Pnt* object, just specify the X, Y, and Z coordinates of the points in the global Cartesian coordinate system:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
gp_Pnt aPnt1(-myWidth / 2., 0, 0); gp_Pnt aPnt1(-myWidth / 2., 0, 0);
gp_Pnt aPnt2(-myWidth / 2., -myThickness / 4., 0); gp_Pnt aPnt2(-myWidth / 2., -myThickness / 4., 0);
gp_Pnt aPnt3(0, -myThickness / 2., 0); gp_Pnt aPnt3(0, -myThickness / 2., 0);
gp_Pnt aPnt4(myWidth / 2., -myThickness / 4., 0); gp_Pnt aPnt4(myWidth / 2., -myThickness / 4., 0);
gp_Pnt aPnt5(myWidth / 2., 0, 0); gp_Pnt aPnt5(myWidth / 2., 0, 0);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Once your objects are instantiated, you can use methods provided by the class to access and modify its data. For example, to get the X coordinate of a point: Once your objects are instantiated, you can use methods provided by the class to access and modify its data. For example, to get the X coordinate of a point:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
Standard_Real xValue1 = aPnt1.X(); Standard_Real xValue1 = aPnt1.X();
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsection OCCT_TUTORIAL_SUB2_2 Profile: Defining the Geometry @subsection OCCT_TUTORIAL_SUB2_2 Profile: Defining the Geometry
With the help of the previously defined points, you can compute a part of the bottle's profile geometry. As shown in the figure below, it will consist of two segments and one arc. With the help of the previously defined points, you can compute a part of the bottle's profile geometry. As shown in the figure below, it will consist of two segments and one arc.
@@ -95,15 +95,15 @@ This is because the *GC* provides two algorithm classes which are exactly what i
Both of these classes return a *Geom_TrimmedCurve* manipulated by handle. This entity represents a base curve (line or circle, in our case), limited between two of its parameter values. For example, circle C is parameterized between 0 and 2PI. If you need to create a quarter of a circle, you create a *Geom_TrimmedCurve* on C limited between 0 and M_PI/2. Both of these classes return a *Geom_TrimmedCurve* manipulated by handle. This entity represents a base curve (line or circle, in our case), limited between two of its parameter values. For example, circle C is parameterized between 0 and 2PI. If you need to create a quarter of a circle, you create a *Geom_TrimmedCurve* on C limited between 0 and M_PI/2.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
Handle(Geom_TrimmedCurve) aArcOfCircle = GC_MakeArcOfCircle(aPnt2,aPnt3,aPnt4); Handle(Geom_TrimmedCurve) aArcOfCircle = GC_MakeArcOfCircle(aPnt2,aPnt3,aPnt4);
Handle(Geom_TrimmedCurve) aSegment1 = GC_MakeSegment(aPnt1, aPnt2); Handle(Geom_TrimmedCurve) aSegment1 = GC_MakeSegment(aPnt1, aPnt2);
Handle(Geom_TrimmedCurve) aSegment2 = GC_MakeSegment(aPnt4, aPnt5); Handle(Geom_TrimmedCurve) aSegment2 = GC_MakeSegment(aPnt4, aPnt5);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All *GC* classes provide a casting method to obtain a result automatically with a function-like call. Note that this method will raise an exception if construction has failed. To handle possible errors more explicitly, you may use the *IsDone* and *Value* methods. For example: All *GC* classes provide a casting method to obtain a result automatically with a function-like call. Note that this method will raise an exception if construction has failed. To handle possible errors more explicitly, you may use the *IsDone* and *Value* methods. For example:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
GC_MakeSegment mkSeg (aPnt1, aPnt2); GC_MakeSegment mkSeg (aPnt1, aPnt2);
Handle(Geom_TrimmedCurve) aSegment1; Handle(Geom_TrimmedCurve) aSegment1;
if(mkSegment.IsDone()){ if(mkSegment.IsDone()){
@@ -112,7 +112,7 @@ All *GC* classes provide a casting method to obtain a result automatically with
else { else {
// handle error // handle error
} }
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsection OCCT_TUTORIAL_SUB2_3 Profile: Defining the Topology @subsection OCCT_TUTORIAL_SUB2_3 Profile: Defining the Topology
@@ -144,18 +144,18 @@ Referring to the previous table, to build the profile, you will create:
However, the *TopoDS* package provides only the data structure of the topological entities. Algorithm classes available to compute standard topological objects can be found in the *BRepBuilderAPI* package. However, the *TopoDS* package provides only the data structure of the topological entities. Algorithm classes available to compute standard topological objects can be found in the *BRepBuilderAPI* package.
To create an edge, you use the BRepBuilderAPI_MakeEdge class with the previously computed curves: To create an edge, you use the BRepBuilderAPI_MakeEdge class with the previously computed curves:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge(aSegment1); TopoDS_Edge aEdge1 = BRepBuilderAPI_MakeEdge(aSegment1);
TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge(aArcOfCircle); TopoDS_Edge aEdge2 = BRepBuilderAPI_MakeEdge(aArcOfCircle);
TopoDS_Edge anEdge3 = BRepBuilderAPI_MakeEdge(aSegment2); TopoDS_Edge aEdge3 = BRepBuilderAPI_MakeEdge(aSegment2);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In Open CASCADE Technology, you can create edges in several ways. One possibility is to create an edge directly from two points, in which case the underlying geometry of this edge is a line, bounded by two vertices being automatically computed from the two input points. For example, anEdge1 and anEdge3 could have been computed in a simpler way: In Open CASCADE Technology, you can create edges in several ways. One possibility is to create an edge directly from two points, in which case the underlying geometry of this edge is a line, bounded by two vertices being automatically computed from the two input points. For example, aEdge1 and aEdge3 could have been computed in a simpler way:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge(aPnt1, aPnt3); TopoDS_Edge aEdge1 = BRepBuilderAPI_MakeEdge(aPnt1, aPnt3);
TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge(aPnt4, aPnt5); TopoDS_Edge aEdge2 = BRepBuilderAPI_MakeEdge(aPnt4, aPnt5);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To connect the edges, you need to create a wire with the *BRepBuilderAPI_MakeWire* class. There are two ways of building a wire with this class: To connect the edges, you need to create a wire with the *BRepBuilderAPI_MakeWire* class. There are two ways of building a wire with this class:
@@ -164,9 +164,9 @@ To connect the edges, you need to create a wire with the *BRepBuilderAPI_MakeWir
When building a wire from less than four edges, as in the present case, you can use the constructor directly as follows: When building a wire from less than four edges, as in the present case, you can use the constructor directly as follows:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
TopoDS_Wire aWire = BRepBuilderAPI_MakeWire(anEdge1, anEdge2, anEdge3); TopoDS_Wire aWire = BRepBuilderAPI_MakeWire(aEdge1, aEdge2, aEdge3);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsection OCCT_TUTORIAL_SUB2_4 Profile: Completing the Profile @subsection OCCT_TUTORIAL_SUB2_4 Profile: Completing the Profile
@@ -186,17 +186,17 @@ The first way is to define it from scratch, using its geometric definition:
* X axis is located at (0, 0, 0) - use the *gp_Pnt* class. * X axis is located at (0, 0, 0) - use the *gp_Pnt* class.
* X axis direction is (1, 0, 0) - use the *gp_Dir* class. A *gp_Dir* instance is created out of its X, Y and Z coordinates. * X axis direction is (1, 0, 0) - use the *gp_Dir* class. A *gp_Dir* instance is created out of its X, Y and Z coordinates.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
gp_Pnt aOrigin(0, 0, 0); gp_Pnt aOrigin(0, 0, 0);
gp_Dir xDir(1, 0, 0); gp_Dir xDir(1, 0, 0);
gp_Ax1 xAxis(aOrigin, xDir); gp_Ax1 xAxis(aOrigin, xDir);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The second and simplest way is to use the geometric constants defined in the gp package (origin, main directions and axis of the global coordinate system). To get the X axis, just call the *gp::OX* method: The second and simplest way is to use the geometric constants defined in the gp package (origin, main directions and axis of the global coordinate system). To get the X axis, just call the *gp::OX* method:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
gp_Ax1 xAxis = gp::OX(); gp_Ax1 xAxis = gp::OX();
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As previously explained, the 3D geometric transformation is defined with the *gp_Trsf* class. There are two different ways to use this class: As previously explained, the 3D geometric transformation is defined with the *gp_Trsf* class. There are two different ways to use this class:
@@ -205,43 +205,43 @@ As previously explained, the 3D geometric transformation is defined with the *gp
Since the simplest approach is always the best one, you should use the SetMirror method with the axis as the center of symmetry. Since the simplest approach is always the best one, you should use the SetMirror method with the axis as the center of symmetry.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
gp_Trsf aTrsf; gp_Trsf aTrsf;
aTrsf.SetMirror(xAxis); aTrsf.SetMirror(xAxis);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You now have all necessary data to apply the transformation with the BRepBuilderAPI_Transform class by specifying: You now have all necessary data to apply the transformation with the BRepBuilderAPI_Transform class by specifying:
* the shape on which the transformation must be applied. * the shape on which the transformation must be applied.
* the geometric transformation * the geometric transformation
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
BRepBuilderAPI_Transform aBRepTrsf(aWire, aTrsf); BRepBuilderAPI_Transform aBRepTrsf(aWire, aTrsf);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*BRepBuilderAPI_Transform* does not modify the nature of the shape: the result of the reflected wire remains a wire. But the function-like call or the *BRepBuilderAPI_Transform::Shape* method returns a *TopoDS_Shape* object: *BRepBuilderAPI_Transform* does not modify the nature of the shape: the result of the reflected wire remains a wire. But the function-like call or the *BRepBuilderAPI_Transform::Shape* method returns a *TopoDS_Shape* object:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
TopoDS_Shape aMirroredShape = aBRepTrsf.Shape(); TopoDS_Shape aMirroredShape = aBRepTrsf.Shape();
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What you need is a method to consider the resulting reflected shape as a wire. The *TopoDS* global functions provide this kind of service by casting a shape into its real type. To cast the transformed wire, use the *TopoDS::Wire* method. What you need is a method to consider the resulting reflected shape as a wire. The *TopoDS* global functions provide this kind of service by casting a shape into its real type. To cast the transformed wire, use the *TopoDS::Wire* method.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
TopoDS_Wire aMirroredWire = TopoDS::Wire(aMirroredShape); TopoDS_Wire aMirroredWire = TopoDS::Wire(aMirroredShape);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The bottle's profile is almost finished. You have created two wires: *aWire* and *aMirroredWire*. You need to concatenate them to compute a single shape. To do this, you use the *BRepBuilderAPI_MakeWire* class as follows: The bottle's profile is almost finished. You have created two wires: *aWire* and *aMirroredWire*. You need to concatenate them to compute a single shape. To do this, you use the *BRepBuilderAPI_MakeWire* class as follows:
* create an instance of *BRepBuilderAPI_MakeWire*. * create an instance of *BRepBuilderAPI_MakeWire*.
* add all edges of the two wires by using the *Add* method on this object. * add all edges of the two wires by using the *Add* method on this object.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
BRepBuilderAPI_MakeWire mkWire; BRepBuilderAPI_MakeWire mkWire;
mkWire.Add(aWire); mkWire.Add(aWire);
mkWire.Add(aMirroredWire); mkWire.Add(aMirroredWire);
TopoDS_Wire myWireProfile = mkWire.Wire(); TopoDS_Wire myWireProfile = mkWire.Wire();
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@section sec3 Building the Body @section sec3 Building the Body
@@ -250,7 +250,7 @@ The bottle's profile is almost finished. You have created two wires: *aWire* and
@subsection OCCT_TUTORIAL_SUB3_1 Prism the Profile @subsection OCCT_TUTORIAL_SUB3_1 Prism the Profile
To compute the main body of the bottle, you need to create a solid shape. The simplest way is to use the previously created profile and sweep it along a direction. The *Prism* functionality of Open CASCADE Technology is the most appropriate for that task. It accepts a shape and a direction as input and generates a new shape according to the following rules: To compute the main body of the bottle, you need to create a solid shape. The simplest way is to use the previously created profile and to sweep it along a direction. The *Prism* functionality of Open CASCADE Technology is the most appropriate for that task. It accepts a shape and a direction as input and generates a new shape according to the following rules:
| Shape | Generates | | Shape | Generates |
| :----- | :----------------- | | :----- | :----------------- |
@@ -260,15 +260,15 @@ To compute the main body of the bottle, you need to create a solid shape. The si
| Face | Solid | | Face | Solid |
| Shell | Compound of Solids | | Shell | Compound of Solids |
@figure{/tutorial/images/tutorial_image007.png,"",240} height=350px @figure{/tutorial/images/tutorial_image007.png,"",240}
Your current profile is a wire. Referring to the Shape/Generates table, you need to compute a face out of its wire to generate a solid. Your current profile is a wire. Referring to the Shape/Generates table, you need to compute a face out of its wire to generate a solid.
To create a face, use the *BRepBuilderAPI_MakeFace* class. As previously explained, a face is a part of a surface bounded by a closed wire. Generally, *BRepBuilderAPI_MakeFace* computes a face out of a surface and one or more wires. To create a face, use the *BRepBuilderAPI_MakeFace* class. As previously explained, a face is a part of a surface bounded by a closed wire. Generally, *BRepBuilderAPI_MakeFace* computes a face out of a surface and one or more wires.
When the wire lies on a plane, the surface is automatically computed. When the wire lies on a plane, the surface is automatically computed.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
TopoDS_Face myFaceProfile = BRepBuilderAPI_MakeFace(myWireProfile); TopoDS_Face myFaceProfile = BRepBuilderAPI_MakeFace(myWireProfile);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The *BRepPrimAPI* package provides all the classes to create topological primitive constructions: boxes, cones, cylinders, spheres, etc. Among them is the *BRepPrimAPI_MakePrism* class. As specified above, the prism is defined by: The *BRepPrimAPI* package provides all the classes to create topological primitive constructions: boxes, cones, cylinders, spheres, etc. Among them is the *BRepPrimAPI_MakePrism* class. As specified above, the prism is defined by:
@@ -277,15 +277,15 @@ The *BRepPrimAPI* package provides all the classes to create topological primiti
You want the solid to be finite, swept along the Z axis and to be myHeight height. The vector, defined with the *gp_Vec* class on its X, Y and Z coordinates, is: You want the solid to be finite, swept along the Z axis and to be myHeight height. The vector, defined with the *gp_Vec* class on its X, Y and Z coordinates, is:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
gp_Vec aPrismVec(0, 0, myHeight); gp_Vec aPrismVec(0, 0, myHeight);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All the necessary data to create the main body of your bottle is now available. Just apply the *BRepPrimAPI_MakePrism* class to compute the solid: All the necessary data to create the main body of your bottle is now available. Just apply the *BRepPrimAPI_MakePrism* class to compute the solid:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
TopoDS_Shape myBody = BRepPrimAPI_MakePrism(myFaceProfile, aPrismVec); TopoDS_Shape myBody = BRepPrimAPI_MakePrism(myFaceProfile, aPrismVec);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsection OCCT_TUTORIAL_SUB3_2 Applying Fillets @subsection OCCT_TUTORIAL_SUB3_2 Applying Fillets
@@ -297,7 +297,7 @@ For our purposes, we will specify that fillets must be:
* applied on all edges of the shape * applied on all edges of the shape
* have a radius of *myThickness* / 12 * have a radius of *myThickness* / 12
@figure{/tutorial/images/tutorial_image008.png,"",240} height=350px @figure{/tutorial/images/tutorial_image008.png,"",240}
To apply fillets on the edges of a shape, you use the *BRepFilletAPI_MakeFillet* class. This class is normally used as follows: To apply fillets on the edges of a shape, you use the *BRepFilletAPI_MakeFillet* class. This class is normally used as follows:
@@ -305,9 +305,9 @@ To apply fillets on the edges of a shape, you use the *BRepFilletAPI_MakeFillet*
* Add the fillet descriptions (an edge and a radius) using the *Add* method (you can add as many edges as you need). * Add the fillet descriptions (an edge and a radius) using the *Add* method (you can add as many edges as you need).
* Ask for the resulting filleted shape with the *Shape* method. * Ask for the resulting filleted shape with the *Shape* method.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
BRepFilletAPI_MakeFillet mkFillet(myBody); BRepFilletAPI_MakeFillet mkFillet(myBody);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To add the fillet description, you need to know the edges belonging to your shape. The best solution is to explore your solid to retrieve its edges. This kind of functionality is provided with the *TopExp_Explorer* class, which explores the data structure described in a *TopoDS_Shape* and extracts the sub-shapes you specifically need. To add the fillet description, you need to know the edges belonging to your shape. The best solution is to explore your solid to retrieve its edges. This kind of functionality is provided with the *TopExp_Explorer* class, which explores the data structure described in a *TopoDS_Shape* and extracts the sub-shapes you specifically need.
Generally, this explorer is created by providing the following information: Generally, this explorer is created by providing the following information:
@@ -315,9 +315,9 @@ Generally, this explorer is created by providing the following information:
* the shape to explore * the shape to explore
* the type of sub-shapes to be found. This information is given with the *TopAbs_ShapeEnum* enumeration. * the type of sub-shapes to be found. This information is given with the *TopAbs_ShapeEnum* enumeration.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
TopExp_Explorer anEdgeExplorer(myBody, TopAbs_EDGE); TopExp_Explorer anEdgeExplorer(myBody, TopAbs_EDGE);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An explorer is usually applied in a loop by using its three main methods: An explorer is usually applied in a loop by using its three main methods:
@@ -326,26 +326,26 @@ An explorer is usually applied in a loop by using its three main methods:
* *Next()* to move onto the next sub-shape to explore. * *Next()* to move onto the next sub-shape to explore.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
while(anEdgeExplorer.More()){ while(anEdgeExplorer.More()){
TopoDS_Edge anEdge = TopoDS::Edge(anEdgeExplorer.Current()); TopoDS_Edge anEdge = TopoDS::Edge(anEdgeExplorer.Current());
//Add edge to fillet algorithm //Add edge to fillet algorithm
... ...
anEdgeExplorer.Next(); anEdgeExplorer.Next();
} }
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the explorer loop, you have found all the edges of the bottle shape. Each one must then be added in the *BRepFilletAPI_MakeFillet* instance with the *Add()* method. Do not forget to specify the radius of the fillet along with it. In the explorer loop, you have found all the edges of the bottle shape. Each one must then be added in the *BRepFilletAPI_MakeFillet* instance with the *Add()* method. Do not forget to specify the radius of the fillet along with it.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
mkFillet.Add(myThickness / 12., anEdge); mkFillet.Add(myThickness / 12., anEdge);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Once this is done, you perform the last step of the procedure by asking for the filleted shape. Once this is done, you perform the last step of the procedure by asking for the filleted shape.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
myBody = mkFillet.Shape(); myBody = mkFillet.Shape();
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsection OCCT_TUTORIAL_SUB3_3 Adding the Neck @subsection OCCT_TUTORIAL_SUB3_3 Adding the Neck
@@ -353,36 +353,36 @@ Once this is done, you perform the last step of the procedure by asking for the
To add a neck to the bottle, you will create a cylinder and fuse it to the body. The cylinder is to be positioned on the top face of the body with a radius of *myThickness* / 4. and a height of *myHeight* / 10. To add a neck to the bottle, you will create a cylinder and fuse it to the body. The cylinder is to be positioned on the top face of the body with a radius of *myThickness* / 4. and a height of *myHeight* / 10.
@figure{/tutorial/images/tutorial_image009.png,"",240} height=350px @figure{/tutorial/images/tutorial_image009.png,"",240}
To position the cylinder, you need to define a coordinate system with the *gp_Ax2* class defining a right-handed coordinate system from a point and two directions - the main (Z) axis direction and the X direction (the Y direction is computed from these two). To position the cylinder, you need to define a coordinate system with the *gp_Ax2* class defining a right-handed coordinate system from a point and two directions - the main (Z) axis direction and the X direction (the Y direction is computed from these two).
To align the neck with the center of the top face, being in the global coordinate system (0, 0, *myHeight*), with its normal on the global Z axis, your local coordinate system can be defined as follows: To align the neck with the center of the top face, being in the global coordinate system (0, 0, *myHeight*), with its normal on the global Z axis, your local coordinate system can be defined as follows:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
gp_Pnt neckLocation(0, 0, myHeight); gp_Pnt neckLocation(0, 0, myHeight);
gp_Dir neckAxis = gp::DZ(); gp_Dir neckAxis = gp::DZ();
gp_Ax2 neckAx2(neckLocation, neckAxis); gp_Ax2 neckAx2(neckLocation, neckAxis);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To create a cylinder, use another class from the primitives construction package: the *BRepPrimAPI_MakeCylinder* class. The information you must provide is: To create a cylinder, use another class from the primitives construction package: the *BRepPrimAPI_MakeCylinder* class. The information you must provide is:
* the coordinate system where the cylinder will be located; * the coordinate system where the cylinder will be located;
* the radius and height. * the radius and height.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
Standard_Real myNeckRadius = myThickness / 4.; Standard_Real myNeckRadius = myThickness / 4.;
Standard_Real myNeckHeight = myHeight / 10; Standard_Real myNeckHeight = myHeight / 10;
BRepPrimAPI_MakeCylinder MKCylinder(neckAx2, myNeckRadius, myNeckHeight); BRepPrimAPI_MakeCylinder MKCylinder(neckAx2, myNeckRadius, myNeckHeight);
TopoDS_Shape myNeck = MKCylinder.Shape(); TopoDS_Shape myNeck = MKCylinder.Shape();
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You now have two separate parts: a main body and a neck that you need to fuse together. You now have two separate parts: a main body and a neck that you need to fuse together.
The *BRepAlgoAPI* package provides services to perform Boolean operations between shapes, and especially: *common* (Boolean intersection), *cut* (Boolean subtraction) and *fuse* (Boolean union). The *BRepAlgoAPI* package provides services to perform Boolean operations between shapes, and especially: *common* (Boolean intersection), *cut* (Boolean subtraction) and *fuse* (Boolean union).
Use *BRepAlgoAPI_Fuse* to fuse the two shapes: Use *BRepAlgoAPI_Fuse* to fuse the two shapes:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
myBody = BRepAlgoAPI_Fuse(myBody, myNeck); myBody = BRepAlgoAPI_Fuse(myBody, myNeck);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsection OCCT_TUTORIAL_SUB3_4 Creating a Hollowed Solid @subsection OCCT_TUTORIAL_SUB3_4 Creating a Hollowed Solid
@@ -395,7 +395,7 @@ In Open CASCADE Technology, a hollowed solid is called a *Thick* *Solid* and is
* Create a parallel wall W2 from W1 at a distance D. If D is positive, W2 will be outside the initial solid, otherwise it will be inside. * Create a parallel wall W2 from W1 at a distance D. If D is positive, W2 will be outside the initial solid, otherwise it will be inside.
* Compute a solid from the two walls W1 and W2. * Compute a solid from the two walls W1 and W2.
@figure{/tutorial/images/tutorial_image010.png,"",240} height=350px @figure{/tutorial/images/tutorial_image010.png,"",240}
To compute a thick solid, you create an instance of the *BRepOffsetAPI_MakeThickSolid* class by giving the following information: To compute a thick solid, you create an instance of the *BRepOffsetAPI_MakeThickSolid* class by giving the following information:
@@ -411,11 +411,11 @@ The challenging part in this procedure is to find the face to remove from your s
To find the face with such characteristics, you will once again use an explorer to iterate on all the bottle's faces to find the appropriate one. To find the face with such characteristics, you will once again use an explorer to iterate on all the bottle's faces to find the appropriate one.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
for(TopExp_Explorer aFaceExplorer(myBody, TopAbs_FACE) ; aFaceExplorer.More() ; aFaceExplorer.Next()){ for(TopExp_Explorer aFaceExplorer(myBody, TopAbs_FACE) ; aFaceExplorer.More() ; aFaceExplorer.Next()){
TopoDS_Face aFace = TopoDS::Face(aFaceExplorer.Current()); TopoDS_Face aFace = TopoDS::Face(aFaceExplorer.Current());
} }
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For each detected face, you need to access the geometric properties of the shape: use the *BRep_Tool* class for that. The most commonly used methods of this class are: For each detected face, you need to access the geometric properties of the shape: use the *BRep_Tool* class for that. The most commonly used methods of this class are:
@@ -423,9 +423,9 @@ For each detected face, you need to access the geometric properties of the shape
* *Curve* to access the 3D curve of an edge; * *Curve* to access the 3D curve of an edge;
* *Point* to access the 3D point of a vertex. * *Point* to access the 3D point of a vertex.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace); Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As you can see, the *BRep_Tool::Surface* method returns an instance of the *Geom_Surface* class manipulated by handle. However, the *Geom_Surface* class does not provide information about the real type of the object *aSurface*, which could be an instance of *Geom_Plane*, *Geom_CylindricalSurface*, etc. As you can see, the *BRep_Tool::Surface* method returns an instance of the *Geom_Surface* class manipulated by handle. However, the *Geom_Surface* class does not provide information about the real type of the object *aSurface*, which could be an instance of *Geom_Plane*, *Geom_CylindricalSurface*, etc.
All objects manipulated by handle, like *Geom_Surface*, inherit from the *Standard_Transient* class which provides two very useful methods concerning types: All objects manipulated by handle, like *Geom_Surface*, inherit from the *Standard_Transient* class which provides two very useful methods concerning types:
@@ -436,51 +436,52 @@ All objects manipulated by handle, like *Geom_Surface*, inherit from the *Standa
DynamicType returns the real type of the object, but you need to compare it with the existing known types to determine whether *aSurface* is a plane, a cylindrical surface or some other type. DynamicType returns the real type of the object, but you need to compare it with the existing known types to determine whether *aSurface* is a plane, a cylindrical surface or some other type.
To compare a given type with the type you seek, use the *STANDARD_TYPE* macro, which returns the type of a class: To compare a given type with the type you seek, use the *STANDARD_TYPE* macro, which returns the type of a class:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
if(aSurface->DynamicType() == STANDARD_TYPE(Geom_Plane)){ if(aSurface->DynamicType() == STANDARD_TYPE(Geom_Plane)){
//
} }
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If this comparison is true, you know that the *aSurface* real type is *Geom_Plane*. You can then convert it from *Geom_Surface* to *Geom_Plane* by using the *DownCast()* method provided by each class inheriting *Standard_Transient*. As its name implies, this static method is used to downcast objects to a given type with the following syntax: If this comparison is true, you know that the *aSurface* real type is *Geom_Plane*. You can then convert it from *Geom_Surface* to *Geom_Plane* by using the *DownCast()* method provided by each class inheriting *Standard_Transient*. As its name implies, this static method is used to downcast objects to a given type with the following syntax:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aSurface); Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aSurface);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Remember that the goal of all these conversions is to find the highest face of the bottle lying on a plane. Suppose that you have these two global variables: Remember that the goal of all these conversions is to find the highest face of the bottle lying on a plane. Suppose that you have these two global variables:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
TopoDS_Face faceToRemove; TopoDS_Face faceToRemove;
Standard_Real zMax = -1; Standard_Real zMax = -1;
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can easily find the plane whose origin is the biggest in Z knowing that the location of the plane is given with the *Geom_Plane::Location* method. For example: You can easily find the plane whose origin is the biggest in Z knowing that the location of the plane is given with the *Geom_Plane::Location* method. For example:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
gp_Pnt aPnt = aPlane->Location(); gp_Pnt aPnt = aPlane->Location();
Standard_Real aZ = aPnt.Z(); Standard_Real aZ = aPnt.Z();
if(aZ > zMax){ if(aZ > zMax){
zMax = aZ; zMax = aZ;
faceToRemove = aFace; faceToRemove = aFace;
} }
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You have now found the top face of the neck. Your final step before creating the hollowed solid is to put this face in a list. Since more than one face can be removed from the initial solid, the *BRepOffsetAPI_MakeThickSolid* constructor takes a list of faces as arguments. You have now found the top face of the neck. Your final step before creating the hollowed solid is to put this face in a list. Since more than one face can be removed from the initial solid, the *BRepOffsetAPI_MakeThickSolid* constructor takes a list of faces as arguments.
Open CASCADE Technology provides many collections for different kinds of objects: see *TColGeom* package for collections of objects from *Geom* package, *TColgp* package for collections of objects from gp package, etc. Open CASCADE Technology provides many collections for different kinds of objects: see *TColGeom* package for collections of objects from *Geom* package, *TColgp* package for collections of objects from gp package, etc.
The collection for shapes can be found in the *TopTools* package. As *BRepOffsetAPI_MakeThickSolid* requires a list, use the *TopTools_ListOfShape* class. The collection for shapes can be found in the *TopTools* package. As *BRepOffsetAPI_MakeThickSolid* requires a list, use the *TopTools_ListOfShape* class.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
TopTools_ListOfShape facesToRemove; TopTools_ListOfShape facesToRemove;
facesToRemove.Append(faceToRemove); facesToRemove.Append(faceToRemove);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All the necessary data are now available so you can create your hollowed solid by calling the *BRepOffsetAPI_MakeThickSolid* MakeThickSolidByJoin method: All the necessary data are now available so you can create your hollowed solid by calling the *BRepOffsetAPI_MakeThickSolid* MakeThickSolidByJoin method:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
BRepOffsetAPI_MakeThickSolid aSolidMaker; BRepOffsetAPI_MakeThickSolid BodyMaker;
aSolidMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3); BodyMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3);
myBody = aSolidMaker.Shape(); myBody = BodyMaker.Shape();
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@section sec4 Building the Threading @section sec4 Building the Threading
@@ -492,7 +493,7 @@ All the necessary data are now available so you can create your hollowed solid b
Up to now, you have learned how to create edges out of 3D curves. Up to now, you have learned how to create edges out of 3D curves.
You will now learn how to create an edge out of a 2D curve and a surface. You will now learn how to create an edge out of a 2D curve and a surface.
To learn this aspect of Open CASCADE Technology, you will build helicoidal profiles out of 2D curves on cylindrical surfaces. The theory is more complex than in previous steps, but applying it is very simple. To learn this aspect of Open CASCADE Technology, you will build helicoidal profiles out of 2D curves on cylindrical surfaces. The theory is more complex than in previous steps, but applying it is very simple.
As a first step, you compute these cylindrical surfaces. You are already familiar with the curves of the *Geom* package. Now you can create a cylindrical surface (*Geom_CylindricalSurface*) using: As a first step, you compute these cylindrical surfaces. You are already familiar with curves of the *Geom* package. Now you can create a cylindrical surface (*Geom_CylindricalSurface*) using:
* a coordinate system; * a coordinate system;
* a radius. * a radius.
@@ -503,11 +504,11 @@ Using the same coordinate system *neckAx2* used to position the neck, you create
Notice that one of the cylindrical surfaces is smaller than the neck. There is a good reason for this: after the thread creation, you will fuse it with the neck. So, we must make sure that the two shapes remain in contact. Notice that one of the cylindrical surfaces is smaller than the neck. There is a good reason for this: after the thread creation, you will fuse it with the neck. So, we must make sure that the two shapes remain in contact.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
Handle(Geom_CylindricalSurface) aCyl1 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 0.99); Handle(Geom_CylindricalSurface) aCyl1 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 0.99);
Handle(Geom_CylindricalSurface) aCyl2 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 1.05); Handle(Geom_CylindricalSurface) aCyl2 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 1.05);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsection OCCT_TUTORIAL_SUB4_2 Defining 2D Curves @subsection OCCT_TUTORIAL_SUB4_2 Defining 2D Curves
@@ -563,11 +564,11 @@ To use 2D primitive geometry types of Open CASCADE Technology for defining a poi
* To define a 2D direction (unit vector) from its X and Y coordinates, use the gp_Dir2d class. The coordinates will automatically be normalized. * To define a 2D direction (unit vector) from its X and Y coordinates, use the gp_Dir2d class. The coordinates will automatically be normalized.
* To define a 2D right-handed coordinate system, use the *gp_Ax2d* class, which is computed from a point (origin of the coordinate system) and a direction - the X direction of the coordinate system. The Y direction will be automatically computed. * To define a 2D right-handed coordinate system, use the *gp_Ax2d* class, which is computed from a point (origin of the coordinate system) and a direction - the X direction of the coordinate system. The Y direction will be automatically computed.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
gp_Pnt2d aPnt(2. * M_PI, myNeckHeight / 2.); gp_Pnt2d aPnt(2. * M_PI, myNeckHeight / 2.);
gp_Dir2d aDir(2. * M_PI, myNeckHeight / 4.); gp_Dir2d aDir(2. * M_PI, myNeckHeight / 4.);
gp_Ax2d anAx2d(aPnt, aDir); gp_Ax2d anAx2d(aPnt, aDir);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You will now define the curves. As previously mentioned, these thread profiles are computed on two cylindrical surfaces. In the following figure, curves on the left define the base (on *aCyl1* surface) and the curves on the right define the top of the thread's shape (on *aCyl2* surface). You will now define the curves. As previously mentioned, these thread profiles are computed on two cylindrical surfaces. In the following figure, curves on the left define the base (on *aCyl1* surface) and the curves on the right define the top of the thread's shape (on *aCyl2* surface).
@@ -587,36 +588,36 @@ Supposing that:
Your ellipses are defined as follows: Your ellipses are defined as follows:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
Standard_Real aMajor = 2. * M_PI; Standard_Real aMajor = 2. * M_PI;
Standard_Real aMinor = myNeckHeight / 10; Standard_Real aMinor = myNeckHeight / 10;
Handle(Geom2d_Ellipse) anEllipse1 = new Geom2d_Ellipse(anAx2d, aMajor, aMinor); Handle(Geom2d_Ellipse) anEllipse1 = new Geom2d_Ellipse(anAx2d, aMajor, aMinor);
Handle(Geom2d_Ellipse) anEllipse2 = new Geom2d_Ellipse(anAx2d, aMajor, aMinor / 4); Handle(Geom2d_Ellipse) anEllipse2 = new Geom2d_Ellipse(anAx2d, aMajor, aMinor / 4);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To describe portions of curves for the arcs drawn above, you define *Geom2d_TrimmedCurve* trimmed curves out of the created ellipses and two parameters to limit them. To describe portions of curves for the arcs drawn above, you define *Geom2d_TrimmedCurve* trimmed curves out of the created ellipses and two parameters to limit them.
As the parametric equation of an ellipse is P(U) = O + (MajorRadius * cos(U) * XDirection) + (MinorRadius * sin(U) * YDirection), the ellipses need to be limited between 0 and M_PI. As the parametric equation of an ellipse is P(U) = O + (MajorRadius * cos(U) * XDirection) + (MinorRadius * sin(U) * YDirection), the ellipses need to be limited between 0 and M_PI.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
Handle(Geom2d_TrimmedCurve) anArc1 = new Geom2d_TrimmedCurve(anEllipse1, 0, M_PI); Handle(Geom2d_TrimmedCurve) anArc1 = new Geom2d_TrimmedCurve(anEllipse1, 0, M_PI);
Handle(Geom2d_TrimmedCurve) anArc2 = new Geom2d_TrimmedCurve(anEllipse2, 0, M_PI); Handle(Geom2d_TrimmedCurve) anArc2 = new Geom2d_TrimmedCurve(anEllipse2, 0, M_PI);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The last step consists in defining the segment, which is the same for the two profiles: a line limited by the first and the last point of one of the arcs. The last step consists in defining the segment, which is the same for the two profiles: a line limited by the first and the last point of one of the arcs.
To access the point corresponding to the parameter of a curve or a surface, you use the Value or D0 method (meaning 0th derivative), D1 method is for the first derivative, D2 for the second one. To access the point corresponding to the parameter of a curve or a surface, you use the Value or D0 method (meaning 0th derivative), D1 method is for first derivative, D2 for the second one.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
gp_Pnt2d anEllipsePnt1 = anEllipse1->Value(0); gp_Pnt2d anEllipsePnt1 = anEllipse1->Value(0);
gp_Pnt2d anEllipsePnt2; gp_Pnt2d anEllipsePnt2;
anEllipse1->D0(M_PI, anEllipsePnt2); anEllipse1->D0(M_PI, anEllipsePnt2);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When creating the bottle's profile, you used classes from the *GC* package, providing algorithms to create elementary geometries. When creating the bottle's profile, you used classes from the *GC* package, providing algorithms to create elementary geometries.
In 2D geometry, this kind of algorithms is found in the *GCE2d* package. Class names and behaviors are similar to those in *GC*. For example, to create a 2D segment out of two points: In 2D geometry, this kind of algorithms is found in the *GCE2d* package. Class names and behaviors are similar to those in *GC*. For example, to create a 2D segment out of two points:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
Handle(Geom2d_TrimmedCurve) aSegment = GCE2d_MakeSegment(anEllipsePnt1, anEllipsePnt2); Handle(Geom2d_TrimmedCurve) aSegment = GCE2d_MakeSegment(anEllipsePnt1, anEllipsePnt2);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsection OCCT_TUTORIAL_SUB4_3 Building Edges and Wires @subsection OCCT_TUTORIAL_SUB4_3 Building Edges and Wires
@@ -636,28 +637,28 @@ Previously, you have built:
To compute the edges out of these curves, once again use the *BRepBuilderAPI_MakeEdge* class. One of its constructors allows you to build an edge out of a curve described in the 2D parametric space of a surface. To compute the edges out of these curves, once again use the *BRepBuilderAPI_MakeEdge* class. One of its constructors allows you to build an edge out of a curve described in the 2D parametric space of a surface.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
TopoDS_Edge anEdge1OnSurf1 = BRepBuilderAPI_MakeEdge(anArc1, aCyl1); TopoDS_Edge anEdge1OnSurf1 = BRepBuilderAPI_MakeEdge(anArc1, aCyl1);
TopoDS_Edge anEdge2OnSurf1 = BRepBuilderAPI_MakeEdge(aSegment, aCyl1); TopoDS_Edge anEdge2OnSurf1 = BRepBuilderAPI_MakeEdge(aSegment, aCyl1);
TopoDS_Edge anEdge1OnSurf2 = BRepBuilderAPI_MakeEdge(anArc2, aCyl2); TopoDS_Edge anEdge1OnSurf2 = BRepBuilderAPI_MakeEdge(anArc2, aCyl2);
TopoDS_Edge anEdge2OnSurf2 = BRepBuilderAPI_MakeEdge(aSegment, aCyl2); TopoDS_Edge anEdge2OnSurf2 = BRepBuilderAPI_MakeEdge(aSegment, aCyl2);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Now, you can create the two profiles of the threading, lying on each surface. Now, you can create the two profiles of the threading, lying on each surface.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
TopoDS_Wire threadingWire1 = BRepBuilderAPI_MakeWire(anEdge1OnSurf1, anEdge2OnSurf1); TopoDS_Wire threadingWire1 = BRepBuilderAPI_MakeWire(anEdge1OnSurf1, anEdge2OnSurf1);
TopoDS_Wire threadingWire2 = BRepBuilderAPI_MakeWire(anEdge1OnSurf2, anEdge2OnSurf2); TopoDS_Wire threadingWire2 = BRepBuilderAPI_MakeWire(anEdge1OnSurf2, anEdge2OnSurf2);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Remember that these wires were built out of a surface and 2D curves. Remember that these wires were built out of a surface and 2D curves.
One important data item is missing as far as these wires are concerned: there is no information on the 3D curves. Fortunately, you do not need to compute this yourself, which can be a difficult task since the mathematics can be quite complex. One important data item is missing as far as these wires are concerned: there is no information on the 3D curves. Fortunately, you do not need to compute this yourself, which can be a difficult task since the mathematics can be quite complex.
When a shape contains all the necessary information except 3D curves, Open CASCADE Technology provides a tool to build them automatically. In the BRepLib tool package, you can use the *BuildCurves3d* method to compute 3D curves for all the edges of a shape. When a shape contains all the necessary information except 3D curves, Open CASCADE Technology provides a tool to build them automatically. In the BRepLib tool package, you can use the *BuildCurves3d* method to compute 3D curves for all the edges of a shape.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
BRepLib::BuildCurves3d(threadingWire1); BRepLib::BuildCurves3d(threadingWire1);
BRepLib::BuildCurves3d(threadingWire2); BRepLib::BuildCurves3d(threadingWire2);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsection OCCT_TUTORIAL_SUB4_4 Creating Threading @subsection OCCT_TUTORIAL_SUB4_4 Creating Threading
@@ -674,12 +675,12 @@ The loft function is implemented in the *BRepOffsetAPI_ThruSections* class, whic
* Use the *CheckCompatibility* method to activate (or deactivate) the option that checks whether the wires have the same number of edges. In this case, wires have two edges each, so you can deactivate this option. * Use the *CheckCompatibility* method to activate (or deactivate) the option that checks whether the wires have the same number of edges. In this case, wires have two edges each, so you can deactivate this option.
* Ask for the resulting loft shape with the Shape method. * Ask for the resulting loft shape with the Shape method.
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
BRepOffsetAPI_ThruSections aTool(Standard_True); BRepOffsetAPI_ThruSections aTool(Standard_True);
aTool.AddWire(threadingWire1); aTool.AddWire(threadingWire2); aTool.AddWire(threadingWire1); aTool.AddWire(threadingWire2);
aTool.CheckCompatibility(Standard_False); aTool.CheckCompatibility(Standard_False);
TopoDS_Shape myThreading = aTool.Shape(); TopoDS_Shape myThreading = aTool.Shape();
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@section sec5 Building the Resulting Compound @section sec5 Building the Resulting Compound
@@ -687,17 +688,17 @@ The loft function is implemented in the *BRepOffsetAPI_ThruSections* class, whic
You are almost done building the bottle. Use the *TopoDS_Compound* and *BRep_Builder* classes to build single shape from *myBody* and *myThreading*: You are almost done building the bottle. Use the *TopoDS_Compound* and *BRep_Builder* classes to build single shape from *myBody* and *myThreading*:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
TopoDS_Compound aRes; TopoDS_Compound aRes;
BRep_Builder aBuilder; BRep_Builder aBuilder;
aBuilder.MakeCompound (aRes); aBuilder.MakeCompound (aRes);
aBuilder.Add (aRes, myBody); aBuilder.Add (aRes, myBody);
aBuilder.Add (aRes, myThreading); aBuilder.Add (aRes, myThreading);
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Congratulations! Your bottle is complete. Here is the result snapshot of the Tutorial application: Congratulations! Your bottle is complete. Here is the result snapshot of the Tutorial application:
@figure{/tutorial/images/tutorial_image019.png,"",320} height=450px @figure{/tutorial/images/tutorial_image019.png,"",320}
We hope that this tutorial has provided you with a feel for the industrial strength power of Open CASCADE Technology. We hope that this tutorial has provided you with a feel for the industrial strength power of Open CASCADE Technology.
If you want to know more and develop major projects using Open CASCADE Technology, we invite you to study our training, support, and consulting services on our site at https://www.opencascade.com/content/technology-support. Our professional services can maximize the power of your Open CASCADE Technology applications. If you want to know more and develop major projects using Open CASCADE Technology, we invite you to study our training, support, and consulting services on our site at https://www.opencascade.com/content/technology-support. Our professional services can maximize the power of your Open CASCADE Technology applications.
@@ -708,7 +709,7 @@ If you want to know more and develop major projects using Open CASCADE Technolog
Complete definition of MakeBottle function (defined in the file src/MakeBottle.cxx of the Tutorial): Complete definition of MakeBottle function (defined in the file src/MakeBottle.cxx of the Tutorial):
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
TopoDS_Shape MakeBottle(const Standard_Real myWidth, const Standard_Real myHeight, TopoDS_Shape MakeBottle(const Standard_Real myWidth, const Standard_Real myHeight,
const Standard_Real myThickness) const Standard_Real myThickness)
{ {
@@ -795,9 +796,9 @@ Complete definition of MakeBottle function (defined in the file src/MakeBottle.c
TopTools_ListOfShape facesToRemove; TopTools_ListOfShape facesToRemove;
facesToRemove.Append(faceToRemove); facesToRemove.Append(faceToRemove);
BRepOffsetAPI_MakeThickSolid aSolidMaker; BRepOffsetAPI_MakeThickSolid BodyMaker;
aSolidMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3); BodyMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3);
myBody = aSolidMaker.Shape(); myBody = BodyMaker.Shape();
// Threading : Create Surfaces // Threading : Create Surfaces
Handle(Geom_CylindricalSurface) aCyl1 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 0.99); Handle(Geom_CylindricalSurface) aCyl1 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 0.99);
Handle(Geom_CylindricalSurface) aCyl2 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 1.05); Handle(Geom_CylindricalSurface) aCyl2 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 1.05);
@@ -845,5 +846,5 @@ Complete definition of MakeBottle function (defined in the file src/MakeBottle.c
return aRes; return aRes;
} }
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -7,8 +7,6 @@ Upgrade from older OCCT versions {#occt__upgrade}
This document provides technical details on changes made in particular versions of OCCT. It can help to upgrade user applications based on previous versions of OCCT to newer ones. This document provides technical details on changes made in particular versions of OCCT. It can help to upgrade user applications based on previous versions of OCCT to newer ones.
@ref upgrade_occt770 "SEEK TO THE LAST CHAPTER (UPGRADE TO 7.7.0)"
@subsection upgrade_intro_precautions Precautions @subsection upgrade_intro_precautions Precautions
Back-up your code before the upgrade. Back-up your code before the upgrade.
@@ -26,6 +24,7 @@ The automatic upgrade tool is provided as is, without warranty of any kind, and
It is your responsibility to ensure that the changes you made in your code are correct. It is your responsibility to ensure that the changes you made in your code are correct.
When you upgrade the code by an automatic script, make sure to carefully review the introduced changes at each step before committing them. When you upgrade the code by an automatic script, make sure to carefully review the introduced changes at each step before committing them.
@section upgrade_65 Upgrade to OCCT 6.5.0 @section upgrade_65 Upgrade to OCCT 6.5.0
Porting of user applications from an earlier OCCT version to version 6.5 requires taking into account the following major changes: Porting of user applications from an earlier OCCT version to version 6.5 requires taking into account the following major changes:
@@ -40,7 +39,7 @@ Porting of user applications from an earlier OCCT version to version 6.5 require
Porting of user applications from an earlier OCCT version to version 6.5.1 requires taking into account the following major changes: Porting of user applications from an earlier OCCT version to version 6.5.1 requires taking into account the following major changes:
* Method *Graphic3d_Structure::Groups()* now returns *Graphic3d_SequenceOfGroup*. If this method has been used, the application code should be updated to iterate another collection type or, if *Graphic3d_HSetOfGroup* is required, to fill its own collection: * Method *Graphic3d_Structure::Groups()* now returns *Graphic3d_SequenceOfGroup*. If this method has been used, the application code should be updated to iterate another collection type or, if *Graphic3d_HSetOfGroup* is required, to fill its own collection:
~~~~{.cpp} ~~~~
const Graphic3d_SequenceOfGroup& aGroupsSeq = theStructure.Groups(); const Graphic3d_SequenceOfGroup& aGroupsSeq = theStructure.Groups();
Handle(Graphic3d_HSetOfGroup) aGroupSet = new Graphic3d_HSetOfGroup(); Handle(Graphic3d_HSetOfGroup) aGroupSet = new Graphic3d_HSetOfGroup();
Standard_Integer aLen = aGroupsSeq.Length(); Standard_Integer aLen = aGroupsSeq.Length();
@@ -63,7 +62,7 @@ Porting of user applications from an earlier OCCT version to version 6.5.2 requi
* If the callback mechanism in call_togl_redraw function was used in the application code, it is necessary to revise it to take into account the new callback execution and provide a check of reason value of Aspect_GraphicCallbackStruct in callback methods to confirm that the callback code is executed at the right moment. Now the callbacks are executed before redrawing the underlayer, before redrawing the overlayer and at the end of redrawing. The information about the moment when the callback is invoked is provided with the reason value in form of an additional bit flag <i>(OCC_PRE_REDRAW, OCC_PRE_OVERLAY)</i>. The state of OpenGl changed in callback methods will not be restored automatically, which might lead to unwanted behavior in redrawing procedure. * If the callback mechanism in call_togl_redraw function was used in the application code, it is necessary to revise it to take into account the new callback execution and provide a check of reason value of Aspect_GraphicCallbackStruct in callback methods to confirm that the callback code is executed at the right moment. Now the callbacks are executed before redrawing the underlayer, before redrawing the overlayer and at the end of redrawing. The information about the moment when the callback is invoked is provided with the reason value in form of an additional bit flag <i>(OCC_PRE_REDRAW, OCC_PRE_OVERLAY)</i>. The state of OpenGl changed in callback methods will not be restored automatically, which might lead to unwanted behavior in redrawing procedure.
* The print method used in the application code might need to be revised to take into account the ability to choose between print algorithms: tile and stretch. The stretch algorithm will be selected by default during porting. * The print method used in the application code might need to be revised to take into account the ability to choose between print algorithms: tile and stretch. The stretch algorithm will be selected by default during porting.
* It is recommended to *BRepMesh_DiscretFactory* users, to check *BRepMesh_DiscretFactory::SetDefault()* return value to determine plugin availability / validity. *BRepMesh_DiscretFactory::Discret()* method now returns handle instead of pointer. The code should be updated in the following manner: * It is recommended to *BRepMesh_DiscretFactory* users, to check *BRepMesh_DiscretFactory::SetDefault()* return value to determine plugin availability / validity. *BRepMesh_DiscretFactory::Discret()* method now returns handle instead of pointer. The code should be updated in the following manner:
~~~~{.cpp} ~~~~
Handle(BRepMesh_DiscretRoot) aMeshAlgo = BRepMesh_DiscretFactory::Get().Discret (theShape, theDeflection, theAngularToler); Handle(BRepMesh_DiscretRoot) aMeshAlgo = BRepMesh_DiscretFactory::Get().Discret (theShape, theDeflection, theAngularToler);
if (!aMeshAlgo.IsNull()) {} if (!aMeshAlgo.IsNull()) {}
~~~~ ~~~~
@@ -89,7 +88,7 @@ Porting of user applications from an earlier OCCT version to version 6.5.3 requi
Porting of user applications from an earlier OCCT version to version 6.5.4 requires taking into account the following major changes: Porting of user applications from an earlier OCCT version to version 6.5.4 requires taking into account the following major changes:
* The code using obsolete classes *Aspect_PixMap, Xw_PixMap* and *WNT_PixMap* should be rewritten implementing class *Image_PixMap*, which is now retrieved by *ToPixMap* methods as argument. A sample code using *ToPixMap* is given below: * The code using obsolete classes *Aspect_PixMap, Xw_PixMap* and *WNT_PixMap* should be rewritten implementing class *Image_PixMap*, which is now retrieved by *ToPixMap* methods as argument. A sample code using *ToPixMap* is given below:
~~~~{.cpp} ~~~~
#include <Image_AlienPixMap.hxx> #include <Image_AlienPixMap.hxx>
void dump (Handle(V3d_View)& theView3D) void dump (Handle(V3d_View)& theView3D)
{ {
@@ -122,7 +121,7 @@ Correspondingly, the code using methods *SetAnimationModeOn(), SetAnimationModeO
* Interactive selection of 2D presentations should be set up inside *ComputeSelection()* virtual method of a custom interactive object class, using standard sensitive entities from *Select3D* package and standard or custom entity owners derived from *SelectMgr_EntityOwner* base. * Interactive selection of 2D presentations should be set up inside *ComputeSelection()* virtual method of a custom interactive object class, using standard sensitive entities from *Select3D* package and standard or custom entity owners derived from *SelectMgr_EntityOwner* base.
Refer to the Visualization User's Guide for further details concerning OCCT 3D visualization and selection classes. See also *Viewer2D* OCCT sample application, which shows how 2D drawing can be implemented using TKV3d API. Refer to the Visualization User's Guide for further details concerning OCCT 3D visualization and selection classes. See also *Viewer2D* OCCT sample application, which shows how 2D drawing can be implemented using TKV3d API.
* Run-time graphic driver library loading mechanism based on *CSF_GraphicShr* environment variable usage has been replaced by explicit linking against *TKOpenGl* library. The code sample below shows how the graphic driver should be created and initialized in the application code: * Run-time graphic driver library loading mechanism based on *CSF_GraphicShr* environment variable usage has been replaced by explicit linking against *TKOpenGl* library. The code sample below shows how the graphic driver should be created and initialized in the application code:
~~~~{.cpp} ~~~~
// initialize a new viewer with OpenGl graphic driver // initialize a new viewer with OpenGl graphic driver
Handle(Graphic3d_GraphicDriver) aGraphicDriver = Handle(Graphic3d_GraphicDriver) aGraphicDriver =
new OpenGl_GraphicDriver ("TKOpenGl"); new OpenGl_GraphicDriver ("TKOpenGl");
@@ -265,7 +264,7 @@ Custom Interactive Objects should implement new virtual method *SelectMgr_Select
Now the method *SelectMgr_Selection::Sensitive()* does not return *SelectBasics_SensitiveEntity*. It returns an instance of *SelectMgr_SensitiveEntity*, which belongs to a different class hierarchy (thus *DownCast()* will fail). To access base sensitive it is necessary to use method *SelectMgr_SensitiveEntity::BaseSensitive()*. For example: Now the method *SelectMgr_Selection::Sensitive()* does not return *SelectBasics_SensitiveEntity*. It returns an instance of *SelectMgr_SensitiveEntity*, which belongs to a different class hierarchy (thus *DownCast()* will fail). To access base sensitive it is necessary to use method *SelectMgr_SensitiveEntity::BaseSensitive()*. For example:
~~~~{.cpp} ~~~~
Handle(SelectMgr_Selection) aSelection = anInteractiveObject->Selection (aMode); Handle(SelectMgr_Selection) aSelection = anInteractiveObject->Selection (aMode);
for (aSelection->Init(); aSelection->More(); aSelection->Next()) for (aSelection->Init(); aSelection->More(); aSelection->Next())
{ {
@@ -287,7 +286,7 @@ The depth and distance to the center of geometry must be calculated for the 3D p
Here is an example of overlap/inclusion test for a box: Here is an example of overlap/inclusion test for a box:
~~~~{.cpp} ~~~~
if (!theMgr.IsOverlapAllowed()) // check for inclusion if (!theMgr.IsOverlapAllowed()) // check for inclusion
{ {
Standard_Boolean isInside = Standard_True; Standard_Boolean isInside = Standard_True;
@@ -397,7 +396,7 @@ However, due to redesign of basic mechanisms (CDL generic classes, Handles and R
WOK is not necessary anymore for building OCCT from sources, though it still can be used in a traditional way -- auxiliary files required for that are preserved. WOK is not necessary anymore for building OCCT from sources, though it still can be used in a traditional way -- auxiliary files required for that are preserved.
The recommended method for building OCCT 7.x is CMake, see @ref build_occt_win_cmake. The recommended method for building OCCT 7.x is CMake, see @ref build_occt_win_cmake.
The alternative solution is to use project files generated by OCCT legacy tool **genproj**, see @ref build_occt_genproj. The alternative solution is to use project files generated by OCCT legacy tool **genproj**, see @ref build_occt_genproj, @ref build_occt_win_codeblocks, and @ref build_occt_macos_xcode.
@subsubsection upgrade_occt700_cdl_auto Automatic upgrade @subsubsection upgrade_occt700_cdl_auto Automatic upgrade
@@ -405,26 +404,26 @@ Most of typical changes required for upgrading code for OCCT 7.0 can be done aut
This tool is a Tcl script, thus Tcl should be available on your workstation to run it. This tool is a Tcl script, thus Tcl should be available on your workstation to run it.
Example: Example:
~~~~{.php} ~~~~~
$ tclsh $ tclsh
% source <path_to_occt>/adm/upgrade.tcl % source <path_to_occt>/adm/upgrade.tcl
% upgrade -recurse -all -src=<path_to_your_sources> % upgrade -recurse -all -src=<path_to_your_sources>
~~~~ ~~~~~
On Windows, the helper batch script *upgrade.bat* can be used, provided that Tcl is either available in *PATH*, or configured via *custom.bat* script (for instance, if you use OCCT installed from Windows installer package). Start it from the command prompt: On Windows, the helper batch script *upgrade.bat* can be used, provided that Tcl is either available in *PATH*, or configured via *custom.bat* script (for instance, if you use OCCT installed from Windows installer package). Start it from the command prompt:
~~~~ ~~~~~
cmd> <path_to_occt>\upgrade.bat -recurse -all -inc=<path_to_occt>\inc -src=<path_to_your_sources> [options] cmd> <path_to_occt>\upgrade.bat -recurse -all -inc=<path_to_occt>\inc -src=<path_to_your_sources> [options]
~~~~ ~~~~~
Run the upgrade tool without arguments to see the list of available options. Run the upgrade tool without arguments to see the list of available options.
The upgrade tool performs the following changes in the code. The upgrade tool performs the following changes in the code.
1. Replaces macro *DEFINE_STANDARD_RTTI* by *DEFINE_STANDARD_RTTIEXT*, with second argument indicating base class for the main argument class (if inheritance is recognized by the script): 1. Replaces macro *DEFINE_STANDARD_RTTI* by *DEFINE_STANDARD_RTTIEXT*, with second argument indicating base class for the main argument class (if inheritance is recognized by the script):
~~~~{.cpp} ~~~~~
DEFINE_STANDARD_RTTI(Class) -> DEFINE_STANDARD_RTTIEXT(Class, Base) DEFINE_STANDARD_RTTI(Class) -> DEFINE_STANDARD_RTTIEXT(Class, Base)
~~~~ ~~~~~
@note If macro *DEFINE_STANDARD_RTTI* with two arguments (used in intermediate development versions of OCCT 7.0) is found, the script will convert it to either *DEFINE_STANDARD_RTTIEXT* or *DEFINE_STANDARD_RTTI_INLINE*. @note If macro *DEFINE_STANDARD_RTTI* with two arguments (used in intermediate development versions of OCCT 7.0) is found, the script will convert it to either *DEFINE_STANDARD_RTTIEXT* or *DEFINE_STANDARD_RTTI_INLINE*.
The former case is used if current file is header and source file with the same name is found in the same folder. The former case is used if current file is header and source file with the same name is found in the same folder.
@@ -432,50 +431,50 @@ DEFINE_STANDARD_RTTI(Class) -> DEFINE_STANDARD_RTTIEXT(Class, Base)
The latter variant defines all methods for RTTI as inline, and does not require *IMPLEMENT_STANDARD_RTTIEXT* macro. The latter variant defines all methods for RTTI as inline, and does not require *IMPLEMENT_STANDARD_RTTIEXT* macro.
2. Replaces forward declarations of collection classes previously generated from CDL generics (defined in *TCollection* package) by inclusion of the corresponding header: 2. Replaces forward declarations of collection classes previously generated from CDL generics (defined in *TCollection* package) by inclusion of the corresponding header:
~~~~{.cpp} ~~~~~
class TColStd_Array1OfReal; -> #include <TColStd_Array1OfReal.hxx> class TColStd_Array1OfReal; -> #include <TColStd_Array1OfReal.hxx>
~~~~ ~~~~~
3. Replaces underscored names of *Handle* classes by usage of a macro: 3. Replaces underscored names of *Handle* classes by usage of a macro:
~~~~{.cpp} ~~~~~
Handle_Class -> Handle(Class) Handle_Class -> Handle(Class)
~~~~ ~~~~~
This change is not applied if the source or header file is recognized as containing the definition of Qt class with signals or slots, to avoid possible compilation errors of MOC files caused by inability of MOC to recognize macros (see https://doc.qt.io/qt-4.8/signalsandslots.html). This change is not applied if the source or header file is recognized as containing the definition of Qt class with signals or slots, to avoid possible compilation errors of MOC files caused by inability of MOC to recognize macros (see https://doc.qt.io/qt-4.8/signalsandslots.html).
The file is considered as defining a Qt object if it contains strings *Q_OBJECT* and either *slots:* or *signals:*. The file is considered as defining a Qt object if it contains strings *Q_OBJECT* and either *slots:* or *signals:*.
4. Removes forward declarations of classes with names <i>Handle(C)</i> or *Handle_C*, replacing them either by forward declaration of its argument class, or (for files defining Qt objects) <i>\#include</i> statement for a header with the name of the argument class and extension .hxx: 4. Removes forward declarations of classes with names <i>Handle(C)</i> or *Handle_C*, replacing them either by forward declaration of its argument class, or (for files defining Qt objects) <i>\#include</i> statement for a header with the name of the argument class and extension .hxx:
~~~~{.cpp} ~~~~~
class Handle(TColStd_HArray1OfReal); -> #include <TColStd_HArray1OfReal.hxx> class Handle(TColStd_HArray1OfReal); -> #include <TColStd_HArray1OfReal.hxx>
~~~~ ~~~~~
5. Removes <i> \#includes </i> of files <i>Handle_...hxx</i> that have disappeared in OCCT 7.0: 5. Removes <i> \#includes </i> of files <i>Handle_...hxx</i> that have disappeared in OCCT 7.0:
~~~~{.cpp} ~~~~~
#include <Handle_Geom_Curve.hxx> -> #include <Handle_Geom_Curve.hxx> ->
~~~~ ~~~~~
6. Removes *typedef* statements that use *Handle* macro to generate the name: 6. Removes *typedef* statements that use *Handle* macro to generate the name:
~~~~{.cpp} ~~~~~
typedef NCollection_Handle<Message_Msg> Handle(Message_Msg); -> typedef NCollection_Handle<Message_Msg> Handle(Message_Msg); ->
~~~~ ~~~~~
7. Converts C-style casts applied to Handles into calls to <i>DownCast()</i> method: 7. Converts C-style casts applied to Handles into calls to <i>DownCast()</i> method:
~~~~{.cpp} ~~~~~
((Handle(A)&)b) -> Handle(A)::DownCast(b) ((Handle(A)&)b) -> Handle(A)::DownCast(b)
(Handle(A)&)b -> Handle(A)::DownCast(b) (Handle(A)&)b -> Handle(A)::DownCast(b)
(*((Handle(A)*)&b)) -> Handle(A)::DownCast(b) (*((Handle(A)*)&b)) -> Handle(A)::DownCast(b)
*((Handle(A)*)&b) -> Handle(A)::DownCast(b) *((Handle(A)*)&b) -> Handle(A)::DownCast(b)
(*(Handle(A)*)&b) -> Handle(A)::DownCast(b) (*(Handle(A)*)&b) -> Handle(A)::DownCast(b)
~~~~ ~~~~~
8. Moves <i>Handle()</i> macro out of namespace scope: 8. Moves <i>Handle()</i> macro out of namespace scope:
~~~~{.cpp} ~~~~~
Namespace::Handle(Class) -> Handle(Namespace::Class) Namespace::Handle(Class) -> Handle(Namespace::Class)
~~~~ ~~~~~
9. Converts local variables of reference type, which are initialized by a temporary object returned by call to <i>DownCast()</i>, to the variables of non-reference type (to avoid using references to destroyed memory): 9. Converts local variables of reference type, which are initialized by a temporary object returned by call to <i>DownCast()</i>, to the variables of non-reference type (to avoid using references to destroyed memory):
~~~~{.cpp} ~~~~~
const Handle(A)& a = Handle(B)::DownCast (b); -> Handle(A) a (Handle(B)::DownCast (b)); const Handle(A)& a = Handle(B)::DownCast (b); -> Handle(A) a (Handle(B)::DownCast (b));
~~~~ ~~~~~
10. Adds <i>\#include</i> for all classes used as argument to macro <i>STANDARD_TYPE()</i>, except for already included ones; 10. Adds <i>\#include</i> for all classes used as argument to macro <i>STANDARD_TYPE()</i>, except for already included ones;
@@ -488,9 +487,9 @@ Namespace::Handle(Class) -> Handle(Namespace::Class)
As long as the upgrade routine runs, some information messages are sent to the standard output. As long as the upgrade routine runs, some information messages are sent to the standard output.
In some cases the warnings or errors like the following may appear: In some cases the warnings or errors like the following may appear:
~~~~ ~~~~~
Error in {HEADER_FILE}: Macro DEFINE_STANDARD_RTTI used for class {CLASS_NAME} whose declaration is not found in this file, cannot fix Error in {HEADER_FILE}: Macro DEFINE_STANDARD_RTTI used for class {CLASS_NAME} whose declaration is not found in this file, cannot fix
~~~~ ~~~~~
Be sure to check carefully all reported errors and warnings, as the corresponding code will likely require manual corrections. Be sure to check carefully all reported errors and warnings, as the corresponding code will likely require manual corrections.
In some cases these messages may help you to detect errors in your code, for instance, cases where *DEFINE_STANDARD_RTTI* macro is used with incorrect class name as an argument. In some cases these messages may help you to detect errors in your code, for instance, cases where *DEFINE_STANDARD_RTTI* macro is used with incorrect class name as an argument.
@@ -507,12 +506,12 @@ The use of handle objects (construction, comparison using operators == or !=, us
For example, the following lines will fail to compile if *Geom_Line.hxx* is not included: For example, the following lines will fail to compile if *Geom_Line.hxx* is not included:
~~~~{.cpp} ~~~~~
Handle(Geom_Line) aLine = 0; Handle(Geom_Line) aLine = 0;
if (aLine != aCurve) {...} if (aLine != aCurve) {...}
if (aCurve->IsKind(STANDARD_TYPE(Geom_Line)) {...} if (aCurve->IsKind(STANDARD_TYPE(Geom_Line)) {...}
aLine = Handle(Geom_Line)::DownCast (aCurve); aLine = Handle(Geom_Line)::DownCast (aCurve);
~~~~ ~~~~~
Note that it is not necessary to include header of the class to declare Handle to it. Note that it is not necessary to include header of the class to declare Handle to it.
However, if you define a class *B* that uses Handle(*A*) in its fields, or contains a method returning Handle(*A*), it is advisable to have header defining *A* included in the header of *B*. However, if you define a class *B* that uses Handle(*A*) in its fields, or contains a method returning Handle(*A*), it is advisable to have header defining *A* included in the header of *B*.
@@ -524,31 +523,31 @@ This issue appears in the compilers that do not support default arguments in tem
The problem is that operator <i> const handle<T2>& </i> is defined for any type *T2*, thus the compiler cannot make the right choice. The problem is that operator <i> const handle<T2>& </i> is defined for any type *T2*, thus the compiler cannot make the right choice.
Example: Example:
~~~~{.cpp} ~~~~~
void func (const Handle(Geom_Curve)&); void func (const Handle(Geom_Curve)&);
void func (const Handle(Geom_Surface)&); void func (const Handle(Geom_Surface)&);
Handle(Geom_TrimmedCurve) aCurve = new Geom_TrimmedCurve (...); Handle(Geom_TrimmedCurve) aCurve = new Geom_TrimmedCurve (...);
func (aCurve); // ambiguity error in VC++ 10 func (aCurve); // ambiguity error in VC++ 10
~~~~ ~~~~~
Note that this problem can be avoided in many cases if macro *OCCT_HANDLE_NOCAST* is used, see @ref upgrade_occt700_cdl_nocast "below". Note that this problem can be avoided in many cases if macro *OCCT_HANDLE_NOCAST* is used, see @ref upgrade_occt700_cdl_nocast "below".
To resolve this ambiguity, change your code so that argument type should correspond exactly to the function signature. To resolve this ambiguity, change your code so that argument type should correspond exactly to the function signature.
In some cases this can be done by using the relevant type for the corresponding variable, like in the example above: In some cases this can be done by using the relevant type for the corresponding variable, like in the example above:
~~~~{.cpp} ~~~~~
Handle(Geom_Curve) aCurve = new Geom_TrimmedCurve (...); Handle(Geom_Curve) aCurve = new Geom_TrimmedCurve (...);
~~~~ ~~~~~
Other variants consist in assigning the argument to a local variable of the correct type and using the direct cast or constructor: Other variants consist in assigning the argument to a local variable of the correct type and using the direct cast or constructor:
~~~~{.cpp} ~~~~~
const Handle(Geom_Curve)& aGCurve (aTrimmedCurve); const Handle(Geom_Curve)& aGCurve (aTrimmedCurve);
func (aGCurve); // OK - argument has exact type func (aGCurve); // OK - argument has exact type
func (static_cast(aCurve)); // OK - direct cast func (static_cast(aCurve)); // OK - direct cast
func (Handle(Geom_Curve)(aCurve)); // OK - temporary handle is constructed func (Handle(Geom_Curve)(aCurve)); // OK - temporary handle is constructed
~~~~ ~~~~~
Another possibility consists in defining additional template variant of the overloaded function causing ambiguity, and using *SFINAE* to resolve the ambiguity. Another possibility consists in defining additional template variant of the overloaded function causing ambiguity, and using *SFINAE* to resolve the ambiguity.
This technique can be illustrated by the definition of the template variant of method <i>IGESData_IGESWriter::Send()</i>. This technique can be illustrated by the definition of the template variant of method <i>IGESData_IGESWriter::Send()</i>.
@@ -559,31 +558,31 @@ As the cast of a handle to the reference to another handle to the base type has
For example: For example:
~~~~{.cpp} ~~~~~
Handle(Geom_Geometry) aC = GC_MakeLine (p, v); // compiler error Handle(Geom_Geometry) aC = GC_MakeLine (p, v); // compiler error
~~~~ ~~~~~
The problem is that the class *GC_MakeLine* has a user-defined conversion to <i>const Handle(Geom_TrimmedCurve)&,</i> which is not the same as the type of the local variable *aC*. The problem is that the class *GC_MakeLine* has a user-defined conversion to <i>const Handle(Geom_TrimmedCurve)&,</i> which is not the same as the type of the local variable *aC*.
To resolve this, use method <i>Value()</i>: To resolve this, use method <i>Value()</i>:
~~~~{.cpp} ~~~~~
Handle(Geom_Geometry) aC = GC_MakeLine (p, v).Value(); // ok Handle(Geom_Geometry) aC = GC_MakeLine (p, v).Value(); // ok
~~~~ ~~~~~
or use variable of the appropriate type: or use variable of the appropriate type:
~~~~{.cpp} ~~~~~
Handle(Geom_TrimmedCurve) aC = GC_MakeLine (p, v); // ok Handle(Geom_TrimmedCurve) aC = GC_MakeLine (p, v); // ok
~~~~ ~~~~~
A similar problem appears with GCC compiler, when *const* handle to derived type is used to construct handle to base type via assignment (and in some cases in return statement), for instance: A similar problem appears with GCC compiler, when *const* handle to derived type is used to construct handle to base type via assignment (and in some cases in return statement), for instance:
~~~~{.cpp} ~~~~~
const Handle(Geom_Line) aLine; const Handle(Geom_Line) aLine;
Handle(Geom_Curve) c1 = aLine; // GCC error Handle(Geom_Curve) c1 = aLine; // GCC error
Handle(Geom_Curve) c2 (aLine); // ok Handle(Geom_Curve) c2 (aLine); // ok
~~~~ ~~~~~
This problem is specific to GCC and it does not appear if macro *OCCT_HANDLE_NOCAST* is used, see @ref upgrade_occt700_cdl_nocast "below". This problem is specific to GCC and it does not appear if macro *OCCT_HANDLE_NOCAST* is used, see @ref upgrade_occt700_cdl_nocast "below".
@@ -594,20 +593,20 @@ You might need to clean your code from incorrect use of macros *STANDARD_TYPE*()
1. Explicit definitions of static functions with names generated by macro *STANDARD_TYPE()*, which are artifacts of old implementation of RTTI, should be removed. 1. Explicit definitions of static functions with names generated by macro *STANDARD_TYPE()*, which are artifacts of old implementation of RTTI, should be removed.
Example: Example:
~~~~{.cpp} ~~~~~
const Handle(Standard_Type)& STANDARD_TYPE(math_GlobOptMin) const Handle(Standard_Type)& STANDARD_TYPE(math_GlobOptMin)
{ {
static Handle(Standard_Type) _atype = new Standard_Type ("math_GlobOptMin", sizeof (math_GlobOptMin)); static Handle(Standard_Type) _atype = new Standard_Type ("math_GlobOptMin", sizeof (math_GlobOptMin));
return _atype; return _atype;
} }
~~~~ ~~~~~
2. Incorrect location of closing parenthesis of *Handle()* macro that was not detectable in OCCT 6.x will cause a compiler error and must be corrected. 2. Incorrect location of closing parenthesis of *Handle()* macro that was not detectable in OCCT 6.x will cause a compiler error and must be corrected.
Example (note misplaced closing parenthesis): Example (note misplaced closing parenthesis):
~~~~{.cpp} ~~~~~
aBSpline = Handle( Geom2d_BSplineCurve::DownCast(BS->Copy()) ); aBSpline = Handle( Geom2d_BSplineCurve::DownCast(BS->Copy()) );
~~~~ ~~~~~
#### Use of class Standard_AncestorIterator #### Use of class Standard_AncestorIterator
@@ -618,20 +617,20 @@ Class *Standard_AncestorIterator* has been removed; use method *Parent()* of *St
Handles in OCCT 7.0 do not have the operator of conversion to <i>Standard_Transient*,</i> which was present in earlier versions. Handles in OCCT 7.0 do not have the operator of conversion to <i>Standard_Transient*,</i> which was present in earlier versions.
This is done to prevent possible unintended errors like this: This is done to prevent possible unintended errors like this:
~~~~{.cpp} ~~~~~
Handle(Geom_Line) aLine = ...; Handle(Geom_Line) aLine = ...;
Handle(Geom_Surface) aSurf = ...; Handle(Geom_Surface) aSurf = ...;
... ...
if (aLine == aSurf) {...} // will cause a compiler error in OCCT 7.0, but not OCCT 6.x if (aLine == aSurf) {...} // will cause a compiler error in OCCT 7.0, but not OCCT 6.x
~~~~ ~~~~~
The places where this implicit cast has been used should be corrected manually. The places where this implicit cast has been used should be corrected manually.
The typical situation is when Handle is passed to stream: The typical situation is when Handle is passed to stream:
~~~~{.cpp} ~~~~~
Handle(Geom_Line) aLine = ...; Handle(Geom_Line) aLine = ...;
os << aLine; // in OCCT 6.9.0, resolves to operator << (void*) os << aLine; // in OCCT 6.9.0, resolves to operator << (void*)
~~~~ ~~~~~
Call method <i>get()</i> explicitly to output the address of the Handle. Call method <i>get()</i> explicitly to output the address of the Handle.
@@ -640,24 +639,24 @@ Call method <i>get()</i> explicitly to output the address of the Handle.
Method *DownCast()* in OCCT 7.0 is made templated; if its argument is not a base class, "deprecated" compiler warning is generated. Method *DownCast()* in OCCT 7.0 is made templated; if its argument is not a base class, "deprecated" compiler warning is generated.
This is done to prevent possible unintended errors like this: This is done to prevent possible unintended errors like this:
~~~~{.cpp} ~~~~~
Handle(Geom_Surface) aSurf = ; Handle(Geom_Surface) aSurf = ;
Handle(Geom_Line) aLine = Handle(Geom_Line) aLine =
Handle(Geom_Line)::DownCast (aSurf); // will cause a compiler warning in OCCT 7.0, but not OCCT 6.x Handle(Geom_Line)::DownCast (aSurf); // will cause a compiler warning in OCCT 7.0, but not OCCT 6.x
~~~~ ~~~~~
The places where this cast has been used should be corrected manually. The places where this cast has been used should be corrected manually.
If down casting is used in a template context where the argument can have the same or unrelated type so that *DownCast()* may be not available in all cases, use C++ *dynamic_cast<>* instead, e.g.: If down casting is used in a template context where the argument can have the same or unrelated type so that *DownCast()* may be not available in all cases, use C++ *dynamic_cast<>* instead, e.g.:
~~~~{.cpp} ~~~~~
template <class T> template <class T>
bool CheckLine (const Handle(T) theArg) bool CheckLine (const Handle(T) theArg)
{ {
Handle(Geom_Line) aLine = dynamic_cast<Geom_Line> (theArg.get()); Handle(Geom_Line) aLine = dynamic_cast<Geom_Line> (theArg.get());
... ...
} }
~~~~ ~~~~~
@subsubsection upgrade_occt700_cdl_runtime Possible runtime problems @subsubsection upgrade_occt700_cdl_runtime Possible runtime problems
@@ -672,19 +671,19 @@ This problem does not appear if macro *OCCT_HANDLE_NOCAST* is used during compil
Example: Example:
~~~~{.cpp} ~~~~~
// note that DownCast() returns new temporary object! // note that DownCast() returns new temporary object!
const Handle(Geom_BoundedCurve)& aBC = const Handle(Geom_BoundedCurve)& aBC =
Handle(Geom_TrimmedCurve)::DownCast(aCurve); Handle(Geom_TrimmedCurve)::DownCast(aCurve);
aBC->Transform (T); // access violation in OCCT 7.0 aBC->Transform (T); // access violation in OCCT 7.0
~~~~ ~~~~~
@subsubsection upgrade_occt700_cdl_nocast Option to avoid cast of handle to reference to base type @subsubsection upgrade_occt700_cdl_nocast Option to avoid cast of handle to reference to base type
In OCCT 6.x and earlier versions the handle classes formed a hierarchy echoing the hierarchy of the corresponding object classes . In OCCT 6.x and earlier versions the handle classes formed a hierarchy echoing the hierarchy of the corresponding object classes .
This automatically enabled the possibility to use the handle to a derived class in all contexts where the handle to a base class was needed, e.g. to pass it in a function by reference without copying: This automatically enabled the possibility to use the handle to a derived class in all contexts where the handle to a base class was needed, e.g. to pass it in a function by reference without copying:
~~~~{.cpp} ~~~~
Standard_Boolean GetCurve (Handle(Geom_Curve)& theCurve); Standard_Boolean GetCurve (Handle(Geom_Curve)& theCurve);
.... ....
Handle(Geom_Line) aLine; Handle(Geom_Line) aLine;
@@ -706,13 +705,13 @@ This implies creation of temporary objects and hence may be more expensive at ru
The code that relies on the possibility of casting to base should be amended to always use the handle of argument type in function call and to use *DownCast()* to safely convert the result to the desired type. The code that relies on the possibility of casting to base should be amended to always use the handle of argument type in function call and to use *DownCast()* to safely convert the result to the desired type.
For instance, the code from the example below can be changed as follows: For instance, the code from the example below can be changed as follows:
~~~~{.cpp} ~~~~~
Handle(Geom_Line) aLine; Handle(Geom_Line) aLine;
Handle(Geom_Curve) aCurve; Handle(Geom_Curve) aCurve;
if (GetCurve (aCure) && !(aLine = Handle(Geom_Line)::DownCast (aCurve)).IsNull()) { if (GetCurve (aCure) && !(aLine = Handle(Geom_Line)::DownCast (aCurve)).IsNull()) {
// use aLine safely // use aLine safely
} }
~~~~ ~~~~~
@subsubsection upgrade_occt700_cdl_compat Preserving compatibility with OCCT 6.x @subsubsection upgrade_occt700_cdl_compat Preserving compatibility with OCCT 6.x
@@ -725,12 +724,12 @@ If you like to preserve the compatibility of your application code with OCCT ver
3. Define macros *DEFINE_STANDARD_RTTIEXT* and *DEFINE_STANDARD_RTTI_INLINE* when building with previous versions of OCCT, resolving to *DEFINE_STANDARD_RTTI* with single argument 3. Define macros *DEFINE_STANDARD_RTTIEXT* and *DEFINE_STANDARD_RTTI_INLINE* when building with previous versions of OCCT, resolving to *DEFINE_STANDARD_RTTI* with single argument
Example: Example:
~~~~{.cpp} ~~~~~
#if OCC_VERSION_HEX < 0x070000 #if OCC_VERSION_HEX < 0x070000
#define DEFINE_STANDARD_RTTIEXT(C1,C2) DEFINE_STANDARD_RTTI(C1) #define DEFINE_STANDARD_RTTIEXT(C1,C2) DEFINE_STANDARD_RTTI(C1)
#define DEFINE_STANDARD_RTTI_INLINE(C1,C2) DEFINE_STANDARD_RTTI(C1) #define DEFINE_STANDARD_RTTI_INLINE(C1,C2) DEFINE_STANDARD_RTTI(C1)
#endif #endif
~~~~ ~~~~~
@subsubsection upgrade_occt700_cdl_wok Applications based on CDL and WOK @subsubsection upgrade_occt700_cdl_wok Applications based on CDL and WOK
@@ -769,7 +768,7 @@ The code that used the tools provided by that package should be corrected manual
The recommended approach is to use sorting algorithms provided by STL. The recommended approach is to use sorting algorithms provided by STL.
For instance: For instance:
~~~~{.cpp} ~~~~~
#include <SortTools_StraightInsertionSortOfReal.hxx> #include <SortTools_StraightInsertionSortOfReal.hxx>
#include <SortTools_ShellSortOfReal.hxx> #include <SortTools_ShellSortOfReal.hxx>
#include <TCollection_CompareOfReal.hxx> #include <TCollection_CompareOfReal.hxx>
@@ -778,15 +777,15 @@ TCollection_Array1OfReal aValues = ...;
... ...
TCollection_CompareOfReal aCompReal; TCollection_CompareOfReal aCompReal;
SortTools_StraightInsertionSortOfReal::Sort(aValues, aCompReal); SortTools_StraightInsertionSortOfReal::Sort(aValues, aCompReal);
~~~~ ~~~~~
can be replaced by: can be replaced by:
~~~~{.cpp} ~~~~~
#include <algorithm> #include <algorithm>
... ...
TCollection_Array1OfReal aValues = ...; TCollection_Array1OfReal aValues = ...;
... ...
std::stable_sort (aValues.begin(), aValues.end()); std::stable_sort (aValues.begin(), aValues.end());
~~~~ ~~~~~
@subsection upgrade_occt700_2dlayers On-screen objects and ColorScale @subsection upgrade_occt700_2dlayers On-screen objects and ColorScale
@@ -803,7 +802,7 @@ Predefined Z-layers *Graphic3d_ZLayerId_TopOSD* and *Graphic3d_ZLayerId_BotOSD*
The property of *V3d_View* storing the global *ColorScale* object has been removed with associated methods *V3d_View::ColorScaleDisplay(), V3d_View::ColorScaleErase(), V3d_View::ColorScaleIsDisplayed()* and *V3d_View::ColorScale()* as well as the classes *V3d_ColorScale, V3d_ColorScaleLayerItem* and *Aspect_ColorScale*. The property of *V3d_View* storing the global *ColorScale* object has been removed with associated methods *V3d_View::ColorScaleDisplay(), V3d_View::ColorScaleErase(), V3d_View::ColorScaleIsDisplayed()* and *V3d_View::ColorScale()* as well as the classes *V3d_ColorScale, V3d_ColorScaleLayerItem* and *Aspect_ColorScale*.
Here is an example of creating *ColorScale* using the updated API: Here is an example of creating *ColorScale* using the updated API:
~~~~{.cpp} ~~~~~
Handle(AIS_ColorScale) aCS = new AIS_ColorScale(); Handle(AIS_ColorScale) aCS = new AIS_ColorScale();
// configuring // configuring
Standard_Integer aWidth, aHeight; Standard_Integer aWidth, aHeight;
@@ -816,13 +815,13 @@ aCS->SetZLayer (Graphic3d_ZLayerId_TopOSD);
aCS->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt (-1,-1,0)); aCS->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt (-1,-1,0));
aCS->SetToUpdate(); aCS->SetToUpdate();
theContextAIS->Display (aCS); theContextAIS->Display (aCS);
~~~~ ~~~~~
To see how 2d objects are implemented in OCCT you can call Draw commands *vcolorscale, vlayerline* or *vdrawtext* (with <i>-2d</i> option). To see how 2d objects are implemented in OCCT you can call Draw commands *vcolorscale, vlayerline* or *vdrawtext* (with <i>-2d</i> option).
Draw command *vcolorscale* now requires the name of *ColorScale* object as argument. Draw command *vcolorscale* now requires the name of *ColorScale* object as argument.
To display this object use command *vdisplay*. For example: To display this object use command *vdisplay*. For example:
~~~~{.php} ~~~~~
pload VISUALIZATION pload VISUALIZATION
vinit vinit
vcolorscale cs -demo vcolorscale cs -demo
@@ -833,16 +832,16 @@ vsetdispmode 1
vfit vfit
vlayerline 0 300 300 300 10 vlayerline 0 300 300 300 10
vdrawtext t "2D-TEXT" -2d -pos 0 150 0 -color red vdrawtext t "2D-TEXT" -2d -pos 0 150 0 -color red
~~~~ ~~~~~
Here is a small example in C++ illustrating how to display a custom AIS object in 2d: Here is a small example in C++ illustrating how to display a custom AIS object in 2d:
~~~~{.cpp} ~~~~~
Handle(AIS_InteractiveContext) aContext = ...; Handle(AIS_InteractiveContext) aContext = ...;
Handle(AIS_InteractiveObject) anObj =...; // create an AIS object Handle(AIS_InteractiveObject) anObj =...; // create an AIS object
anObj->SetZLayer(Graphic3d_ZLayerId_TopOSD); // display object in overlay anObj->SetZLayer(Graphic3d_ZLayerId_TopOSD); // display object in overlay
anObj->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt (-1,-1,0)); // set 2d flag, coordinate origin is set to down-left corner anObj->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt (-1,-1,0)); // set 2d flag, coordinate origin is set to down-left corner
aContext->Display (anObj); // display the object aContext->Display (anObj); // display the object
~~~~ ~~~~~
@subsection upgrade_occt700_userdraw UserDraw and Visual3d @subsection upgrade_occt700_userdraw UserDraw and Visual3d
@@ -880,7 +879,7 @@ The functionality previously provided by *Visual3d* package has been redesigned
Old APIs based on global callback functions for creating *UserDraw* objects and for performing custom OpenGL rendering within the view have been dropped. Old APIs based on global callback functions for creating *UserDraw* objects and for performing custom OpenGL rendering within the view have been dropped.
*UserDraw* callbacks are no more required since *OpenGl_Group* now inherits *Graphic3d_Group* and thus can be accessed directly from *AIS_InteractiveObject*: *UserDraw* callbacks are no more required since *OpenGl_Group* now inherits *Graphic3d_Group* and thus can be accessed directly from *AIS_InteractiveObject*:
~~~~{.cpp} ~~~~~
//! Class implementing custom OpenGL element. //! Class implementing custom OpenGL element.
class UserDrawElement : public OpenGl_Element {}; class UserDrawElement : public OpenGl_Element {};
@@ -902,12 +901,12 @@ void UserDrawObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMg
// invalidate bounding box of the scene // invalidate bounding box of the scene
thePrsMgr->StructureManager()->Update(); thePrsMgr->StructureManager()->Update();
} }
~~~~ ~~~~~
To perform a custom OpenGL code within the view, it is necessary to inherit from class *OpenGl_View*. To perform a custom OpenGL code within the view, it is necessary to inherit from class *OpenGl_View*.
See the following code sample: See the following code sample:
~~~~{.cpp} ~~~~~
//! Custom view. //! Custom view.
class UserView : public OpenGl_View class UserView : public OpenGl_View
{ {
@@ -954,7 +953,7 @@ public:
} }
}; };
~~~~ ~~~~~
@subsection upgrade_occt700_localcontext Deprecation of Local Context @subsection upgrade_occt700_localcontext Deprecation of Local Context
@@ -1173,22 +1172,22 @@ Class *BRepOffsetAPI_MakeOffsetShape*:
* *BRepOffsetAPI_MakeOffsetShape::PerformByJoin()* - method has been added. This method is old algorithm behaviour. * *BRepOffsetAPI_MakeOffsetShape::PerformByJoin()* - method has been added. This method is old algorithm behaviour.
The code below shows new calling procedure: The code below shows new calling procedure:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
BRepOffsetAPI_MakeOffsetShape OffsetMaker; BRepOffsetAPI_MakeOffsetShape OffsetMaker;
OffsetMaker.PerformByJoin(Shape, OffsetValue, Tolerance); OffsetMaker.PerformByJoin(Shape, OffsetValue, Tolerance);
NewShape = OffsetMaker.Shape(); NewShape = OffsetMaker.Shape();
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Class *BRepOffsetAPI_MakeThickSolid*: Class *BRepOffsetAPI_MakeThickSolid*:
* *BRepOffsetAPI_MakeThickSolid::BRepOffsetAPI_MakeThickSolid()* - constructor with parameters has been deleted. * *BRepOffsetAPI_MakeThickSolid::BRepOffsetAPI_MakeThickSolid()* - constructor with parameters has been deleted.
* *BRepOffsetAPI_MakeThickSolid::MakeThickSolidByJoin()* - method has been added. This method is old algorithm behaviour. * *BRepOffsetAPI_MakeThickSolid::MakeThickSolidByJoin()* - method has been added. This method is old algorithm behaviour.
The code below shows new calling procedure: The code below shows new calling procedure:
~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
BRepOffsetAPI_MakeThickSolid BodyMaker; BRepOffsetAPI_MakeThickSolid BodyMaker;
BodyMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3); BodyMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3);
myBody = BodyMaker.Shape(); myBody = BodyMaker.Shape();
~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsection upgrade_720_highlight Highlight style @subsection upgrade_720_highlight Highlight style
@@ -1318,7 +1317,7 @@ One can use this functionality in two ways:
The code example below demonstrates how to read shapes from a storage driver using *StdStorage* class. The code example below demonstrates how to read shapes from a storage driver using *StdStorage* class.
~~~~{.cpp} ~~~~
// aDriver should be created and opened for reading // aDriver should be created and opened for reading
Handle(StdStorage_Data) aData; Handle(StdStorage_Data) aData;
@@ -1356,7 +1355,7 @@ if (!aRoots.IsNull())
The following code demonstrates how to write shapes in OCCT 7.2.0 using *StdStorage* class. The following code demonstrates how to write shapes in OCCT 7.2.0 using *StdStorage* class.
~~~~{.cpp} ~~~~
// Create a file driver // Create a file driver
NCollection_Handle<Storage_BaseDriver> aFileDriver(new FSD_File()); NCollection_Handle<Storage_BaseDriver> aFileDriver(new FSD_File());
@@ -1641,7 +1640,7 @@ The following changes have been introduced in the API of *BRepMesh_IncrementalMe
Example of usage: Example of usage:
Case 1 (explicit parameters): Case 1 (explicit parameters):
~~~~{.cpp} ~~~~
#include <IMeshData_Status.hxx> #include <IMeshData_Status.hxx>
#include <IMeshTools_Parameters.hxx> #include <IMeshTools_Parameters.hxx>
#include <BRepMesh_IncrementalMesh.hxx> #include <BRepMesh_IncrementalMesh.hxx>
@@ -1689,7 +1688,7 @@ In fact, drawing points or lines with lighting applied is a valid use case, but
As aspects for different primitive types have been merged, Graphic3d_Group does no more provide per-type aspect properties. As aspects for different primitive types have been merged, Graphic3d_Group does no more provide per-type aspect properties.
Existing code relying on old behavior and putting interleaved per-type aspects into single Graphic3d_Group should be updated. Existing code relying on old behavior and putting interleaved per-type aspects into single Graphic3d_Group should be updated.
For example, the following pseudo-code will not work anymore, because all *SetGroupPrimitivesAspect* calls will setup the same property: For example, the following pseudo-code will not work anymore, because all *SetGroupPrimitivesAspect* calls will setup the same property:
~~~~{.cpp} ~~~~
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect()); aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect()); //!< overrides previous aspect aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect()); //!< overrides previous aspect
@@ -1701,7 +1700,7 @@ aGroup->AddPrimitiveArray (aTris);
~~~~ ~~~~
To solve the problem, the code should be modified to either put primitives into dedicated groups (preferred approach), or using *SetPrimitivesAspect* in proper order: To solve the problem, the code should be modified to either put primitives into dedicated groups (preferred approach), or using *SetPrimitivesAspect* in proper order:
~~~~{.cpp} ~~~~
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect()); aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
@@ -1719,7 +1718,7 @@ Decomposition of Ambient, Diffuse, Specular and Emissive properties has been eli
As result, the following methods of *Graphic3d_MaterialAspect* class have been removed: SetReflectionMode(), SetReflectionModeOn(), Ambient(), Diffuse(), Emissive(), Specular(), SetAmbient(), SetDiffuse(), SetSpecular(), SetEmissive(). As result, the following methods of *Graphic3d_MaterialAspect* class have been removed: SetReflectionMode(), SetReflectionModeOn(), Ambient(), Diffuse(), Emissive(), Specular(), SetAmbient(), SetDiffuse(), SetSpecular(), SetEmissive().
Previously, computation of final value required the following code: Previously, computation of final value required the following code:
~~~~{.cpp} ~~~~
Graphic3d_MaterialAspect theMaterial; Quantity_Color theInteriorColor; Graphic3d_MaterialAspect theMaterial; Quantity_Color theInteriorColor;
Graphic3d_Vec3 anAmbient (0.0f); Graphic3d_Vec3 anAmbient (0.0f);
if (theMaterial.ReflectionMode (Graphic3d_TOR_AMBIENT)) if (theMaterial.ReflectionMode (Graphic3d_TOR_AMBIENT))
@@ -1731,7 +1730,7 @@ if (theMaterial.ReflectionMode (Graphic3d_TOR_AMBIENT))
~~~~ ~~~~
New code looks like this: New code looks like this:
~~~~{.cpp} ~~~~
Graphic3d_MaterialAspect theMaterial; Quantity_Color theInteriorColor; Graphic3d_MaterialAspect theMaterial; Quantity_Color theInteriorColor;
Graphic3d_Vec3 anAmbient = theMaterial.AmbientColor(); Graphic3d_Vec3 anAmbient = theMaterial.AmbientColor();
if (theMaterial.MaterialType (Graphic3d_MATERIAL_ASPECT)) { anAmbient *= (Graphic3d_Vec3 )theInteriorColor; } if (theMaterial.MaterialType (Graphic3d_MATERIAL_ASPECT)) { anAmbient *= (Graphic3d_Vec3 )theInteriorColor; }
@@ -1752,7 +1751,7 @@ Existing code should be updated to:
Parameters of *Text* in *Graphic3d_Group* are moved into a new *Graphic3d_Text* class. *AddText* of *Graphic3d_Group* should be used instead of the previous *Text*. Parameters of *Text* in *Graphic3d_Group* are moved into a new *Graphic3d_Text* class. *AddText* of *Graphic3d_Group* should be used instead of the previous *Text*.
The previous code: The previous code:
~~~~{.cpp} ~~~~
Standard_Real x, y, z; Standard_Real x, y, z;
theAttachmentPoint.Coord(x,y,z); theAttachmentPoint.Coord(x,y,z);
theGroup->Text (theText, theGroup->Text (theText,
@@ -1764,7 +1763,7 @@ theGroup->Text (theText,
theAspect->VerticalJustification()); theAspect->VerticalJustification());
~~~~ ~~~~
should be replaced by the new code: should be replaced by the new code:
~~~~{.cpp} ~~~~
Handle(Graphic3d_Text) aText = new Graphic3d_Text (theAspect->Height()); Handle(Graphic3d_Text) aText = new Graphic3d_Text (theAspect->Height());
aText->SetText (theText.ToExtString()); aText->SetText (theText.ToExtString());
aText->SetPosition (theAttachmentPoint); aText->SetPosition (theAttachmentPoint);
@@ -1928,7 +1927,7 @@ The method Select3D_SensitiveEntity::NbSubElements() has been changed to be cons
@subsection upgrade_750_Booleans Changes in Boolean operations algorithm @subsection upgrade_750_Booleans Changes in Boolean operations algorithm
* TreatCompound method has been moved from *BOPAlgo_Tools* to *BOPTools_AlgoTools*. Additionally, the map parameter became optional: * TreatCompound method has been moved from *BOPAlgo_Tools* to *BOPTools_AlgoTools*. Additionally, the map parameter became optional:
~~~~{.cpp} ~~~~
void BOPTools_AlgoTools::TreatCompound (const TopoDS_Shape& theS, void BOPTools_AlgoTools::TreatCompound (const TopoDS_Shape& theS,
TopTools_ListOfShape& theLS, TopTools_ListOfShape& theLS,
TopTools_MapOfShape* theMap = NULL); TopTools_MapOfShape* theMap = NULL);
@@ -2095,25 +2094,25 @@ corresponding type of the message.
The code that used operator << for messenger, should be ported as follows. The code that used operator << for messenger, should be ported as follows.
Before the change: Before the change:
~~~~{.cpp} ~~~~~
Handle(Message_Messenger) theMessenger = ...; Handle(Message_Messenger) theMessenger = ...;
theMessenger << "Value = " << anInteger << Message_EndLine; theMessenger << "Value = " << anInteger << Message_EndLine;
~~~~ ~~~~~
After the change, single-line variant: After the change, single-line variant:
~~~~{.cpp} ~~~~~
Handle(Message_Messenger) theMessenger = ...; Handle(Message_Messenger) theMessenger = ...;
theMessenger->SendInfo() << "Value = " << anInteger << std::endl; theMessenger->SendInfo() << "Value = " << anInteger << std::endl;
~~~~ ~~~~~
After the change, extended variant: After the change, extended variant:
~~~~{.cpp} ~~~~~
Handle(Message_Messenger) theMessenger = ...; Handle(Message_Messenger) theMessenger = ...;
Message_Messenger::StreamBuffer aSender = theMessenger->SendInfo(); Message_Messenger::StreamBuffer aSender = theMessenger->SendInfo();
aSender << "Array: [ "; aSender << "Array: [ ";
for (int i = 0; i < aNb; ++i) { aSender << anArray[i] << " "; } for (int i = 0; i < aNb; ++i) { aSender << anArray[i] << " "; }
aSender << "]" << std::endl; // aSender can be used further for other messages aSender << "]" << std::endl; // aSender can be used further for other messages
~~~~ ~~~~~
@subsection upgrade_750_message_printer Message_Printer interface change @subsection upgrade_750_message_printer Message_Printer interface change
@@ -2137,13 +2136,13 @@ provided that each thread deals with its own instance of *TDataStd_Application*
Note that neither *TDataStd_Application* nor *TDocStd_Document* is protected from concurrent access from several threads. Note that neither *TDataStd_Application* nor *TDocStd_Document* is protected from concurrent access from several threads.
Such protection, if necessary, shall be implemented on the application level. Such protection, if necessary, shall be implemented on the application level.
For an example, access to labels and attributes could be protected by mutex if there is a probability that different threads access the same labels / attributes: For an example, access to labels and attributes could be protected by mutex if there is a probability that different threads access the same labels / attributes:
~~~~{.cpp} ~~~~~
{ {
Standard_Mutex::Sentry aSentry (myMainLabelAccess); Standard_Mutex::Sentry aSentry (myMainLabelAccess);
TDF_Label aChildLab = aDocument->Main().NewChild(); TDF_Label aChildLab = aDocument->Main().NewChild();
TDataStd_Integer::Set(aChildLab, 0); TDataStd_Integer::Set(aChildLab, 0);
} }
~~~~ ~~~~~
@subsection upgrade_750_draw_hotkeys Draw Harness hotkeys @subsection upgrade_750_draw_hotkeys Draw Harness hotkeys
@@ -2180,10 +2179,10 @@ Existing code relying on old behavior, if any, shall be rewritten.
Geom_RectangularTrimmedSurface sequentially trimming in U and V directions already no longer loses the first trim. Geom_RectangularTrimmedSurface sequentially trimming in U and V directions already no longer loses the first trim.
For example: For example:
~~~~{.cpp} ~~~~~
Handle(Geom_RectangularTrimmedSurface) ST = new Geom_RectangularTrimmedSurface (Sbase, u1, u2, Standard_True); // trim along U Handle(Geom_RectangularTrimmedSurface) ST = new Geom_RectangularTrimmedSurface (Sbase, u1, u2, Standard_True); // trim along U
Handle(Geom_RectangularTrimmedSurface) ST1 = new Geom_RectangularTrimmedSurface (ST, v1, v2, Standard_False); // trim along V Handle(Geom_RectangularTrimmedSurface) ST1 = new Geom_RectangularTrimmedSurface (ST, v1, v2, Standard_False); // trim along V
~~~~ ~~~~~
gives different result. gives different result.
In current version ST1 - surface trimmed only along V, U trim is removed; In current version ST1 - surface trimmed only along V, U trim is removed;
After modification ST1 - surface trimmed along U and V, U trim is kept. After modification ST1 - surface trimmed along U and V, U trim is kept.
@@ -2212,15 +2211,6 @@ BRep and Binary BRep Shape formats (only in case of triangulation-only Faces, wi
Versions of formats have been changed (11 for BinOCAF, 10 for XmlOCAF, 4 for BRep Shape and 3 for Binary BRep Shape). Versions of formats have been changed (11 for BinOCAF, 10 for XmlOCAF, 4 for BRep Shape and 3 for Binary BRep Shape).
Files written with the new version will not be readable by applications of old versions. Files written with the new version will not be readable by applications of old versions.
@subsection upgrade_760_changesBinaryFormat Changes in storage of binary document format
All kinds of binary document formats since the new version 12 saved with support of partial reading (sub-set of labels and sub-set of attributes).
For that the shapes data structures are stored with the related NamedShape attributes in the file, not in the particular section in the start of the document.
Also, size allocated for each label is stored in the file. This allows to skip big parts of document in partial reading mode if needed.
As a result, the new binary files become some smaller, but default reading and writing of documents may take some more time (depenging on the environment), up to 15 percents slower in the worse cases.
Backward compatibility (loading of old documents in the newer version) is still fully supported, as well as writing the older versions of the document.
@subsection upgrade_occt760_poly Changes in *Poly* package and *Poly_Triangulation* class @subsection upgrade_occt760_poly Changes in *Poly* package and *Poly_Triangulation* class
*Poly_Triangulation* does no more provide access to internal array structures: methods Nodes(), ChangeNode(), Triangles(), ChangeTriangle(), UVNodes(), ChangeUVNode(), Normals() have been removed. *Poly_Triangulation* does no more provide access to internal array structures: methods Nodes(), ChangeNode(), Triangles(), ChangeTriangle(), UVNodes(), ChangeUVNode(), Normals() have been removed.
@@ -2247,94 +2237,3 @@ Both libraries can be now built simultaneously on systems providing both APIs (l
Existing applications depending on OpenGL ES (mobile projects first of all) should be adjusted to link against *TKOpenGles*. Existing applications depending on OpenGL ES (mobile projects first of all) should be adjusted to link against *TKOpenGles*.
Note that both *TKOpenGl* and *TKOpenGles* keep exporting classes with the same name, so applications should not attempt to link both libraries simultaneously. Note that both *TKOpenGl* and *TKOpenGles* keep exporting classes with the same name, so applications should not attempt to link both libraries simultaneously.
@subsection upgrade_occt760_fast_access_to_labels Fast access to OCAF label
Access to an OCAF label via its entry is accelerated. In order to activate it, call *TDF_Data::SetAccessByEntries()*.
The method *TDF_Tool::Label()*, which returns a label by an entry, becomes faster for about 10 .. 20 times.
It has sense for applications, which use an entry as a unique key to access the data in OCAF tree.
Also, the method *TDF_Tool::Entry()*, which returns an entry for a label, is accelerated as well.
@subsection upgrade_occt760_bop_progress_indicator Progress indicator in Boolean operations
Method SetProgressIndicator() has been removed due to Progress indicator mechanism refactoring.
To enable progress indicator and user break in Boolean operations user has to pass progress range as a parameter to Perform or Build method.
For example:
~~~~
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
BRepAlgoApi_Cut(S1, S2, aProgress->Start()); // method Start() creates range for usage in cut algorithm
~~~~
@subsection upgrade_occt760_change_check_to_adaptors Changes in BRepLib_CheckCurveOnSurface & GeomLib_CheckCurveOnSurface interfaces
Now the classes accept adaptors instead objects as input parameters.
*BRepLib_CheckCurveOnSurface* does no more provide access to curves, surface and parameters: methods PCurve(), PCurve2(), Surface() and Range() have been removed.
*BRepLib_CheckCurveOnSurface*: the default value of the *isMultiThread* parameter of the *Perform()* function has been changed from *true* to *false*
*GeomLib_CheckCurveOnSurface* does no more provide access to curve, surface and parameters: methods Curve(), Surface() and Range() have been removed.
*GeomLib_CheckCurveOnSurface*: the default value of the *isMultiThread* parameter of the *Perform()* function has been changed from *true* to *false*
The following functions in *GeomLib_CheckCurveOnSurface* have been modified:
~~~~{.cpp}
GeomLib_CheckCurveOnSurface(const Handle(Adaptor3d_Curve)& theCurve,
const Standard_Real theTolRange);
void Init (const Handle(Adaptor3d_Curve)& theCurve, const Standard_Real theTolRange);
void Perform(const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface,
const Standard_Boolean isMultiThread);
~~~~
@subsection upgrade_occt760_old_bop_removed Removal of old Boolean operations algorithm (BRepAlgo_BooleanOperation)
* The method *BRepAlgo_Tool::Deboucle3D* has been removed as duplicating. The corresponding method from *BRepOffset_Tool* class has to be used instead.
* The API classes from *BRepAlgo* package performing old Boolean operations algorithm have been removed:
- *BRepAlgo_BooleanOperation*
- *BRepAlgo_Fuse*
- *BRepAlgo_Common*
- *BRepAlgo_Cut*
- *BRepAlgo_Section*
The corresponding classes from the *BRepAlgoAPI* package have to be used instead.
@section upgrade_occt770 Upgrade to OCCT 7.7.0
Building OCCT now requires C++11-compliant compiler, so that some legacy compilers (Visual Studio 2010 and 2012) are no more supported.
It is recommended using Visual Studio 2015 or newer for building OCCT on Windows platform.
@subsection upgrade_770_removed_features Removed features
* One of the constructors of the BRepExtrema_DistanceSS class (the one without deflection parameter) has been removed as excessive. The remaining constructor has to be used instead.
@subsection upgrade_occt770_parallel_flag_removed Removed parameter theIsParallel from Put/Compute/Perform
theIsParallel parameter has been removed from Put/Compute/Perform from the next classes:
- BRepCheck_Analyzer
- BRepCheck_Edge
- BRepLib_ValidateEdge
- GeomLib_CheckCurveOnSurface
- BRepLib_CheckCurveOnSurface
Now, to set this flag, it is necessary to use method SetParallel()
For example:
~~~~{.cpp}
BRepLib_ValidateEdge aValidateEdge(myHCurve, ACS, SameParameter);
aValidateEdge.SetParallel(toRunParallel);
aValidateEdge.Process();
~~~~
@subsection upgrade_occt770_drawer_aspects Prs3d_Drawer aspects
`Prs3d_Drawer` getters no more implicitly create "default" aspects.
If specific property has not been set before to this drawer instance nor to linked drawer instance, then NULL property will be returned.
Make sure to set property beforehand or to call `SetOwn*` / `SetupOwn*` methods to derive from defaults.
@subsection upgrade_occt770_opengl OpenGL functions
Applications extending OCCT 3D Viewer and calling OpenGL functions directly (like @c @::glEnable(), e.g. using global namespace) might be affected by changes in `OpenGl_GlFunctions.hxx`.
This header, as well as `OpenGl_GlCore20.hxx` and similar, no more include system OpenGL / OpenGL ES headers to define function table.
Application code calling OpenGL functions directly should be changed to either use `OpenGl_Context::core11fwd` (as designed)
or to include system OpenGL headers in advance (with help of `OpenGl_GlNative.hxx`).
@subsection upgrade_occt770_tooltriangulatedshape StdPrs_ToolTriangulatedShape
Method `StdPrs_ToolTriangulatedShape::Normal()` has been removed.
Please use `BRepLib_ToolTriangulatedShape::ComputeNormals()` to fill in normal attributes in triangulation and fetch them directly using `Poly_Triangulation::Normal()`.

File diff suppressed because one or more lines are too long

View File

@@ -183,9 +183,9 @@ A variable of a type manipulated by handle which is not attached to an object is
To reference an object, we instantiate the class with one of its constructors. To reference an object, we instantiate the class with one of its constructors.
For example, in C++: For example, in C++:
~~~~{.cpp} ~~~~~
Handle(MyClass) anObject = new MyClass(); Handle(MyClass) anObject = new MyClass();
~~~~ ~~~~~
In Open CASCADE Technology, the Handles are specific classes that are used to safely manipulate objects allocated in the dynamic memory by reference, In Open CASCADE Technology, the Handles are specific classes that are used to safely manipulate objects allocated in the dynamic memory by reference,
providing reference counting mechanism and automatic destruction of the object when it is not referenced. providing reference counting mechanism and automatic destruction of the object when it is not referenced.
@@ -302,15 +302,15 @@ It provides a reference counter field, inherited by all its descendant classes,
Objects of classes derived (directly or indirectly) from *Transient*, are normally allocated in dynamic memory using operator **new**, and manipulated by handle. Objects of classes derived (directly or indirectly) from *Transient*, are normally allocated in dynamic memory using operator **new**, and manipulated by handle.
Handle is defined as template class *opencascade::handle<>*. Handle is defined as template class *opencascade::handle<>*.
Open CASCADE Technology provides preprocessor macro *Handle()* that is historically used throughout OCCT code to name a handle: Open CASCADE Technology provides preprocessor macro *Handle()* that is historically used throughout OCCT code to name a handle:
~~~~{.cpp} ~~~~~{.cpp}
Handle(Geom_Line) aLine; // "Handle(Geom_Line)" is expanded to "opencascade::handle<Geom_Line>" Handle(Geom_Line) aLine; // "Handle(Geom_Line)" is expanded to "opencascade::handle<Geom_Line>"
~~~~ ~~~~~
In addition, for most OCCT classes additional *typedef* is defined for a handle, as the name of a class prefixed by *Handle_*. In addition, for most OCCT classes additional *typedef* is defined for a handle, as the name of a class prefixed by *Handle_*.
For instance, the above example can be also coded as: For instance, the above example can be also coded as:
~~~~{.cpp} ~~~~~{.cpp}
Handle_Geom_Line aLine; // "Handle_Geom_Line" is typedef to "opencascade::handle<Geom_Line>" Handle_Geom_Line aLine; // "Handle_Geom_Line" is typedef to "opencascade::handle<Geom_Line>"
~~~~ ~~~~~
#### Using a Handle #### Using a Handle
@@ -318,9 +318,9 @@ A handle is characterized by the object it references.
Before performing any operation on a transient object, you must declare the handle. Before performing any operation on a transient object, you must declare the handle.
For example, if Point and Line are two transient classes from the Geom package, you would write: For example, if Point and Line are two transient classes from the Geom package, you would write:
~~~~{.cpp} ~~~~~
Handle(Geom_Point) p1, p2; Handle(Geom_Point) p1, p2;
~~~~ ~~~~~
Declaring a handle creates a null handle that does not refer to any object. Declaring a handle creates a null handle that does not refer to any object.
The handle may be checked to be null by its method *IsNull()*. The handle may be checked to be null by its method *IsNull()*.
To nullify a handle, use method *Nullify()*. To nullify a handle, use method *Nullify()*.
@@ -338,7 +338,7 @@ To enable this feature, a class declaration should include the declaration of OC
Header *Standard_Type.hxx* provides two variants of preprocessor macros facilitating this: Header *Standard_Type.hxx* provides two variants of preprocessor macros facilitating this:
* Inline variant, which declares and defines RTTI methods by a single line of code: * Inline variant, which declares and defines RTTI methods by a single line of code:
~~~~{.cpp} ~~~~~{.cpp}
#include <Geom_Surface.hxx> #include <Geom_Surface.hxx>
class Appli_ExtSurface : public Geom_Surface class Appli_ExtSurface : public Geom_Surface
{ {
@@ -346,12 +346,12 @@ class Appli_ExtSurface : public Geom_Surface
public: public:
DEFINE_STANDARD_RTTIEXT(Appli_ExtSurface,Geom_Surface) DEFINE_STANDARD_RTTIEXT(Appli_ExtSurface,Geom_Surface)
}; };
~~~~ ~~~~~
* Out-of line variant, which uses one macro in the declaration (normally in the header file), and another in the implementation (in C++ source): * Out-of line variant, which uses one macro in the declaration (normally in the header file), and another in the implementation (in C++ source):
In *Appli_ExtSurface.hxx* file: In *Appli_ExtSurface.hxx* file:
~~~~{.cpp} ~~~~~{.cpp}
#include <Geom_Surface.hxx> #include <Geom_Surface.hxx>
class Appli_ExtSurface : public Geom_Surface class Appli_ExtSurface : public Geom_Surface
{ {
@@ -359,13 +359,13 @@ class Appli_ExtSurface : public Geom_Surface
public: public:
DEFINE_STANDARD_RTTIEXT(Appli_ExtSurface,Geom_Surface) DEFINE_STANDARD_RTTIEXT(Appli_ExtSurface,Geom_Surface)
}; };
~~~~ ~~~~~
In *Appli_ExtSurface.cxx* file: In *Appli_ExtSurface.cxx* file:
~~~~{.cpp} ~~~~~{.cpp}
#include <Appli_ExtSurface.hxx> #include <Appli_ExtSurface.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Appli_ExtSurface,Geom_Surface) IMPLEMENT_STANDARD_RTTIEXT(Appli_ExtSurface,Geom_Surface)
~~~~ ~~~~~
These macros define method *DynamicType()* that returns a type descriptor - handle to singleton instance of the class *Standard_Type* describing the class. These macros define method *DynamicType()* that returns a type descriptor - handle to singleton instance of the class *Standard_Type* describing the class.
The type descriptor stores the name of the class and the descriptor of its parent class. The type descriptor stores the name of the class and the descriptor of its parent class.
@@ -375,12 +375,12 @@ Note that while inline version is easier to use, for widely used classes this me
To get the type descriptor for a given class type, use macro *STANDARD_TYPE()* with the name of the class as argument. To get the type descriptor for a given class type, use macro *STANDARD_TYPE()* with the name of the class as argument.
Example of usage: Example of usage:
~~~~{.cpp} ~~~~~{.cpp}
if (aCurve->IsKind(STANDARD_TYPE(Geom_Line))) // equivalent to "if (dynamic_cast<Geom_Line>(aCurve.get()) != 0)" if (aCurve->IsKind(STANDARD_TYPE(Geom_Line))) // equivalent to "if (dynamic_cast<Geom_Line>(aCurve.get()) != 0)"
{ {
... ...
} }
~~~~ ~~~~~
#### Type Conformity #### Type Conformity
@@ -390,12 +390,12 @@ Thus, the dynamic type of an object (also called the actual type of an object) c
Consider the class *Geom_CartesianPoint*, a sub-class of *Geom_Point*; the rule of type conformity can be illustrated as follows: Consider the class *Geom_CartesianPoint*, a sub-class of *Geom_Point*; the rule of type conformity can be illustrated as follows:
~~~~{.cpp} ~~~~~
Handle(Geom_Point) aPnt1; Handle(Geom_Point) aPnt1;
Handle(Geom_CartesianPoint) aPnt2; Handle(Geom_CartesianPoint) aPnt2;
aPnt2 = new Geom_CartesianPoint(); aPnt2 = new Geom_CartesianPoint();
aPnt1 = aPnt2; // OK, the types are compatible aPnt1 = aPnt2; // OK, the types are compatible
~~~~ ~~~~~
The compiler sees *aPnt1* as a handle to *Geom_Point* though the actual object referenced by *aPnt1* is of the *Geom_CartesianPoint* type. The compiler sees *aPnt1* as a handle to *Geom_Point* though the actual object referenced by *aPnt1* is of the *Geom_CartesianPoint* type.
@@ -409,19 +409,19 @@ A handle can be converted explicitly into one of its sub-types if the actual typ
If this is not the case, the handle is nullified (explicit type conversion is sometimes called a "safe cast"). If this is not the case, the handle is nullified (explicit type conversion is sometimes called a "safe cast").
Consider the example below. Consider the example below.
~~~~{.cpp} ~~~~~~
Handle(Geom_Point) aPnt1; Handle(Geom_Point) aPnt1;
Handle(Geom_CartesianPoint) aPnt2, aPnt3; Handle(Geom_CartesianPoint) aPnt2, aPnt3;
aPnt2 = new Geom_CartesianPoint(); aPnt2 = new Geom_CartesianPoint();
aPnt1 = aPnt2; // OK, standard assignment aPnt1 = aPnt2; // OK, standard assignment
aPnt3 = Handle(Geom_CartesianPoint)::DownCast (aPnt1); aPnt3 = Handle(Geom_CartesianPoint)::DownCast (aPnt1);
// OK, the actual type of aPnt1 is Geom_CartesianPoint, although the static type of the handle is Geom_Point // OK, the actual type of aPnt1 is Geom_CartesianPoint, although the static type of the handle is Geom_Point
~~~~ ~~~~~~
If conversion is not compatible with the actual type of the referenced object, the handle which was "cast" becomes null (and no exception is raised). If conversion is not compatible with the actual type of the referenced object, the handle which was "cast" becomes null (and no exception is raised).
So, if you require reliable services defined in a sub-class of the type seen by the handle (static type), write as follows: So, if you require reliable services defined in a sub-class of the type seen by the handle (static type), write as follows:
~~~~{.cpp} ~~~~~~
void MyFunction (const Handle(A) & a) void MyFunction (const Handle(A) & a)
{ {
Handle(B) b = Handle(B)::DownCast(a); Handle(B) b = Handle(B)::DownCast(a);
@@ -432,12 +432,12 @@ void MyFunction (const Handle(A) & a)
// the types are incompatible // the types are incompatible
} }
} }
~~~~ ~~~~~~
Downcasting is used particularly with collections of objects of different types; however, these objects should inherit from the same root class. Downcasting is used particularly with collections of objects of different types; however, these objects should inherit from the same root class.
For example, with a sequence of transient objects *TColStd_SequenceOfTransient* and two classes A and B that both inherit from *Standard_Transient*, you get the following syntax: For example, with a sequence of transient objects *TColStd_SequenceOfTransient* and two classes A and B that both inherit from *Standard_Transient*, you get the following syntax:
~~~~{.cpp} ~~~~~
Handle(A) a; Handle(A) a;
Handle(B) b; Handle(B) b;
Handle(Standard_Transient) t; Handle(Standard_Transient) t;
@@ -459,17 +459,17 @@ else
{ {
// the types are incompatible // the types are incompatible
} }
~~~~ ~~~~~
@subsubsection occt_fcug_2_2_3 Using Handles to Create Objects @subsubsection occt_fcug_2_2_3 Using Handles to Create Objects
To create an object which is manipulated by handle, declare the handle and initialize it with the standard C++ **new** operator, immediately followed by a call to the constructor. To create an object which is manipulated by handle, declare the handle and initialize it with the standard C++ **new** operator, immediately followed by a call to the constructor.
The constructor can be any of those specified in the source of the class from which the object is instanced. The constructor can be any of those specified in the source of the class from which the object is instanced.
~~~~{.cpp} ~~~~~
Handle(Geom_CartesianPoint) aPnt; Handle(Geom_CartesianPoint) aPnt;
aPnt = new Geom_CartesianPoint (0, 0, 0); aPnt = new Geom_CartesianPoint (0, 0, 0);
~~~~ ~~~~~
Unlike for a pointer, the **delete** operator does not work on a handle; the referenced object is automatically destroyed when no longer in use. Unlike for a pointer, the **delete** operator does not work on a handle; the referenced object is automatically destroyed when no longer in use.
@@ -480,7 +480,7 @@ To invoke a method which acts on the referenced object, you translate this metho
To test or to modify the state of the handle, the method is translated by the *dot* operator. To test or to modify the state of the handle, the method is translated by the *dot* operator.
The example below illustrates how to access the coordinates of an (optionally initialized) point object: The example below illustrates how to access the coordinates of an (optionally initialized) point object:
~~~~{.cpp} ~~~~~
Handle(Geom_CartesianPoint) aCentre; Handle(Geom_CartesianPoint) aCentre;
Standard_Real x, y, z; Standard_Real x, y, z;
if (aCentre.IsNull()) if (aCentre.IsNull())
@@ -488,11 +488,11 @@ if (aCentre.IsNull())
aCentre = new PGeom_CartesianPoint (0, 0, 0); aCentre = new PGeom_CartesianPoint (0, 0, 0);
} }
aCentre->Coord (x, y, z); aCentre->Coord (x, y, z);
~~~~ ~~~~~
The example below illustrates how to access the type object of a Cartesian point: The example below illustrates how to access the type object of a Cartesian point:
~~~~{.cpp} ~~~~~
Handle(Standard_Transient) aPnt = new Geom_CartesianPoint (0., 0., 0.); Handle(Standard_Transient) aPnt = new Geom_CartesianPoint (0., 0., 0.);
if (aPnt->DynamicType() == STANDARD_TYPE(Geom_CartesianPoint)) if (aPnt->DynamicType() == STANDARD_TYPE(Geom_CartesianPoint))
{ {
@@ -502,7 +502,7 @@ else
{ {
std::cout << "Type check FAILED\n"; std::cout << "Type check FAILED\n";
} }
~~~~ ~~~~~
*Standard_NullObject* exception will be raised if a field or a method of an object is accessed via a *Null* handle. *Standard_NullObject* exception will be raised if a field or a method of an object is accessed via a *Null* handle.
@@ -512,9 +512,9 @@ A class method is called like a static C++ function, i.e. it is called by the na
For example, we can find the maximum degree of a Bezier curve: For example, we can find the maximum degree of a Bezier curve:
~~~~{.cpp} ~~~~~
Standard_Integer aDegree = Geom_BezierCurve::MaxDegree(); Standard_Integer aDegree = Geom_BezierCurve::MaxDegree();
~~~~ ~~~~~
@subsubsection occt_fcug_2_2_5 Handle deallocation @subsubsection occt_fcug_2_2_5 Handle deallocation
@@ -529,7 +529,7 @@ The object is automatically deleted by the handle when reference counter becomes
The principle of allocation can be seen in the example below. The principle of allocation can be seen in the example below.
~~~~{.cpp} ~~~~~
... ...
{ {
Handle(TColStd_HSequenceOfInteger) H1 = new TColStd_HSequenceOfInteger(); Handle(TColStd_HSequenceOfInteger) H1 = new TColStd_HSequenceOfInteger();
@@ -549,11 +549,11 @@ The principle of allocation can be seen in the example below.
// Here, H1 has 1 reference // Here, H1 has 1 reference
} }
// Here, H1 has no reference and the referred TColStd_HSequenceOfInteger object is deleted. // Here, H1 has no reference and the referred TColStd_HSequenceOfInteger object is deleted.
~~~~ ~~~~~
You can easily cast a reference to the handle object to <i> void* </i> by defining the following: You can easily cast a reference to the handle object to <i> void* </i> by defining the following:
~~~~{.cpp} ~~~~
void* aPointer; void* aPointer;
Handle(Some_Class) aHandle; Handle(Some_Class) aHandle;
// Here only a pointer will be copied // Here only a pointer will be copied
@@ -701,12 +701,12 @@ The following paragraphs describe recommended approaches for using exceptions wh
#### "C++ like" Syntax #### "C++ like" Syntax
The following example: The following example:
~~~~{.cpp} ~~~~~
throw Standard_DomainError ("Cannot cope with this condition"); throw Standard_DomainError ("Cannot cope with this condition");
~~~~ ~~~~~
raises an exception of *Standard_DomainError* type with the associated message "Cannot cope with this condition", the message being optional. raises an exception of *Standard_DomainError* type with the associated message "Cannot cope with this condition", the message being optional.
This exception may be caught by a handler of a *Standard_DomainError* type as follows: This exception may be caught by a handler of a *Standard_DomainError* type as follows:
~~~~{.cpp} ~~~~~
try try
{ {
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
@@ -716,7 +716,7 @@ catch (const Standard_DomainError& )
{ {
// handle Standard_DomainError exceptions here // handle Standard_DomainError exceptions here
} }
~~~~ ~~~~~
#### Regular usage #### Regular usage
@@ -734,7 +734,7 @@ For example, if you consider the *TCollection_Array1* class used with:
then, the *Value* function may be implemented as follows: then, the *Value* function may be implemented as follows:
~~~~{.cpp} ~~~~~
Item TCollection_Array1::Value (Standard_Integer theIndex) const Item TCollection_Array1::Value (Standard_Integer theIndex) const
{ {
// where myR1 and myR2 are the lower and upper bounds of the array // where myR1 and myR2 are the lower and upper bounds of the array
@@ -744,7 +744,7 @@ Item TCollection_Array1::Value (Standard_Integer theIndex) const
} }
return myContents[theIndex]; return myContents[theIndex];
} }
~~~~ ~~~~~
Here validity of the index is first verified using the Lower and Upper functions in order to protect the call. Here validity of the index is first verified using the Lower and Upper functions in order to protect the call.
Normally the caller ensures the index being in the valid range before calling <i>Value()</i>. Normally the caller ensures the index being in the valid range before calling <i>Value()</i>.
@@ -752,26 +752,26 @@ In this case the above implementation of *Value* is not optimal since the test d
It is a widely used practice to include that kind of protections in a debug build of the program and exclude in release (optimized) build. It is a widely used practice to include that kind of protections in a debug build of the program and exclude in release (optimized) build.
To support this practice, the macros <i>Raise_if()</i> are provided for every OCCT exception class: To support this practice, the macros <i>Raise_if()</i> are provided for every OCCT exception class:
~~~~{.cpp} ~~~~~
<ErrorTypeName>_Raise_if(condition, "Error message"); <ErrorTypeName>_Raise_if(condition, "Error message");
~~~~ ~~~~~
where *ErrorTypeName* is the exception type, *condition* is the logical expression leading to the raise of the exception, and *Error message* is the associated message. where *ErrorTypeName* is the exception type, *condition* is the logical expression leading to the raise of the exception, and *Error message* is the associated message.
The entire call may be removed by defining one of the preprocessor symbols *No_Exception* or <i>No_<ErrorTypeName></i> at compile-time: The entire call may be removed by defining one of the preprocessor symbols *No_Exception* or <i>No_<ErrorTypeName></i> at compile-time:
~~~~{.cpp} ~~~~~
#define No_Exception // remove all raises #define No_Exception // remove all raises
~~~~ ~~~~~
Using this syntax, the *Value* function becomes: Using this syntax, the *Value* function becomes:
~~~~{.cpp} ~~~~~
Item TCollection_Array1::Value (Standard_Integer theIndex) const Item TCollection_Array1::Value (Standard_Integer theIndex) const
{ {
Standard_OutOfRange_Raise_if(theIndex < myR1 || theIndex > myR2, "index out of range in TCollection_Array1::Value"); Standard_OutOfRange_Raise_if(theIndex < myR1 || theIndex > myR2, "index out of range in TCollection_Array1::Value");
return myContents[theIndex]; return myContents[theIndex];
} }
~~~~ ~~~~~
@subsubsection occt_fcug_2_4_3 Handling an Exception @subsubsection occt_fcug_2_4_3 Handling an Exception
@@ -788,7 +788,7 @@ The recommended location for it is first statement after opening brace of <i>try
As an example, consider the exceptions of type *Standard_NumericError, Standard_Overflow, Standard_Underflow* and *Standard_DivideByZero*, where *Standard_NumericError* is the parent type of the three others. As an example, consider the exceptions of type *Standard_NumericError, Standard_Overflow, Standard_Underflow* and *Standard_DivideByZero*, where *Standard_NumericError* is the parent type of the three others.
~~~~{.cpp} ~~~~~
void f(1) void f(1)
{ {
try try
@@ -805,7 +805,7 @@ void f(1)
// ... // ...
} }
} }
~~~~ ~~~~~
Here, the first handler will catch exceptions of *Standard_Overflow* type Here, the first handler will catch exceptions of *Standard_Overflow* type
and the second one -- exceptions of *Standard_NumericError* type and all exceptions derived from it, including *Standard_Underflow* and *Standard_DivideByZero*. and the second one -- exceptions of *Standard_NumericError* type and all exceptions derived from it, including *Standard_Underflow* and *Standard_DivideByZero*.
@@ -813,7 +813,7 @@ and the second one -- exceptions of *Standard_NumericError* type and all excepti
The handlers are checked in order of appearance, from the nearest to the try block to the most distant from it, until one matches the raise expression. The handlers are checked in order of appearance, from the nearest to the try block to the most distant from it, until one matches the raise expression.
For a try block, it would be a mistake to place a handler for a base exception type ahead of a handler for its derived type since that would ensure that the handler for the derived exception would never be invoked. For a try block, it would be a mistake to place a handler for a base exception type ahead of a handler for its derived type since that would ensure that the handler for the derived exception would never be invoked.
~~~~{.cpp} ~~~~~
void f(1) void f(1)
{ {
int i = 0; int i = 0;
@@ -832,7 +832,7 @@ void f(1)
} }
. . . . . .
} }
~~~~ ~~~~~
The exceptions form a hierarchy tree completely separated from other user defined classes. The exceptions form a hierarchy tree completely separated from other user defined classes.
One exception of type *Standard_Failure* is the root of the entire exception hierarchy. One exception of type *Standard_Failure* is the root of the entire exception hierarchy.
@@ -841,7 +841,7 @@ It is recommended to set up such a handler in the main routine.
The main routine of a program would look like this: The main routine of a program would look like this:
~~~~{.cpp} ~~~~~
#include <Standard_ErrorHandler.hxx> #include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx> #include <Standard_Failure.hxx>
#include <iostream> #include <iostream>
@@ -859,7 +859,7 @@ int main (int argc, char* argv[])
} }
return 1; return 1;
} }
~~~~ ~~~~~
Though standard C++ scoping rules and syntax apply to try block and handlers, note that on some platforms Open CASCADE Technology may be compiled in compatibility mode when exceptions are emulated by long jumps (see below). Though standard C++ scoping rules and syntax apply to try block and handlers, note that on some platforms Open CASCADE Technology may be compiled in compatibility mode when exceptions are emulated by long jumps (see below).
In this mode it is required that no statement precedes or follows any handler. In this mode it is required that no statement precedes or follows any handler.
@@ -921,17 +921,17 @@ Foundation classes provide in the package *Plugin* a method named *Load()*, whic
That method reads the information regarding available plug-ins and their locations from the resource file *Plugin* found by environment variable *CSF_PluginDefaults*: That method reads the information regarding available plug-ins and their locations from the resource file *Plugin* found by environment variable *CSF_PluginDefaults*:
~~~~ ~~~~~
$CSF_PluginDefaults/Plugin $CSF_PluginDefaults/Plugin
~~~~ ~~~~~
The *Load* method looks for the library name in the resource file or registry through its GUID, for example, on UNIX: The *Load* method looks for the library name in the resource file or registry through its GUID, for example, on UNIX:
~~~~ ~~~~~
! METADATADRIVER whose value must be OS or DM. ! METADATADRIVER whose value must be OS or DM.
! FW ! FW
a148e300-5740-11d1-a904-080036aaa103.Location: libFWOSPlugin.so a148e300-5740-11d1-a904-080036aaa103.Location: libFWOSPlugin.so
~~~~ ~~~~~
Then the *Load* method loads the library according to the rules of the operating system of the host machine (for example, by using environment variables such as *LD_LIBRARY_PATH* with Unix and *PATH* with Windows). Then the *Load* method loads the library according to the rules of the operating system of the host machine (for example, by using environment variables such as *LD_LIBRARY_PATH* with Unix and *PATH* with Windows).
After that it invokes the *PLUGINFACTORY* method to return the object, which supports the required service. After that it invokes the *PLUGINFACTORY* method to return the object, which supports the required service.
@@ -941,13 +941,13 @@ The client may then call the functions supported by this object.
To invoke one of the services provided by the plug-in, you may call the *Plugin::Load()* global function with the *Standard_GUID* of the requested service as follows: To invoke one of the services provided by the plug-in, you may call the *Plugin::Load()* global function with the *Standard_GUID* of the requested service as follows:
~~~~{.cpp} ~~~~~{.cpp}
Handle(FADriver_PartStorer)::DownCast(PlugIn::Load (yourStandardGUID)); Handle(FADriver_PartStorer)::DownCast(PlugIn::Load (yourStandardGUID));
~~~~ ~~~~~
Let us take *FAFactory.hxx* and *FAFactory.cxx* as an example: Let us take *FAFactory.hxx* and *FAFactory.cxx* as an example:
~~~~{.cpp} ~~~~~{.cpp}
#include <Standard_Macro.hxx> #include <Standard_Macro.hxx>
#include <Standard_GUID.hxx> #include <Standard_GUID.hxx>
#include <Standard_Transient.hxx> #include <Standard_Transient.hxx>
@@ -957,9 +957,9 @@ class FAFactory
public: public:
Standard_EXPORT static Handle(Standard_Transient) Factory (const Standard_GUID& theGUID); Standard_EXPORT static Handle(Standard_Transient) Factory (const Standard_GUID& theGUID);
}; };
~~~~ ~~~~~
~~~~{.cpp} ~~~~~{.cpp}
#include <FAFactory.hxx> #include <FAFactory.hxx>
#include <FADriver_PartRetriever.hxx> #include <FADriver_PartRetriever.hxx>
@@ -1004,7 +1004,7 @@ Handle(Standard_Transient) FAFactory::Factory (const Standard_GUID& theGUID)
// export plugin function "PLUGINFACTORY" // export plugin function "PLUGINFACTORY"
PLUGIN(FAFactory) PLUGIN(FAFactory)
~~~~ ~~~~~
Application might also instantiate a factory by linking to the library and calling *FAFactory::Factory()* directly. Application might also instantiate a factory by linking to the library and calling *FAFactory::Factory()* directly.
@@ -1042,14 +1042,14 @@ These definitions are now obsolete though still can be used, particularly for co
Let see an example of NCollection template class instantiation for a sequence of points in the header file *MyPackage_SequenceOfPnt.hxx* (analogue of *TColgp_SequenceOfPnt*): Let see an example of NCollection template class instantiation for a sequence of points in the header file *MyPackage_SequenceOfPnt.hxx* (analogue of *TColgp_SequenceOfPnt*):
~~~~{.cpp} ~~~~~{.cpp}
#include <NCollection_Sequence.hxx> #include <NCollection_Sequence.hxx>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
typedef NCollection_Sequence<gp_Pnt> MyPackage_SequenceOfPnt; typedef NCollection_Sequence<gp_Pnt> MyPackage_SequenceOfPnt;
~~~~ ~~~~~
For the case, when sequence itself should be managed by handle, auxiliary macros *DEFINE_HSEQUENCE* can be used: For the case, when sequence itself should be managed by handle, auxiliary macros *DEFINE_HSEQUENCE* can be used:
~~~~{.cpp} ~~~~~{.cpp}
#include <NCollection_Sequence.hxx> #include <NCollection_Sequence.hxx>
#include <NCollection_DefineHSequence.hxx> #include <NCollection_DefineHSequence.hxx>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
@@ -1057,7 +1057,7 @@ typedef NCollection_Sequence<gp_Pnt> MyPackage_SequenceOfPnt;
DEFINE_HSEQUENCE(MyPackage_HSequenceOfPnt, MyPackage_SequenceOfPnt) DEFINE_HSEQUENCE(MyPackage_HSequenceOfPnt, MyPackage_SequenceOfPnt)
... ...
Handle(MyPackage_HSequenceOfPnt) aSeq = new MyPackage_HSequenceOfPnt(); Handle(MyPackage_HSequenceOfPnt) aSeq = new MyPackage_HSequenceOfPnt();
~~~~ ~~~~~
See more details about available collections in following sections. See more details about available collections in following sections.
@@ -1302,7 +1302,7 @@ The common methods of Iterator are:
Usage sample: Usage sample:
~~~~{.cpp} ~~~~~{.cpp}
typedef Ncollection_Sequence<gp_Pnt> MyPackage_SequenceOfPnt; typedef Ncollection_Sequence<gp_Pnt> MyPackage_SequenceOfPnt;
void Perform (const MyPackage_SequenceOfPnt& theSequence) void Perform (const MyPackage_SequenceOfPnt& theSequence)
{ {
@@ -1312,17 +1312,17 @@ void Perform (const MyPackage_SequenceOfPnt& theSequence)
... ...
} }
} }
~~~~ ~~~~~
@subsubsection occt_fcug_3_1_5 Allocators @subsubsection occt_fcug_3_1_5 Allocators
All constructors of *NCollection* classes receive the *Allocator* object as the last parameter. All constructors of *NCollection* classes receive the *Allocator* object as the last parameter.
This is an object of a type managed by Handle, inheriting *NCollection_BaseAllocator*, with the following (mandatory) methods redefined: This is an object of a type managed by Handle, inheriting *NCollection_BaseAllocator*, with the following (mandatory) methods redefined:
~~~~{.cpp} ~~~~~{.cpp}
virtual void* Allocate (const size_t theSize) override; virtual void* Allocate (const size_t theSize) override;
virtual void Free (void* theAddress) override; virtual void Free (void* theAddress) override;
~~~~ ~~~~~
It is used internally every time when the collection allocates memory for its item(s) and releases this memory. It is used internally every time when the collection allocates memory for its item(s) and releases this memory.
The default value of this parameter (empty *Handle*) designates the use of *NCollection_BaseAllocator*, where the functions *Standard::Allocate* and *Standard::Free* are called. The default value of this parameter (empty *Handle*) designates the use of *NCollection_BaseAllocator*, where the functions *Standard::Allocate* and *Standard::Free* are called.
@@ -1360,7 +1360,7 @@ Among the best suitable solutions there can be a pointer to an object, handled o
The bounding object may have any dimension and geometry. The bounding object may have any dimension and geometry.
The minimal interface of *TheBndType* (besides public empty and copy constructor and operator=) used in NCollection_UBTree algorithm as follows: The minimal interface of *TheBndType* (besides public empty and copy constructor and operator=) used in NCollection_UBTree algorithm as follows:
~~~~{.cpp} ~~~~~{.cpp}
class MyBndType class MyBndType
{ {
public: public:
@@ -1373,7 +1373,7 @@ public:
//! Computes the squared maximal linear extent of me (for a box it is the squared diagonal of the box). //! Computes the squared maximal linear extent of me (for a box it is the squared diagonal of the box).
Standard_Real SquareExtent() const; Standard_Real SquareExtent() const;
}; };
~~~~ ~~~~~
This interface is implemented in types of Bnd package: *Bnd_Box, Bnd_Box2d, Bnd_B2x, Bnd_B3x*. This interface is implemented in types of Bnd package: *Bnd_Box, Bnd_Box2d, Bnd_B2x, Bnd_B3x*.
@@ -1384,7 +1384,7 @@ The quality of a tree is better (considering the speed of searches) if objects a
Instantiation of *NCollection_UBTreeFiller* collects objects to be added, and then adds them at once to the given NCollection_UBTree instance in a random order using the Fisher-Yates algorithm. Instantiation of *NCollection_UBTreeFiller* collects objects to be added, and then adds them at once to the given NCollection_UBTree instance in a random order using the Fisher-Yates algorithm.
Below is the sample code that creates an instance of *NCollection_UBTree* indexed by 2D boxes (Bnd_B2f), then a selection is performed returning the objects whose bounding boxes contain the given 2D point. Below is the sample code that creates an instance of *NCollection_UBTree* indexed by 2D boxes (Bnd_B2f), then a selection is performed returning the objects whose bounding boxes contain the given 2D point.
~~~~{.cpp} ~~~~~{.cpp}
typedef NCollection_UBTree<MyData, Bnd_B2f> UBTree; typedef NCollection_UBTree<MyData, Bnd_B2f> UBTree;
typedef NCollection_List<MyData> ListOfSelected; typedef NCollection_List<MyData> ListOfSelected;
//! Tree Selector type //! Tree Selector type
@@ -1426,7 +1426,7 @@ aTreeFiller.Fill();
MyTreeSelector aSel (aPoint2d); MyTreeSelector aSel (aPoint2d);
aTree.Select (aSel); aTree.Select (aSel);
const ListOfSelected& aSelected = aSel.ListAccepted(); const ListOfSelected& aSelected = aSel.ListAccepted();
~~~~ ~~~~~
##### NCollection_CellFilter ##### NCollection_CellFilter
@@ -1438,10 +1438,10 @@ while search with NCollection_UBTree provides logarithmic law access time.
Packages *TShort*, *TColGeom*, *TColGeom2d*, *TColStd*, *TColgp* provide template instantiations (typedefs) of *NCollection* templates to standard OCCT types. Packages *TShort*, *TColGeom*, *TColGeom2d*, *TColStd*, *TColgp* provide template instantiations (typedefs) of *NCollection* templates to standard OCCT types.
Classes with *H* prefix in name are handle-based variants and inherit Standard_Transient. Classes with *H* prefix in name are handle-based variants and inherit Standard_Transient.
~~~~{.cpp} ~~~~~{.cpp}
typedef NCollection_Array1<gp_Vec> TColgp_Array1OfVec; typedef NCollection_Array1<gp_Vec> TColgp_Array1OfVec;
typedef NCollection_Array1<TCollection_AsciiString> TColStd_Array1OfAsciiString; typedef NCollection_Array1<TCollection_AsciiString> TColStd_Array1OfAsciiString;
~~~~ ~~~~~
Packages like *TopTools* also include definitions of collections and hash functions for complex types like shapes -- *TopTools_ShapeMapHasher*, *TopTools_MapOfShape*. Packages like *TopTools* also include definitions of collections and hash functions for complex types like shapes -- *TopTools_ShapeMapHasher*, *TopTools_MapOfShape*.
@@ -1525,27 +1525,27 @@ These classes also provide a data structure to represent any expression, relatio
Vectors and matrices have arbitrary ranges which must be defined at declaration time and cannot be changed after declaration. Vectors and matrices have arbitrary ranges which must be defined at declaration time and cannot be changed after declaration.
~~~~{.cpp} ~~~~~{.cpp}
math_Vector aVec (1, 3); math_Vector aVec (1, 3);
// a vector of dimension 3 with range (1..3) // a vector of dimension 3 with range (1..3)
math_Matrix aMat (0, 2, 0, 2); math_Matrix aMat (0, 2, 0, 2);
// a matrix of dimension 3x3 with range (0..2, 0..2) // a matrix of dimension 3x3 with range (0..2, 0..2)
math_Vector aVec (N1, N2); math_Vector aVec (N1, N2);
// a vector of dimension N2-N1+1 with range (N1..N2) // a vector of dimension N2-N1+1 with range (N1..N2)
~~~~ ~~~~~
Vector and Matrix objects use value semantics. Vector and Matrix objects use value semantics.
In other words, they cannot be shared and are copied through assignment. In other words, they cannot be shared and are copied through assignment.
~~~~{.cpp} ~~~~~{.cpp}
math_Vector aVec1 (1, 3), aVec2 (0, 2); math_Vector aVec1 (1, 3), aVec2 (0, 2);
aVec2 = aVec1; aVec2 = aVec1;
// aVec1 is copied into aVec2; a modification of aVec1 does not affect aVec2 // aVec1 is copied into aVec2; a modification of aVec1 does not affect aVec2
~~~~ ~~~~~
Vector and Matrix values may be initialized and obtained using indexes which must lie within the range definition of the vector or the matrix. Vector and Matrix values may be initialized and obtained using indexes which must lie within the range definition of the vector or the matrix.
~~~~{.cpp} ~~~~~{.cpp}
math_Vector aVec (1, 3); math_Vector aVec (1, 3);
math_Matrix aMat (1, 3, 1, 3); math_Matrix aMat (1, 3, 1, 3);
Standard_Real aValue; Standard_Real aValue;
@@ -1554,7 +1554,7 @@ aVec (2) = 1.0;
aValue = aVec(1); aValue = aVec(1);
aMat (1, 3) = 1.0; aMat (1, 3) = 1.0;
aValue = aMat (2, 2); aValue = aMat (2, 2);
~~~~ ~~~~~
Some operations on Vector and Matrix objects may not be legal. Some operations on Vector and Matrix objects may not be legal.
In this case an exception is raised. In this case an exception is raised.
@@ -1562,12 +1562,12 @@ Two standard exceptions are used:
* *Standard_DimensionError* exception is raised when two matrices or vectors involved in an operation are of incompatible dimensions. * *Standard_DimensionError* exception is raised when two matrices or vectors involved in an operation are of incompatible dimensions.
* *Standard_RangeError* exception is raised if an access outside the range definition of a vector or of a matrix is attempted. * *Standard_RangeError* exception is raised if an access outside the range definition of a vector or of a matrix is attempted.
~~~~{.cpp} ~~~~~~{.cpp}
math_Vector aVec1 (1, 3), aVec2 (1, 2), aVec3 (0, 2); math_Vector aVec1 (1, 3), aVec2 (1, 2), aVec3 (0, 2);
aVec1 = aVec2; // error: Standard_DimensionError is raised aVec1 = aVec2; // error: Standard_DimensionError is raised
aVec1 = aVec3; // OK: ranges are not equal but dimensions are compatible aVec1 = aVec3; // OK: ranges are not equal but dimensions are compatible
aVec1 (0) = 2.0; // error: Standard_RangeError is raised aVec1 (0) = 2.0; // error: Standard_RangeError is raised
~~~~ ~~~~~~
@subsection occt_occt_fcug_4_3 Primitive Geometric Types @subsection occt_occt_fcug_4_3 Primitive Geometric Types
@@ -1649,7 +1649,7 @@ They contain:
The example below demonstrates the use of the math_Gauss class, which implements the Gauss solution for a set of linear equations. The example below demonstrates the use of the math_Gauss class, which implements the Gauss solution for a set of linear equations.
The following definition is an extract from the header file of the class *math_Gauss*: The following definition is an extract from the header file of the class *math_Gauss*:
~~~~{.cpp} ~~~~~~{.cpp}
class math_Gauss class math_Gauss
{ {
public: public:
@@ -1657,11 +1657,11 @@ public:
Standard_Boolean IsDone() const; Standard_Boolean IsDone() const;
void Solve (const math_Vector& B, math_Vector& X) const; void Solve (const math_Vector& B, math_Vector& X) const;
}; };
~~~~ ~~~~~~
Now the main program uses the math_Gauss class to solve the equations _a*x1=b1_ and _a*x2=b2_: Now the main program uses the math_Gauss class to solve the equations _a*x1=b1_ and _a*x2=b2_:
~~~~{.cpp} ~~~~~{.cpp}
#include <math_Vector.hxx> #include <math_Vector.hxx>
#include <math_Matrix.hxx> #include <math_Matrix.hxx>
main() main()
@@ -1686,12 +1686,12 @@ main()
// StdFail_NotDone is raised // StdFail_NotDone is raised
} }
} }
~~~~ ~~~~~
The next example demonstrates the use of the *math_BissecNewton* class, which implements a combination of the Newton and Bissection algorithms to find the root of a function known to lie between two bounds. The next example demonstrates the use of the *math_BissecNewton* class, which implements a combination of the Newton and Bissection algorithms to find the root of a function known to lie between two bounds.
The definition is an extract from the header file of the class *math_BissecNewton*: The definition is an extract from the header file of the class *math_BissecNewton*:
~~~~{.cpp} ~~~~~{.cpp}
class math_BissecNewton class math_BissecNewton
{ {
public: public:
@@ -1702,12 +1702,12 @@ public:
Standard_Boolean IsDone() const; Standard_Boolean IsDone() const;
Standard_Real Root(); Standard_Real Root();
}; };
~~~~ ~~~~~
The abstract class *math_FunctionWithDerivative* describes the services which have to be implemented for the function _f_ which is to be used by a *math_BissecNewton* algorithm. The abstract class *math_FunctionWithDerivative* describes the services which have to be implemented for the function _f_ which is to be used by a *math_BissecNewton* algorithm.
The following definition corresponds to the header file of the abstract class *math_FunctionWithDerivative*: The following definition corresponds to the header file of the abstract class *math_FunctionWithDerivative*:
~~~~{.cpp} ~~~~~{.cpp}
class math_FunctionWithDerivative class math_FunctionWithDerivative
{ {
public: public:
@@ -1715,12 +1715,12 @@ public:
virtual Standard_Boolean Derivative (const Standard_Real x, Standard_Real& d) = 0; virtual Standard_Boolean Derivative (const Standard_Real x, Standard_Real& d) = 0;
virtual Standard_Boolean Values (const Standard_Real x, Standard_Real& f, Standard_Real& d) = 0; virtual Standard_Boolean Values (const Standard_Real x, Standard_Real& f, Standard_Real& d) = 0;
}; };
~~~~ ~~~~~
Now the test sample uses the *math_BissecNewton* class to find the root of the equation _f(x)=x**2-4_ in the interval [1.5, 2.5]. Now the test sample uses the *math_BissecNewton* class to find the root of the equation _f(x)=x**2-4_ in the interval [1.5, 2.5].
The function to solve is implemented in the class *myFunction* which inherits from the class *math_FunctionWithDerivative*, then the main program finds the required root. The function to solve is implemented in the class *myFunction* which inherits from the class *math_FunctionWithDerivative*, then the main program finds the required root.
~~~~{.cpp} ~~~~~{.cpp}
#include <math_BissecNewton.hxx> #include <math_BissecNewton.hxx>
#include <math_FunctionWithDerivative.hxx> #include <math_FunctionWithDerivative.hxx>
class myFunction : public math_FunctionWithDerivative class myFunction : public math_FunctionWithDerivative
@@ -1759,7 +1759,7 @@ main()
else // no else // no
{ {
} }
~~~~ ~~~~~
@subsection occt_occt_fcug_4_7 Precision @subsection occt_occt_fcug_4_7 Precision
@@ -1796,10 +1796,10 @@ The choice of precision value for parametric space depends not only on the accur
This is because it is desirable to link parametric precision and real precision. This is because it is desirable to link parametric precision and real precision.
If you are on a curve defined by the equation *P(t)*, you would want to have equivalence between the following: If you are on a curve defined by the equation *P(t)*, you would want to have equivalence between the following:
~~~~{.cpp} ~~~~~
Abs (t1 - t2) < ParametricPrecision Abs (t1 - t2) < ParametricPrecision
Distance (P(t1), P(t2)) < RealPrecision Distance (P(t1), P(t2)) < RealPrecision
~~~~ ~~~~~
@subsubsection occt_occt_fcug_4_7_1 The Precision package @subsubsection occt_occt_fcug_4_7_1 The Precision package
@@ -1832,29 +1832,29 @@ This method is used to compare two angles.
Its current value is *Epsilon(2 * PI)* i.e. the smallest number *x* such that *2*PI + x* is different of *2\*PI*. Its current value is *Epsilon(2 * PI)* i.e. the smallest number *x* such that *2*PI + x* is different of *2\*PI*.
It can be used to check confusion of two angles as follows: It can be used to check confusion of two angles as follows:
~~~~{.cpp} ~~~{.cpp}
bool areEqualAngles (double theAngle1, double theAngle2) bool areEqualAngles (double theAngle1, double theAngle2)
{ {
return Abs(theAngle1 - theAngle2) < Precision::Angular(); return Abs(theAngle1 - theAngle2) < Precision::Angular();
} }
~~~~ ~~~
It is also possible to check parallelism of two vectors as follows: It is also possible to check parallelism of two vectors as follows:
~~~~{.cpp} ~~~{.cpp}
bool areParallelVectors (const gp_Vec& theVec1, const gp_Vec& theVec2) bool areParallelVectors (const gp_Vec& theVec1, const gp_Vec& theVec2)
{ {
return theVec1.IsParallel (theVec2, Precision::Angular()); return theVec1.IsParallel (theVec2, Precision::Angular());
} }
~~~~ ~~~
Note that *Precision::Angular()* can be used on both dot and cross products because for small angles the *Sine* and the *Angle* are equivalent. Note that *Precision::Angular()* can be used on both dot and cross products because for small angles the *Sine* and the *Angle* are equivalent.
So to test if two directions of type *gp_Dir* are perpendicular, it is legal to use the following code: So to test if two directions of type *gp_Dir* are perpendicular, it is legal to use the following code:
~~~~{.cpp} ~~~{.cpp}
bool arePerpendicular (const gp_Dir& theDir1, const gp_Dir& theDir2) bool arePerpendicular (const gp_Dir& theDir1, const gp_Dir& theDir2)
{ {
return Abs(theDir1 * theDir2) < Precision::Angular(); return Abs(theDir1 * theDir2) < Precision::Angular();
} }
~~~~ ~~~
#### Precision::Confusion #### Precision::Confusion
@@ -1862,7 +1862,7 @@ This method is used to test 3D distances.
The current value is *1.e-7*, in other words, 1/10 micron if the unit used is the millimeter. The current value is *1.e-7*, in other words, 1/10 micron if the unit used is the millimeter.
It can be used to check confusion of two points as follows: It can be used to check confusion of two points as follows:
~~~~{.cpp} ~~~{.cpp}
bool areEqualPoints (const gp_Pnt& thePnt1, const gp_Pnt& thePnt2) bool areEqualPoints (const gp_Pnt& thePnt1, const gp_Pnt& thePnt2)
{ {
return thePnt1.IsEqual (thePnt2, Precision::Confusion()); return thePnt1.IsEqual (thePnt2, Precision::Confusion());
@@ -1870,12 +1870,12 @@ bool areEqualPoints (const gp_Pnt& thePnt1, const gp_Pnt& thePnt2)
~~~ ~~~
It is also possible to find a vector of null length: It is also possible to find a vector of null length:
~~~~{.cpp} ~~~{.cpp}
bool isNullVector (const gp_Vec& theVec) bool isNullVector (const gp_Vec& theVec)
{ {
return theVec.Magnitude() < Precision::Confusion(); return theVec.Magnitude() < Precision::Confusion();
} }
~~~~ ~~~
#### Precision::Intersection #### Precision::Intersection

View File

@@ -60,25 +60,25 @@ Administrative data, in the Global Section of the IGES file (such as the file n
@subsection occt_iges_2_3 Description of the process @subsection occt_iges_2_3 Description of the process
@subsubsection occt_iges_2_3_1 Loading the IGES file @subsubsection occt_iges_2_3_1 Loading the IGES file
Before performing any other operation, you have to load the file using the syntax below. Before performing any other operation, you have to load the file using the syntax below.
~~~~{.cpp} ~~~~~
IGESControl_Reader reader; IGESControl_Reader reader;
IFSelect_ReturnStatus stat = reader.ReadFile(“filename.igs”); IFSelect_ReturnStatus stat = reader.ReadFile(“filename.igs”);
~~~~ ~~~~~
The loading operation only loads the IGES file into computer memory; it does not translate it. The loading operation only loads the IGES file into computer memory; it does not translate it.
@subsubsection occt_iges_2_3_2 Checking the IGES file @subsubsection occt_iges_2_3_2 Checking the IGES file
This step is not obligatory. Check the loaded file with: This step is not obligatory. Check the loaded file with:
~~~~{.cpp} ~~~~~
Standard_Boolean ok = reader.Check(Standard_True); Standard_Boolean ok = reader.Check(Standard_True);
~~~~ ~~~~~
The variable “ok is True” is returned if no fail message was found; “ok is False” is returned if there was at least one fail message. The variable “ok is True” is returned if no fail message was found; “ok is False” is returned if there was at least one fail message.
~~~~{.cpp} ~~~~~
reader.PrintCheckLoad (failsonly, mode); reader.PrintCheckLoad (failsonly, mode);
~~~~ ~~~~~
Error messages are displayed if there are invalid or incomplete IGES entities, giving you information on the cause of the error. Error messages are displayed if there are invalid or incomplete IGES entities, giving you information on the cause of the error.
~~~~{.cpp} ~~~~~
Standard_Boolean failsonly = Standard_True or Standard_False; Standard_Boolean failsonly = Standard_True or Standard_False;
~~~~ ~~~~~
If you give True, you will see fail messages only. If you give False, you will see both fail and warning messages. If you give True, you will see fail messages only. If you give False, you will see both fail and warning messages.
Your analysis of the file can be either message-oriented or entity-oriented. Choose your preference with *IFSelect_PrintCount mode = IFSelect_xxx*, where *xxx* can be any of the following: Your analysis of the file can be either message-oriented or entity-oriented. Choose your preference with *IFSelect_PrintCount mode = IFSelect_xxx*, where *xxx* can be any of the following:
@@ -98,14 +98,14 @@ manages the continuity of BSpline curves (IGES entities 106, 112 and 126) after
* 2: This option concerns IGES Spline curves only. IGES Spline curves are broken down into pieces of C2 continuity. If C2 cannot be ensured, the Spline curves will be broken down into pieces of C1 continuity. * 2: This option concerns IGES Spline curves only. IGES Spline curves are broken down into pieces of C2 continuity. If C2 cannot be ensured, the Spline curves will be broken down into pieces of C1 continuity.
Read this parameter with: Read this parameter with:
~~~~{.cpp} ~~~~~
Standard_Integer ic = Interface_Static::IVal("read.iges.bspline.continuity"); Standard_Integer ic = Interface_Static::IVal("read.iges.bspline.continuity");
~~~~ ~~~~~
Modify this value with: Modify this value with:
~~~~{.cpp} ~~~~~
if (!Interface_Static::SetIVal ("read.iges.bspline.continuity",2)) if (!Interface_Static::SetIVal ("read.iges.bspline.continuity",2))
.. error ..; .. error ..;
~~~~ ~~~~~
Default value is 1. Default value is 1.
This parameter does not change the continuity of curves that are used in the construction of IGES BRep entities. In this case, the parameter does not influence the continuity of the resulting OCCT curves (it is ignored). This parameter does not change the continuity of curves that are used in the construction of IGES BRep entities. In this case, the parameter does not influence the continuity of the resulting OCCT curves (it is ignored).
@@ -117,14 +117,14 @@ reads the precision value.
* User (1) the precision value is that of the read.precision.val parameter. * User (1) the precision value is that of the read.precision.val parameter.
Read this parameter with: Read this parameter with:
~~~~{.cpp} ~~~~~
Standard_Integer ic = Interface_Static::IVal("read.precision.mode"); Standard_Integer ic = Interface_Static::IVal("read.precision.mode");
~~~~ ~~~~~
Modify this value with: Modify this value with:
~~~~{.cpp} ~~~~~
if (!Interface_Static::SetIVal ("read.precision.mode",1)) if (!Interface_Static::SetIVal ("read.precision.mode",1))
.. error ..; .. error ..;
~~~~ ~~~~~
Default value is *File* (0). Default value is *File* (0).
<h4>read.precision.val</h4> <h4>read.precision.val</h4>
@@ -133,14 +133,14 @@ User defined precision value. This parameter gives the precision for shape const
This value is in the measurement unit defined in the IGES file header. This value is in the measurement unit defined in the IGES file header.
Read this parameter with: Read this parameter with:
~~~~{.cpp} ~~~~~
Standard_Real rp = Interface_Static::RVal("read.precision.val"); Standard_Real rp = Interface_Static::RVal("read.precision.val");
~~~~ ~~~~~
Modify this parameter with: Modify this parameter with:
~~~~{.cpp} ~~~~~
if (!Interface_Static::SetRVal ("read.precision.val",0.001)) if (!Interface_Static::SetRVal ("read.precision.val",0.001))
.. error ..; .. error ..;
~~~~ ~~~~~
Default value is 0.0001. Default value is 0.0001.
The value given to this parameter is a target value that is applied to *TopoDS_Vertex, TopoDS_Edge* and *TopoDS_Face* entities. The processor does its best to reach it. Under certain circumstances, the value you give may not be attached to all of the entities concerned at the end of processing. IGES-to-OCCT translation does not improve the quality of the geometry in the original IGES file. This means that the value you enter may be impossible to attain the given quality of geometry in the IGES file. The value given to this parameter is a target value that is applied to *TopoDS_Vertex, TopoDS_Edge* and *TopoDS_Face* entities. The processor does its best to reach it. Under certain circumstances, the value you give may not be attached to all of the entities concerned at the end of processing. IGES-to-OCCT translation does not improve the quality of the geometry in the original IGES file. This means that the value you enter may be impossible to attain the given quality of geometry in the IGES file.
@@ -154,29 +154,27 @@ defines the mode of applying the maximum allowed tolerance. Its possible values
* *Forced(1)* maximum tolerance is used as a rigid limit, i.e. it can not be exceeded and, if this happens, tolerance is trimmed to suit the maximum-allowable value. * *Forced(1)* maximum tolerance is used as a rigid limit, i.e. it can not be exceeded and, if this happens, tolerance is trimmed to suit the maximum-allowable value.
Read this parameter with: Read this parameter with:
~~~~{.cpp} ~~~~~
Standard_Integer mv = Interface_Static::IVal("read.maxprecision.mode"); Standard_Integer mv = Interface_Static::IVal("read.maxprecision.mode");
~~~~ ~~~~~
Modify this parameter with: Modify this parameter with:
~~~~{.cpp} ~~~~~
if (!Interface_Static::SetIVal ("read.maxprecision.mode",1)) if (!Interface_Static::SetIVal ("read.maxprecision.mode",1))
.. error ..; .. error ..;
~~~~ ~~~~~
Default value is *Preferred (0)*. Default value is *Preferred (0)*.
<h4>read.maxprecision.val</h4> <h4>read.maxprecision.val</h4>
defines the maximum allowable tolerance (in internal units, which are specified in xstep.cascade.unit) of the shape. defines the maximum allowable tolerance (in mm) of the shape. It should be not less than the basis value of tolerance set in processor (either Resolution from the file or *read.precision.val*). Actually, the maximum between *read.maxprecision.val* and basis tolerance is used to define maximum allowed tolerance.
It should be not less than the basis value of tolerance set in processor (either Resolution from the file or *read.precision.val*).
Actually, the maximum between *read.maxprecision.val* and basis tolerance is used to define maximum allowed tolerance.
Read this parameter with: Read this parameter with:
~~~~{.cpp} ~~~~~
Standard_Real rp = Interface_Static::RVal("read.maxprecision.val"); Standard_Real rp = Interface_Static::RVal("read.maxprecision.val");
~~~~ ~~~~~
Modify this parameter with: Modify this parameter with:
~~~~{.cpp} ~~~~~
if (!Interface_Static::SetRVal ("read.maxprecision.val",0.1)) if (!Interface_Static::SetRVal ("read.maxprecision.val",0.1))
.. error ..; .. error ..;
~~~~ ~~~~~
Default value is 1. Default value is 1.
<h4>read.stdsameparameter.mode</h4> <h4>read.stdsameparameter.mode</h4>
@@ -185,14 +183,14 @@ defines the using of *BRepLib\::SameParameter*. Its possible values are:
* 1 (On) -- *BRepLib\::SameParameter* is called. * 1 (On) -- *BRepLib\::SameParameter* is called.
*BRepLib\::SameParameter* is used through *ShapeFix_Edge\::SameParameter*. It ensures that the resulting edge will have the lowest tolerance taking pcurves either unmodified from the IGES file or modified by *BRepLib\::SameParameter*. *BRepLib\::SameParameter* is used through *ShapeFix_Edge\::SameParameter*. It ensures that the resulting edge will have the lowest tolerance taking pcurves either unmodified from the IGES file or modified by *BRepLib\::SameParameter*.
Read this parameter with: Read this parameter with:
~~~~{.cpp} ~~~~~
Standard_Integer mv = Interface_Static::IVal("read.stdsameparameter.mode"); Standard_Integer mv = Interface_Static::IVal("read.stdsameparameter.mode");
~~~~ ~~~~~
Modify this parameter with: Modify this parameter with:
~~~~{.cpp} ~~~~~
if (!Interface_Static::SetIVal ("read.stdsameparameter.mode",1)) if (!Interface_Static::SetIVal ("read.stdsameparameter.mode",1))
.. error ..; .. error ..;
~~~~ ~~~~~
Deafault value is 0 (Off). Deafault value is 0 (Off).
<h4>read.surfacecurve.mode</h4> <h4>read.surfacecurve.mode</h4>
@@ -226,42 +224,42 @@ In any other case, the 2D representation is preferred to the 3D.
If either a 3D or a 2D contour is absent in the file or cannot be translated, then it is re-computed from another contour. If the translation of both 2D and 3D contours fails, the whole curve (type 141 or 142) is not translated. If this curve is used for trimming a face, the face will be translated without this trimming and will have natural restrictions. If either a 3D or a 2D contour is absent in the file or cannot be translated, then it is re-computed from another contour. If the translation of both 2D and 3D contours fails, the whole curve (type 141 or 142) is not translated. If this curve is used for trimming a face, the face will be translated without this trimming and will have natural restrictions.
Read this parameter with: Read this parameter with:
~~~~{.cpp} ~~~~~
Standard_Integer ic = Interface_Static::IVal("read.surfacecurve.mode"); Standard_Integer ic = Interface_Static::IVal("read.surfacecurve.mode");
~~~~ ~~~~~
Modify this value with: Modify this value with:
~~~~{.cpp} ~~~~~
if (!Interface_Static::SetIVal ("read.surfacecurve.mode",3)) if (!Interface_Static::SetIVal ("read.surfacecurve.mode",3))
.. error ..; .. error ..;
~~~~ ~~~~~
Default value is Default (0). Default value is Default (0).
<h4>read.encoderegularity.angle</h4> <h4>read.encoderegularity.angle</h4>
This parameter is used within the *BRepLib::EncodeRegularity()* function which is called for a shape read from an IGES or a STEP file at the end of translation process. This function sets the regularity flag of an edge in a shell when this edge is shared by two faces. This flag shows the continuity, which these two faces are connected with at that edge. This parameter is used within the *BRepLib::EncodeRegularity()* function which is called for a shape read from an IGES or a STEP file at the end of translation process. This function sets the regularity flag of an edge in a shell when this edge is shared by two faces. This flag shows the continuity, which these two faces are connected with at that edge.
Read this parameter with: Read this parameter with:
~~~~{.cpp} ~~~~~
Standard_Real era = Interface_Static::RVal("read.encoderegularity.angle"); Standard_Real era = Interface_Static::RVal("read.encoderegularity.angle");
~~~~ ~~~~~
Modify this parameter with: Modify this parameter with:
~~~~{.cpp} ~~~~~
if (!Interface_Static::SetRVal ("read.encoderegularity.angle",0.1)) if (!Interface_Static::SetRVal ("read.encoderegularity.angle",0.1))
.. error ..; .. error ..;
~~~~ ~~~~~
Default value is 0.01. Default value is 0.01.
<h4>read.iges.bspline.approxd1.mode</h4> <h4>read.iges.bspline.approxd1.mode</h4>
This parameter is obsolete (it is rarely used in real practice). If set to True, it affects the translation of bspline curves of degree 1 from IGES: these curves (which geometrically are polylines) are split by duplicated points, and the translator attempts to convert each of the obtained parts to a bspline of a higher continuity. This parameter is obsolete (it is rarely used in real practice). If set to True, it affects the translation of bspline curves of degree 1 from IGES: these curves (which geometrically are polylines) are split by duplicated points, and the translator attempts to convert each of the obtained parts to a bspline of a higher continuity.
Read this parameter with: Read this parameter with:
~~~~{.cpp} ~~~~~
Standard_Real bam = Interface_Static::CVal("read.iges.bspline.approxd1.mode"); Standard_Real bam = Interface_Static::CVal("read.iges.bspline.approxd1.mode");
~~~~ ~~~~~
Modify this parameter with: Modify this parameter with:
~~~~{.cpp} ~~~~~
if (!Interface_Static::SetRVal ("read.encoderegularity.angle","On")) if (!Interface_Static::SetRVal ("read.encoderegularity.angle","On"))
.. error ..; .. error ..;
~~~~ ~~~~~
Default value is Off. Default value is Off.
@@ -284,41 +282,41 @@ Default value is MM.
@subsubsection occt_iges_2_3_4 Selecting entities @subsubsection occt_iges_2_3_4 Selecting entities
A list of entities can be formed by invoking the method *IGESControl_Reader::GiveList*. A list of entities can be formed by invoking the method *IGESControl_Reader::GiveList*.
~~~~{.cpp} ~~~~~
Handle(TColStd_HSequenceOfTransient) list = reader.GiveList(); Handle(TColStd_HSequenceOfTransient) list = reader.GiveList();
~~~~ ~~~~~
Several predefined operators can be used to select a list of entities of a specific type. Several predefined operators can be used to select a list of entities of a specific type.
To make a selection, use the method *IGESControl_Reader::GiveList* with the selection type in quotation marks as an argument. You can also make cumulative selections. For example, you would use the following Syntax: To make a selection, use the method *IGESControl_Reader::GiveList* with the selection type in quotation marks as an argument. You can also make cumulative selections. For example, you would use the following syntax:
1. Requesting the faces in the file: 1. Requesting the faces in the file:
~~~~{.cpp} ~~~~~
faces = Reader.GiveList("iges-faces"); faces = Reader.GiveList("iges-faces");
~~~~ ~~~~~
2. Requesting the visible roots in the file: 2. Requesting the visible roots in the file:
~~~~{.cpp} ~~~~~
visibles = Reader.GiveList(iges-visible-roots); visibles = Reader.GiveList(iges-visible-roots);
~~~~ ~~~~~
3. Requesting the visible faces: 3. Requesting the visible faces:
~~~~{.cpp} ~~~~~
visfac = Reader.GiveList(iges-visible-roots,faces); visfac = Reader.GiveList(iges-visible-roots,faces);
~~~~ ~~~~~
Using a signature, you can define a selection dynamically, filtering the string by means of a criterion. When you request a selection using the method GiveList, you can give either a predefined selection or a selection by signature. You make your selection by signature using the predefined signature followed by your criterion in parentheses as shown in the example below. The syntaxes given are equivalent to each other. Using a signature, you can define a selection dynamically, filtering the string by means of a criterion. When you request a selection using the method GiveList, you can give either a predefined selection or a selection by signature. You make your selection by signature using the predefined signature followed by your criterion in parentheses as shown in the example below. The syntaxes given are equivalent to each other.
~~~~{.cpp} ~~~~~
faces = Reader.GiveList(“xst-type(SurfaceOfRevolution)”); faces = Reader.GiveList(“xst-type(SurfaceOfRevolution)”);
faces = Reader.GiveList(“iges-type(120)”); faces = Reader.GiveList(“iges-type(120)”);
~~~~ ~~~~~
You can also look for: You can also look for:
* values returned by your signature which match your criterion exactly * values returned by your signature which match your criterion exactly
~~~~{.cpp} ~~~~~
faces = Reader.GiveList(“xst-type(=SurfaceOfRevolution)”); faces = Reader.GiveList(“xst-type(=SurfaceOfRevolution)”);
~~~~ ~~~~~
* values returned by your signature which do not contain your criterion * values returned by your signature which do not contain your criterion
~~~~{.cpp} ~~~~~
faces = Reader.GiveList(“xst-type(!SurfaceOfRevolution)”); faces = Reader.GiveList(“xst-type(!SurfaceOfRevolution)”);
~~~~ ~~~~~
* values returned by your signature which do not exactly match your criterion. * values returned by your signature which do not exactly match your criterion.
~~~~{.cpp} ~~~~~
faces = Reader.GiveList(“xst-type(!=SurfaceOfRevolution)”); faces = Reader.GiveList(“xst-type(!=SurfaceOfRevolution)”);
~~~~ ~~~~~
<h4>List of predefined operators that can be used:</h4> <h4>List of predefined operators that can be used:</h4>
* *xst-model-all* -- selects all entities. * *xst-model-all* -- selects all entities.
@@ -331,7 +329,7 @@ faces = Reader.GiveList(“xst-type(!=SurfaceOfRevolution)”);
* *iges-visible-transf-roots* -- selects all visible and translatable roots. * *iges-visible-transf-roots* -- selects all visible and translatable roots.
* *iges-blanked-roots* -- selects all blank roots, whether translatable or not. * *iges-blanked-roots* -- selects all blank roots, whether translatable or not.
* *iges-blanked-transf-roots* -- selects all blank and translatable roots. * *iges-blanked-transf-roots* -- selects all blank and translatable roots.
* *iges-status-independent* -- selects entities whose IGES Subordinate Status = 0. * *iges-status-independant* -- selects entities whose IGES Subordinate Status = 0.
* *iges-bypass-group* -- selects all root entities. If a root entity is a group (402/7 or 402/9), the entities in the group are selected. * *iges-bypass-group* -- selects all root entities. If a root entity is a group (402/7 or 402/9), the entities in the group are selected.
* *iges-bypass-subfigure* -- selects all root entities. If a root entity is a subfigure definition (308), the entities in the subfigure definition are selected. * *iges-bypass-subfigure* -- selects all root entities. If a root entity is a subfigure definition (308), the entities in the subfigure definition are selected.
* *iges-bypass-group-subfigure* -- selects all root entities. If a root entity is a group (402/7 or 402/9) or a subfigure definition (308), the entities in the group and in the subfigure definition are selected. * *iges-bypass-group-subfigure* -- selects all root entities. If a root entity is a group (402/7 or 402/9) or a subfigure definition (308), the entities in the group and in the subfigure definition are selected.
@@ -344,62 +342,62 @@ faces = Reader.GiveList(“xst-type(!=SurfaceOfRevolution)”);
@subsubsection occt_iges_2_3_5 Performing the IGES file translation @subsubsection occt_iges_2_3_5 Performing the IGES file translation
Perform translation according to what you want to translate: Perform translation according to what you want to translate:
1. Translate an entity identified by its rank with: 1. Translate an entity identified by its rank with:
~~~~{.cpp} ~~~~~
Standard_Boolean ok = reader.Transfer (rank); Standard_Boolean ok = reader.Transfer (rank);
~~~~ ~~~~~
2. Translate an entity identified by its handle with: 2. Translate an entity identified by its handle with:
~~~~{.cpp} ~~~~~
Standard_Boolean ok = reader.TransferEntity (ent); Standard_Boolean ok = reader.TransferEntity (ent);
~~~~ ~~~~~
3. Translate a list of entities in one operation with: 3. Translate a list of entities in one operation with:
~~~~{.cpp} ~~~~~
Standard_Integer nbtrans = reader.TransferList (list); Standard_Integer nbtrans = reader.TransferList (list);
reader.IsDone(); reader.IsDone();
~~~~ ~~~~~
where *nbtrans* returns the number of items in the list that produced a shape and *reader.IsDone()* indicates whether at least one entity was translated. where *nbtrans* returns the number of items in the list that produced a shape and *reader.IsDone()* indicates whether at least one entity was translated.
4. Translate a list of entities, entity by entity: 4. Translate a list of entities, entity by entity:
~~~~{.cpp} ~~~~~
Standard_Integer i,nb = list-Length(); Standard_Integer i,nb = list-Length();
for (i = 1; i <= nb; i ++) { for (i = 1; i <= nb; i ++) {
Handle(Standard_Transient) ent = list-Value(i); Handle(Standard_Transient) ent = list-Value(i);
Standard_Boolean OK = reader.TransferEntity (ent); Standard_Boolean OK = reader.TransferEntity (ent);
} }
~~~~ ~~~~~
5. Translate the whole file (all entities or only visible entities) with: 5. Translate the whole file (all entities or only visible entities) with:
~~~~{.cpp} ~~~~~
Standard_Boolean onlyvisible = Standard_True or Standard_False; Standard_Boolean onlyvisible = Standard_True or Standard_False;
reader.TransferRoots(onlyvisible) reader.TransferRoots(onlyvisible)
~~~~ ~~~~~
@subsubsection occt_iges_2_3_6 Getting the translation results @subsubsection occt_iges_2_3_6 Getting the translation results
Each successful translation operation outputs one shape. A series of translations gives a series of shapes. Each successful translation operation outputs one shape. A series of translations gives a series of shapes.
Each time you invoke *TransferEntity, Transfer* or *Transferlist*, their results are accumulated and NbShapes increases. You can clear the results (Clear function) between two translation operations, if you do not do this, the results from the next translation will be added to the accumulation. *TransferRoots* operations automatically clear all existing results before they start. Each time you invoke *TransferEntity, Transfer* or *Transferlist*, their results are accumulated and NbShapes increases. You can clear the results (Clear function) between two translation operations, if you do not do this, the results from the next translation will be added to the accumulation. *TransferRoots* operations automatically clear all existing results before they start.
~~~~{.cpp} ~~~~~
Standard_Integer nbs = reader.NbShapes(); Standard_Integer nbs = reader.NbShapes();
~~~~ ~~~~~
returns the number of shapes recorded in the result. returns the number of shapes recorded in the result.
~~~~{.cpp} ~~~~~
TopoDS_Shape shape = reader.Shape(num);, TopoDS_Shape shape = reader.Shape(num);,
~~~~ ~~~~~
returns the result *num*, where *num* is an integer between 1 and *NbShapes*. returns the result *num*, where *num* is an integer between 1 and *NbShapes*.
~~~~{.cpp} ~~~~~
TopoDS_Shape shape = reader.Shape(); TopoDS_Shape shape = reader.Shape();
~~~~ ~~~~~
returns the first result in a translation operation. returns the first result in a translation operation.
~~~~{.cpp} ~~~~~
TopoDS_Shape shape = reader.OneShape(); TopoDS_Shape shape = reader.OneShape();
~~~~ ~~~~~
returns all results in a single shape which is: returns all results in a single shape which is:
* a null shape if there are no results, * a null shape if there are no results,
* in case of a single result, a shape that is specific to that result, * in case of a single result, a shape that is specific to that result,
* a compound that lists the results if there are several results. * a compound that lists the results if there are several results.
~~~~{.cpp} ~~~~~
reader.Clear(); reader.Clear();
~~~~ ~~~~~
erases the existing results. erases the existing results.
~~~~{.cpp} ~~~~~
reader.PrintTransferInfo (failsonly, mode); reader.PrintTransferInfo (failsonly, mode);
~~~~ ~~~~~
displays the messages that appeared during the last invocation of *Transfer* or *TransferRoots*. displays the messages that appeared during the last invocation of *Transfer* or *TransferRoots*.
If *failsonly* is *IFSelect_FailOnly*, only fail messages will be output, if it is *IFSelect_FailAndWarn*, all messages will be output. Parameter “mode” can have *IFSelect_xxx* values where *xxx* can be: If *failsonly* is *IFSelect_FailOnly*, only fail messages will be output, if it is *IFSelect_FailAndWarn*, all messages will be output. Parameter “mode” can have *IFSelect_xxx* values where *xxx* can be:
@@ -492,25 +490,25 @@ If a *TopoDS_Face* is output, its geometrical support is a *Geom_Surface* and i
@subsection occt_iges_2_5 Messages @subsection occt_iges_2_5 Messages
Messages are displayed concerning the normal functioning of the processor (transfer, loading, etc.). Messages are displayed concerning the normal functioning of the processor (transfer, loading, etc.).
You must declare an include file: You must declare an include file:
~~~~{.cpp} ~~~~~
#include \<Interface_DT.hxx\> #include \<Interface_DT.hxx\>
~~~~ ~~~~~
You have the choice of the following options for messages: You have the choice of the following options for messages:
~~~~{.cpp} ~~~~~
IDT_SetLevel (level); IDT_SetLevel (level);
~~~~ ~~~~~
level modifies the level of messages: level modifies the level of messages:
* 0: no messages * 0: no messages
* 1: raise and fail messages are displayed, as are messages concerning file access, * 1: raise and fail messages are displayed, as are messages concerning file access,
* 2: warnings are also displayed. * 2: warnings are also displayed.
~~~~{.cpp} ~~~~~
IDT_SetFile (“tracefile.log”); IDT_SetFile (“tracefile.log”);
~~~~ ~~~~~
prints the messages in a file, prints the messages in a file,
~~~~{.cpp} ~~~~~
IDT_SetStandard(); IDT_SetStandard();
~~~~ ~~~~~
restores screen output. restores screen output.
@subsection occt_iges_2_6 Tolerance management @subsection occt_iges_2_6 Tolerance management
@@ -607,7 +605,7 @@ The highlighted classes produce OCCT geometry.
@subsection occt_iges_2_8 Example @subsection occt_iges_2_8 Example
~~~~{.cpp} ~~~~~
#include “IGESControl_Reader.hxx” #include “IGESControl_Reader.hxx”
#include “TColStd_HSequenceOfTransient.hxx” #include “TColStd_HSequenceOfTransient.hxx”
#include “TopoDS_Shape.hxx” #include “TopoDS_Shape.hxx”
@@ -629,7 +627,7 @@ cout<<"IGES Faces: "<<nIgesFaces<<" Transferred:"<<nTransFaces<<endl;
TopoDS_Shape sh = myIgesReader.OneShape(); TopoDS_Shape sh = myIgesReader.OneShape();
//and obtains the results in an OCCT shape. //and obtains the results in an OCCT shape.
} }
~~~~ ~~~~~
@section occt_iges_3 Writing IGES @section occt_iges_3 Writing IGES
@subsection occt_iges_3_1 Procedure @subsection occt_iges_3_1 Procedure
@@ -667,13 +665,13 @@ The following parameters are used for the OCCT-to-IGES translation.
* "Faces" (0): OCCT *TopoDS_Faces* will be translated into IGES 144 (Trimmed Surface) entities, no BRep entities will be written to the IGES file, * "Faces" (0): OCCT *TopoDS_Faces* will be translated into IGES 144 (Trimmed Surface) entities, no BRep entities will be written to the IGES file,
* "BRep" (1): OCCT *TopoDS_Faces* will be translated into IGES 510 (Face) entities, the IGES file will contain BRep entities. * "BRep" (1): OCCT *TopoDS_Faces* will be translated into IGES 510 (Face) entities, the IGES file will contain BRep entities.
Read this parameter with: Read this parameter with:
~~~~{.cpp} ~~~~~
Standard_Integer byvalue = Interface_Static::IVal("write.iges.brep.mode"); Standard_Integer byvalue = Interface_Static::IVal("write.iges.brep.mode");
~~~~ ~~~~~
Modify this parameter with: Modify this parameter with:
~~~~{.cpp} ~~~~~
Interface_Static::SetIVal ("write.iges.brep.mode", 1); Interface_Static::SetIVal ("write.iges.brep.mode", 1);
~~~~ ~~~~~
Default value is "Faces" (0). Default value is "Faces" (0).
* *write.convertsurface.mode* when writing to IGES in the BRep mode, this parameter indicates whether elementary surfaces (cylindrical, conical, spherical, and toroidal) are converted into corresponding IGES 5.3 entities (if the value of a parameter value is On), or written as surfaces of revolution (by default). * *write.convertsurface.mode* when writing to IGES in the BRep mode, this parameter indicates whether elementary surfaces (cylindrical, conical, spherical, and toroidal) are converted into corresponding IGES 5.3 entities (if the value of a parameter value is On), or written as surfaces of revolution (by default).
* *write.iges.unit:* allows choosing the unit. The default unit for Open CASCADE Technology is "MM" (millimeter). You can choose to write a file into any unit accepted by IGES. * *write.iges.unit:* allows choosing the unit. The default unit for Open CASCADE Technology is "MM" (millimeter). You can choose to write a file into any unit accepted by IGES.
@@ -702,46 +700,46 @@ Default value is "Faces" (0).
* *write.precision.val:* is the user precision value. This parameter gives the resolution value for an IGES file when the *write.precision.mode* parameter value is 1. It is equal to 0.0001 by default, but can take any real positive (non null) value. * *write.precision.val:* is the user precision value. This parameter gives the resolution value for an IGES file when the *write.precision.mode* parameter value is 1. It is equal to 0.0001 by default, but can take any real positive (non null) value.
Read this parameter with: Read this parameter with:
~~~~{.cpp} ~~~~~
Standard_Real rp = Interface_Static::RVal(;write.precision.val;); Standard_Real rp = Interface_Static::RVal(;write.precision.val;);
~~~~ ~~~~~
Modify this parameter with: Modify this parameter with:
~~~~{.cpp} ~~~~~
if (!Interface_Static::SetRVal(;write.precision.val;,0.01)) if (!Interface_Static::SetRVal(;write.precision.val;,0.01))
.. error .. .. error ..
~~~~ ~~~~~
Default value is 0.0001. Default value is 0.0001.
<h4>write.iges.resource.name</h4> and <h4>write.iges.sequence</h4> are the same as the corresponding read.iges.\* parameters. Note that the default sequence for writing contains *DirectFaces* operator, which converts elementary surfaces based on left-hand axes (valid in CASCADE) to right-hand axes (which are valid only in IGES). <h4>write.iges.resource.name</h4> and <h4>write.iges.sequence</h4> are the same as the corresponding read.iges.\* parameters. Note that the default sequence for writing contains *DirectFaces* operator, which converts elementary surfaces based on left-hand axes (valid in CASCADE) to right-hand axes (which are valid only in IGES).
Default values : Default values :
~~~~{.cpp} ~~~~~
write.iges.resource.name - IGES, write.iges.resource.name - IGES,
write.iges.sequence - ToIGES. write.iges.sequence - ToIGES.
~~~~ ~~~~~
@subsubsection occt_iges_3_3_3 Performing the Open CASCADE Technology shape translation @subsubsection occt_iges_3_3_3 Performing the Open CASCADE Technology shape translation
You can perform the translation in one or several operations. Here is how you translate topological and geometrical objects: You can perform the translation in one or several operations. Here is how you translate topological and geometrical objects:
~~~~{.cpp} ~~~~~
Standard_Boolean ok = writer.AddShape (TopoDS_Shape); Standard_Boolean ok = writer.AddShape (TopoDS_Shape);
~~~~ ~~~~~
*ok* is True if translation was correctly performed and False if there was at least one entity that was not translated. *ok* is True if translation was correctly performed and False if there was at least one entity that was not translated.
~~~~{.cpp} ~~~~~
Standard_Boolean ok = writer.AddGeom (geom); Standard_Boolean ok = writer.AddGeom (geom);
~~~~ ~~~~~
where *geom* is *Handle(Geom_Curve)* or *Handle(Geom_Surface)*; where *geom* is *Handle(Geom_Curve)* or *Handle(Geom_Surface)*;
*ok* is True if the translation was correctly performed and False if there was at least one entity whose geometry was not among the allowed types. *ok* is True if the translation was correctly performed and False if there was at least one entity whose geometry was not among the allowed types.
@subsubsection occt_iges_3_3_4 Writing the IGES file @subsubsection occt_iges_3_3_4 Writing the IGES file
Write the IGES file with: Write the IGES file with:
~~~~{.cpp} ~~~~~
Standard_Boolean ok = writer.Write ("filename.igs"); Standard_Boolean ok = writer.Write ("filename.igs");
~~~~ ~~~~~
to give the file name. to give the file name.
~~~~{.cpp} ~~~~~
Standard_Boolean ok = writer.Write (S); Standard_Boolean ok = writer.Write (S);
~~~~ ~~~~~
where *S* is *Standard_OStream* where *S* is *Standard_OStream*
*ok* is True if the operation was correctly performed and False if an error occurred (for instance, if the processor could not create the file). *ok* is True if the operation was correctly performed and False if an error occurred (for instance, if the processor could not create the file).
@@ -825,7 +823,7 @@ The highlighted classes are intended to translate geometry.
@subsection occt_iges_3_7 Example @subsection occt_iges_3_7 Example
~~~~{.cpp} ~~~~~{c++}
#include <IGESControl_Controller.hxx> #include <IGESControl_Controller.hxx>
#include <IGESControl_Writer.hxx> #include <IGESControl_Writer.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
@@ -841,7 +839,7 @@ Standard_Integer main()
Standard_Boolean OK = ICW.Write (;MyFile.igs;); Standard_Boolean OK = ICW.Write (;MyFile.igs;);
//writes a model to the file MyFile.igs //writes a model to the file MyFile.igs
} }
~~~~ ~~~~~
@section occt_iges_4 Using XSTEPDRAW @section occt_iges_4 Using XSTEPDRAW
@@ -854,7 +852,7 @@ In the description of commands, square brackets ([]) are used to indicate optio
A set of parameters for importing and exporting IGES files is defined in the XSTEP resource file. In XSTEPDRAW, these parameters can be viewed or changed using command A set of parameters for importing and exporting IGES files is defined in the XSTEP resource file. In XSTEPDRAW, these parameters can be viewed or changed using command
~~~~{.php} ~~~~
Draw> param [<parameter_name> [<value>]] Draw> param [<parameter_name> [<value>]]
~~~~ ~~~~
@@ -885,15 +883,15 @@ These parameters are set by command *param* :
It is possible either only to load an IGES file into memory (i.e. to fill the model with data from the file), or to read it (i.e. to load and convert all entities to OCCT shapes). It is possible either only to load an IGES file into memory (i.e. to fill the model with data from the file), or to read it (i.e. to load and convert all entities to OCCT shapes).
Loading is done by the command Loading is done by the command
~~~~{.php} ~~~~~
Draw> xload <file_name> Draw> xload <file_name>
~~~~ ~~~~~
Once the file is loaded, it is possible to investigate the structure of the loaded data. To learn how to do it see @ref occt_iges_4_4 "Analyzing the transferred". Once the file is loaded, it is possible to investigate the structure of the loaded data. To learn how to do it see @ref occt_iges_4_4 "Analyzing the transferred".
Reading of an IGES file is done by the command Reading of an IGES file is done by the command
~~~~{.php} ~~~~~
Draw> igesbrep <file_name> <result_shape_name> [<selection>] Draw> igesbrep <file_name> <result_shape_name> [<selection>]
~~~~ ~~~~~
Here a dot can be used instead of a filename if the file is already loaded by *xload* or *igesbrep* command. In that case, only conversion of IGES entities to OCCT shapes will be done. Here a dot can be used instead of a filename if the file is already loaded by *xload* or *igesbrep* command. In that case, only conversion of IGES entities to OCCT shapes will be done.
Command *igesbrep* will interactively ask the user to select a set of entities to be converted: Command *igesbrep* will interactively ask the user to select a set of entities to be converted:
@@ -914,13 +912,13 @@ The second parameter of the *igesbrep* command defines the name of the loaded s
Instead of *igesbrep* it is possible to use commands: Instead of *igesbrep* it is possible to use commands:
~~~~{.php} ~~~~~
Draw> trimport <file_name> <result_shape_name> <selection> Draw> trimport <file_name> <result_shape_name> <selection>
~~~~ ~~~~~
which outputs the result of translation of each selected entity into one shape, or which outputs the result of translation of each selected entity into one shape, or
~~~~{.php} ~~~~~
Draw> trimpcomp <file_name> <result_shape_name> <selection> Draw> trimpcomp <file_name> <result_shape_name> <selection>
~~~~ ~~~~~
which outputs the result of translation of all selected entities into one shape (*TopoDS_Compound* for several entities). which outputs the result of translation of all selected entities into one shape (*TopoDS_Compound* for several entities).
An asterisk “*” can be specified instead of *selection*, it means *xst-transferrable-roots*. An asterisk “*” can be specified instead of *selection*, it means *xst-transferrable-roots*.
@@ -942,9 +940,9 @@ The procedure of analysis of the data import can be divided into two stages:
@subsubsection occt_iges_4_4_1 Checking file contents @subsubsection occt_iges_4_4_1 Checking file contents
General statistics on the loaded data can be obtained by using command General statistics on the loaded data can be obtained by using command
~~~~{.php} ~~~~~
Draw> data <symbol> Draw> data <symbol>
~~~~ ~~~~~
The information printed by this command depends on the symbol specified: The information printed by this command depends on the symbol specified:
| Symbol | Output | | Symbol | Output |
@@ -965,18 +963,18 @@ There is a set of special objects, which can be used to operate with the loaded
A list of these objects defined in the current session can be printed in DRAW by command A list of these objects defined in the current session can be printed in DRAW by command
~~~~{.php} ~~~~~
Draw> listitems Draw> listitems
~~~~ ~~~~~
In the following commands if several <i>\<selection\></i> arguments are specified the results of each following selection are applied to the results of the previous one. In the following commands if several <i>\<selection\></i> arguments are specified the results of each following selection are applied to the results of the previous one.
~~~~{.php} ~~~~~
Draw> givelist <selection_name> [<selection_name>] Draw> givelist <selection_name> [<selection_name>]
~~~~ ~~~~~
prints a list of loaded entities defined by selection argument. prints a list of loaded entities defined by selection argument.
~~~~{.php} ~~~~~
Draw> givecount <selection_name> [<selection_name>] Draw> givecount <selection_name> [<selection_name>]
~~~~ ~~~~~
prints a number of loaded entities defined by <i>selection</i> argument. prints a number of loaded entities defined by <i>selection</i> argument.
Three commands are used to calculate statistics on the entities in the model: Three commands are used to calculate statistics on the entities in the model:
@@ -993,9 +991,9 @@ Optional <i>\<selection\></i> argument, if specified, defines a subset of entiti
| iges-levels | Calculates how much entities lie in different IGES levels | | iges-levels | Calculates how much entities lie in different IGES levels |
The command: The command:
~~~~{.php} ~~~~~
Draw> listtypes <selection_name> ... Draw> listtypes <selection_name> ...
~~~~ ~~~~~
gives a list of entity types which were encountered in the last loaded file (with a number of IGES entities of each type). The list can be shown not for all entities but for a subset of them. This subset is defined by an optional selection argument. gives a list of entity types which were encountered in the last loaded file (with a number of IGES entities of each type). The list can be shown not for all entities but for a subset of them. This subset is defined by an optional selection argument.
Entities in the IGES file are numbered in the succeeding order. An entity can be identified either by its number (#) or by its label. Label is the letter D followed by the index of the first line with the data for this entity in the Directory Entry section of the IGES file. The label can be calculated on the basis of the number as D(2*# -1). For example, entity # 6 has label D11. Entities in the IGES file are numbered in the succeeding order. An entity can be identified either by its number (#) or by its label. Label is the letter D followed by the index of the first line with the data for this entity in the Directory Entry section of the IGES file. The label can be calculated on the basis of the number as D(2*# -1). For example, entity # 6 has label D11.
@@ -1008,9 +1006,9 @@ Entities in the IGES file are numbered in the succeeding order. An entity can b
@subsubsection occt_iges_4_4_2 Estimating the results of reading IGES @subsubsection occt_iges_4_4_2 Estimating the results of reading IGES
All of the following commands are available only after the data are converted into OCCT shapes (i.e. after command **igesbrep**). All of the following commands are available only after the data are converted into OCCT shapes (i.e. after command **igesbrep**).
~~~~{.php} ~~~~~
Draw> tpstat [*|?]<symbol> [<selection>] Draw> tpstat [*|?]<symbol> [<selection>]
~~~~ ~~~~~
provides all statistics on the last transfer, including the list of transferred entities with mapping from IGES to OCCT types, as well as fail and warning messages. The parameter <i>\<symbol\></i> defines what information will be printed: provides all statistics on the last transfer, including the list of transferred entities with mapping from IGES to OCCT types, as well as fail and warning messages. The parameter <i>\<symbol\></i> defines what information will be printed:
* G -- General statistics (list of results and messages) * G -- General statistics (list of results and messages)
* C -- Count of all warning and fail messages * C -- Count of all warning and fail messages
@@ -1030,13 +1028,13 @@ Optional argument <i>\<selection\></i> can limit the action of the command with
To get help, run this command without arguments. To get help, run this command without arguments.
For example, to get translation ratio on IGES faces, you can use. For example, to get translation ratio on IGES faces, you can use.
~~~~{.php} ~~~~~
Draw:> tpstat *l iges-faces Draw:> tpstat *l iges-faces
~~~~ ~~~~~
The second version of the same command is TPSTAT (not capital spelling). The second version of the same command is TPSTAT (not capital spelling).
~~~~{.php} ~~~~~
Draw:> TPSTAT <symbol> Draw:> TPSTAT <symbol>
~~~~ ~~~~~
Symbol can be of the following values: Symbol can be of the following values:
* g -- General statistics (list of results and messages) * g -- General statistics (list of results and messages)
* c -- Count of all warning and fail messages * c -- Count of all warning and fail messages
@@ -1047,37 +1045,37 @@ Symbol can be of the following values:
Sometimes the trimming contours of IGES faces (i.e., entity 141 for 143, 142 for 144) can be lost during translation due to fails. Sometimes the trimming contours of IGES faces (i.e., entity 141 for 143, 142 for 144) can be lost during translation due to fails.
The number of lost trims and the corresponding IGES entities can be obtained by the command: The number of lost trims and the corresponding IGES entities can be obtained by the command:
~~~~{.php} ~~~~~
Draw> tplosttrim [<IGES_type>] Draw> tplosttrim [<IGES_type>]
~~~~ ~~~~~
It outputs the rank and DE numbers of faces that lost their trims and their numbers for each type (143, 144, 510) and their total number. If a face lost several of its trims it is output only once. It outputs the rank and DE numbers of faces that lost their trims and their numbers for each type (143, 144, 510) and their total number. If a face lost several of its trims it is output only once.
Optional parameter <i>\<IGES_type\></i> can be *TrimmedSurface, BoundedSurface* or *Face* to specify the only type of IGES faces. Optional parameter <i>\<IGES_type\></i> can be *TrimmedSurface, BoundedSurface* or *Face* to specify the only type of IGES faces.
For example, to get untrimmed 144 entities, use command For example, to get untrimmed 144 entities, use command
~~~~{.php} ~~~~~
Draw> tplosttrim TrimmedSurface Draw> tplosttrim TrimmedSurface
~~~~ ~~~~~
To get the information on OCCT shape contents, use command To get the information on OCCT shape contents, use command
~~~~{.php} ~~~~~
Draw> statshape <shape_name> Draw> statshape <shape_name>
~~~~ ~~~~~
It outputs the number of each kind of shapes (vertex, edge, wire, etc.) in a shape and some geometrical data (number of C0 surfaces, curves, indirect surfaces, etc.). It outputs the number of each kind of shapes (vertex, edge, wire, etc.) in a shape and some geometrical data (number of C0 surfaces, curves, indirect surfaces, etc.).
Note. The number of faces is returned as a number of references. To obtain the number of single instances the standard command (from TTOPOLOGY executable) **nbshapes** can be used. Note. The number of faces is returned as a number of references. To obtain the number of single instances the standard command (from TTOPOLOGY executable) **nbshapes** can be used.
To analyze the internal validity of a shape, use command To analyze the internal validity of a shape, use command
~~~~{.php} ~~~~~
Draw> checkbrep <shape_name> <expurged_shape_name> Draw> checkbrep <shape_name> <expurged_shape_name>
~~~~ ~~~~~
It checks the geometry and topology of a shape for different cases of inconsistency, like self-intersecting wires or wrong orientation of trimming contours. If an error is found, it copies bad parts of the shape with the names "expurged_subshape_name _#" and generates an appropriate message. If possible, this command also tries to find IGES entities the OCCT shape was produced from. It checks the geometry and topology of a shape for different cases of inconsistency, like self-intersecting wires or wrong orientation of trimming contours. If an error is found, it copies bad parts of the shape with the names "expurged_subshape_name _#" and generates an appropriate message. If possible, this command also tries to find IGES entities the OCCT shape was produced from.
<i>\<expurged_shape_name\></i> will contain the original shape without invalid subshapes. <i>\<expurged_shape_name\></i> will contain the original shape without invalid subshapes.
To get information on tolerances of subshapes, use command To get information on tolerances of subshapes, use command
~~~~{.php} ~~~~~
Draw> tolerance <shape_name> [<min> [<max>] [<symbol>]] Draw> tolerance <shape_name> [<min> [<max>] [<symbol>]]
~~~~ ~~~~~
It outputs maximum, average and minimum values of tolerances for each kind of subshapes having tolerances or it can output tolerances of all subshapes of the whole shape. It outputs maximum, average and minimum values of tolerances for each kind of subshapes having tolerances or it can output tolerances of all subshapes of the whole shape.
When specifying *min* and *max* arguments this command outputs shapes with names <i>\<shape_name\>...</i> and their total number with tolerances in the range <i>[min, max]</i>. When specifying *min* and *max* arguments this command outputs shapes with names <i>\<shape_name\>...</i> and their total number with tolerances in the range <i>[min, max]</i>.
@@ -1101,19 +1099,19 @@ Refer to @ref occt_iges_3_3_2 "Setting the translation parameters" for a descrip
| Measurement units | XSTEP.iges.unit | 1-11 (or a string value) | | Measurement units | XSTEP.iges.unit | 1-11 (or a string value) |
Several shapes can be written in one file. To start writing a new file, enter command Several shapes can be written in one file. To start writing a new file, enter command
~~~~{.php} ~~~~~
Draw> newmodel Draw> newmodel
~~~~ ~~~~~
This command clears the *InterfaceModel* to make it empty. This command clears the *InterfaceModel* to make it empty.
~~~~{.php} ~~~~~
Draw> brepiges <shape_name_1> [<filename.igs>] Draw> brepiges <shape_name_1> [<filename.igs>]
~~~~ ~~~~~
Converts the specified shapes into IGES entities and puts them into the *InterfaceModel*. Converts the specified shapes into IGES entities and puts them into the *InterfaceModel*.
~~~~{.php} ~~~~~
Draw> writeall <filename.igs> Draw> writeall <filename.igs>
~~~~ ~~~~~
Allows writing the prepared model to a file with name *filename.igs*. Allows writing the prepared model to a file with name *filename.igs*.
@section occt_iges_5 Reading from and writing to IGES @section occt_iges_5 Reading from and writing to IGES
@@ -1123,10 +1121,10 @@ Allows writing the prepared model to a file with name *filename.igs*.
### Load an IGES file ### Load an IGES file
Before performing any other operation, you must load an IGES file with: Before performing any other operation, you must load an IGES file with:
~~~~{.cpp} ~~~~~
IGESCAFControl_Reader reader(XSDRAW::Session(), Standard_False); IGESCAFControl_Reader reader(XSDRAW::Session(), Standard_False);
IFSelect_ReturnStatus stat = reader.ReadFile(“filename.igs”); IFSelect_ReturnStatus stat = reader.ReadFile(“filename.igs”);
~~~~ ~~~~~
Loading the file only memorizes, but does not translate the data. Loading the file only memorizes, but does not translate the data.
### Check the loaded IGES file ### Check the loaded IGES file
@@ -1139,64 +1137,64 @@ See the description of @ref occt_iges_2_3_3 "Setting translation parameters" abo
In addition, the following parameters can be set for XDE translation of attributes: In addition, the following parameters can be set for XDE translation of attributes:
* For transferring colors: * For transferring colors:
~~~~{.cpp} ~~~~~
reader.SetColorMode(mode); reader.SetColorMode(mode);
// mode can be Standard_True or Standard_False // mode can be Standard_True or Standard_False
~~~~ ~~~~~
* For transferring names: * For transferring names:
~~~~{.cpp} ~~~~~
reader.SetNameMode(mode); reader.SetNameMode(mode);
// mode can be Standard_True or Standard_False // mode can be Standard_True or Standard_False
~~~~ ~~~~~
### Translate an IGES file to XDE ### Translate an IGES file to XDE
The following function performs a translation of the whole document: The following function performs a translation of the whole document:
~~~~{.cpp} ~~~~~
Standard_Boolean ok = reader.Transfer(doc); Standard_Boolean ok = reader.Transfer(doc);
~~~~ ~~~~~
where *doc* is a variable which contains a handle to the output document and should have a type *Handle(TDocStd_Document)*. where *doc* is a variable which contains a handle to the output document and should have a type *Handle(TDocStd_Document)*.
@subsection occt_iges_5_2 Writing to IGES @subsection occt_iges_5_2 Writing to IGES
The translation from XDE to IGES can be initialized as follows: The translation from XDE to IGES can be initialized as follows:
~~~~{.cpp} ~~~~~
IGESCAFControl_Writer aWriter(XSDRAW::Session(),Standard_False); IGESCAFControl_Writer aWriter(XSDRAW::Session(),Standard_False);
~~~~ ~~~~~
### Set parameters for translation from XDE to IGES ### Set parameters for translation from XDE to IGES
The following parameters can be set for translation of attributes to IGES: The following parameters can be set for translation of attributes to IGES:
* For transferring colors: * For transferring colors:
~~~~{.cpp} ~~~~~
aWriter.SetColorMode(mode); aWriter.SetColorMode(mode);
// mode can be Standard_True or Standard_False // mode can be Standard_True or Standard_False
~~~~ ~~~~~
* For transferring names: * For transferring names:
~~~~{.cpp} ~~~~~
aWriter.SetNameMode(mode); aWriter.SetNameMode(mode);
// mode can be Standard_True or Standard_False // mode can be Standard_True or Standard_False
~~~~ ~~~~~
### Translate an XDE document to IGES ### Translate an XDE document to IGES
You can perform the translation of a document by calling the function: You can perform the translation of a document by calling the function:
~~~~{.cpp} ~~~~~
IFSelect_ReturnStatus aRetSt = aWriter.Transfer(doc); IFSelect_ReturnStatus aRetSt = aWriter.Transfer(doc);
~~~~ ~~~~~
where "doc" is a variable which contains a handle to the input document for transferring and should have a type *Handle(TDocStd_Document)*. where "doc" is a variable which contains a handle to the input document for transferring and should have a type *Handle(TDocStd_Document)*.
### Write an IGES file ### Write an IGES file
Write an IGES file with: Write an IGES file with:
~~~~{.cpp} ~~~~~
IFSelect_ReturnStatus statw = aWriter.WriteFile("filename.igs"); IFSelect_ReturnStatus statw = aWriter.WriteFile("filename.igs");
~~~~ ~~~~~
or or
~~~~{.cpp} ~~~~~
IFSelect_ReturnStatus statw = writer.WriteFile (S); IFSelect_ReturnStatus statw = writer.WriteFile (S);
~~~~ ~~~~~
where S is OStream. where S is OStream.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

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