Compare commits
99 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b079fb9877 | ||
|
608fba03ab | ||
|
a626c346b4 | ||
|
1955914e73 | ||
|
a3e117be2c | ||
|
459e7b77ab | ||
|
2fc4884b88 | ||
|
1f02c1903a | ||
|
6ecfaf3ab6 | ||
|
89ecea11d2 | ||
|
c4e1d8c918 | ||
|
b776f4ee07 | ||
|
90e61140aa | ||
|
19a49b8e74 | ||
|
fd29020f87 | ||
|
c4ca00a26f | ||
|
507ead3c5a | ||
|
77003e1894 | ||
|
4931fcd8a9 | ||
|
1c96596ae7 | ||
|
bb368e271e | ||
|
04ecb233f2 | ||
|
dbfb0666b2 | ||
|
c74b60ab81 | ||
|
3d41db2138 | ||
|
43764346a1 | ||
|
3c61e8f7e0 | ||
|
da9cb57f57 | ||
|
60490a5c19 | ||
|
2b5fcf89b2 | ||
|
99ee8eb9d3 | ||
|
b9a5469aa1 | ||
|
c004c09c9e | ||
|
f15afeb84b | ||
|
488b78ed3c | ||
|
6faa1bd160 | ||
|
00be1552ed | ||
|
a2bacd54f4 | ||
|
d2abb6d844 | ||
|
e697b85307 | ||
|
9967602647 | ||
|
e1a92d9ef0 | ||
|
730b9ecc2d | ||
|
336e2cdeda | ||
|
e5021ff47f | ||
|
9735948819 | ||
|
660a8938a3 | ||
|
642ddd1253 | ||
|
03fc07c28b | ||
|
2e84f455db | ||
|
2d7f390051 | ||
|
80ffc5f84d | ||
|
d1069cad4b | ||
|
0c4931e873 | ||
|
3ea347e562 | ||
|
510d099d15 | ||
|
5bd54bef32 | ||
|
4f7ad5fb76 | ||
|
f706c128c2 | ||
|
209ae313a5 | ||
|
81f57d1135 | ||
|
9923f08703 | ||
|
5b756182c2 | ||
|
5f69cfa70c | ||
|
19da974edc | ||
|
bcb2a742a7 | ||
|
005caf39cf | ||
|
2c8c4b8086 | ||
|
7e63845c9e | ||
|
f8d8c3f2bc | ||
|
4e61131a1c | ||
|
4e2151f654 | ||
|
475da0f135 | ||
|
538700ffa2 | ||
|
eb78d737d4 | ||
|
c1638a8db8 | ||
|
0c9c466e9d | ||
|
16f9b46dbb | ||
|
34043fc845 | ||
|
56b495d93b | ||
|
96b92906de | ||
|
f1c209dc77 | ||
|
f9ae10ed21 | ||
|
956d91571c | ||
|
c2064b60e7 | ||
|
eba0379cde | ||
|
41fc11b056 | ||
|
0f05f21194 | ||
|
7d5e26eb2e | ||
|
5c38397303 | ||
|
ca65b1ae37 | ||
|
b4871a3b12 | ||
|
ff60d28357 | ||
|
307fef1dcd | ||
|
95c380d252 | ||
|
f277dcbbc0 | ||
|
af0cb16691 | ||
|
f72c595119 | ||
|
3e9cb80644 |
@@ -661,8 +661,10 @@ endif()
|
||||
if (CAN_USE_GLES2)
|
||||
if (USE_GLES2)
|
||||
add_definitions (-DHAVE_GLES2_EXT)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
|
||||
if (NOT IOS)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
|
||||
endif()
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2")
|
||||
|
@@ -63,30 +63,45 @@ set SYS_VC_LIST {}
|
||||
set SYS_VCVARS_LIST {}
|
||||
|
||||
# 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] } {
|
||||
if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] && "$res" != "" } {
|
||||
lappend ::SYS_VS_LIST "Visual Studio 2017 (15, toolset v141)"
|
||||
lappend ::SYS_VC_LIST "vc141"
|
||||
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
|
||||
lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
|
||||
}
|
||||
if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] } {
|
||||
if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] && "$res" != "" } {
|
||||
lappend ::SYS_VS_LIST "Visual Studio 2017 (15, toolset v141) UWP"
|
||||
lappend ::SYS_VC_LIST "vc141-uwp"
|
||||
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
|
||||
lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
|
||||
}
|
||||
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] } {
|
||||
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] && "$res" != "" } {
|
||||
lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset v142)"
|
||||
lappend ::SYS_VC_LIST "vc142"
|
||||
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
|
||||
lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
|
||||
}
|
||||
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] } {
|
||||
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] && "$res" != "" } {
|
||||
lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset v142) UWP"
|
||||
lappend ::SYS_VC_LIST "vc142-uwp"
|
||||
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
|
||||
lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
|
||||
}
|
||||
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Component.VC.ClangCL -property installationPath} res] } {
|
||||
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Component.VC.ClangCL -property installationPath} res] && "$res" != "" } {
|
||||
lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset ClangCL)"
|
||||
lappend ::SYS_VC_LIST "vclang"
|
||||
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
|
||||
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.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
|
||||
@@ -175,6 +190,16 @@ proc wokdep:gui:SwitchArch {} {
|
||||
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 {} {
|
||||
set anIncErrs {}
|
||||
set anLib32Errs {}
|
||||
@@ -251,16 +276,18 @@ proc wokdep:gui:UpdateList {} {
|
||||
wokdep:SearchJDK anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
|
||||
}
|
||||
|
||||
.myFrame.myIncErrLbl configure -text [join $anIncErrs "\n"]
|
||||
.myFrame.myLib32_ErrLbl configure -text [join $anLib32Errs "\n"]
|
||||
.myFrame.myLib64_ErrLbl configure -text [join $anLib64Errs "\n"]
|
||||
.myFrame.myBin32_ErrLbl configure -text [join $anBin32Errs "\n"]
|
||||
.myFrame.myBin64_ErrLbl configure -text [join $anBin64Errs "\n"]
|
||||
wokdep:gui:SetLabelText .myFrame.myIncErrLbl [join $anIncErrs "\n"]
|
||||
|
||||
.myFrame.myLib32D_ErrLbl configure -text [join $anLib32Errs "\n"]
|
||||
.myFrame.myLib64D_ErrLbl configure -text [join $anLib64Errs "\n"]
|
||||
.myFrame.myBin32D_ErrLbl configure -text [join $anBin32Errs "\n"]
|
||||
.myFrame.myBin64D_ErrLbl configure -text [join $anBin64Errs "\n"]
|
||||
wokdep:gui:SetLabelText .myFrame.myIncErrLbl [join $anIncErrs "\n"]
|
||||
wokdep:gui:SetLabelText .myFrame.myLib32_ErrLbl [join $anLib32Errs "\n"]
|
||||
wokdep:gui:SetLabelText .myFrame.myLib64_ErrLbl [join $anLib64Errs "\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]
|
||||
|
@@ -236,9 +236,11 @@ proc gendoc {args} {
|
||||
return -1
|
||||
}
|
||||
} 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
|
||||
}
|
||||
|
||||
if {$args_values(s) != "NULL"} {
|
||||
set SEARCH_MODE $args_values(s)
|
||||
} else {
|
||||
@@ -247,16 +249,16 @@ proc gendoc {args} {
|
||||
}
|
||||
} elseif {$arg_n == "mathjax"} {
|
||||
if { [ lsearch $args_names "pdf" ] != -1 } {
|
||||
set possible_mathjax_loc $args_values(mathjax)
|
||||
if {[file exist [file join $possible_mathjax_loc $mathjax_js_name]]} {
|
||||
set MATHJAX_LOCATION $args_values(mathjax)
|
||||
puts "$MATHJAX_LOCATION"
|
||||
} else {
|
||||
puts "Warning: $mathjax_js_name is not found in $possible_mathjax_loc."
|
||||
puts " MathJax will be used from $MATHJAX_LOCATION"
|
||||
}
|
||||
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)
|
||||
puts "$MATHJAX_LOCATION"
|
||||
} else {
|
||||
puts "Warning: MathJax is not used with pdf and will be ignored."
|
||||
puts "Warning: $mathjax_js_name is not found in $possible_mathjax_loc."
|
||||
puts " MathJax will be used from $MATHJAX_LOCATION"
|
||||
}
|
||||
} else {
|
||||
puts "\nWrong argument: $arg_n"
|
||||
|
@@ -260,7 +260,7 @@ proc genAllResources { theSrcDir } {
|
||||
|
||||
# Wrapper-function to generate VS project files
|
||||
proc genproj {theFormat args} {
|
||||
set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "vclang" "cbp" "xcd" "pro"}
|
||||
set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "vc143" "vclang" "cbp" "xcd" "pro"}
|
||||
set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" }
|
||||
set isHelpRequire false
|
||||
|
||||
@@ -324,6 +324,7 @@ proc genproj {theFormat args} {
|
||||
vc14 - Visual Studio 2015
|
||||
vc141 - Visual Studio 2017
|
||||
vc142 - Visual Studio 2019
|
||||
vc143 - Visual Studio 2022
|
||||
vclang - Visual Studio with ClangCL toolset
|
||||
cbp - CodeBlocks
|
||||
xcd - XCode
|
||||
@@ -560,6 +561,7 @@ proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl theSolution }
|
||||
"vc14" -
|
||||
"vc141" -
|
||||
"vc142" -
|
||||
"vc143" -
|
||||
"vclang" { OS:MKVC $anOutDir $aModules $aTools $theSolution $theFormat $isUWP}
|
||||
"cbp" { OS:MKCBP $anOutDir $aModules $theSolution $thePlatform $theCmpl }
|
||||
"xcd" {
|
||||
@@ -1014,8 +1016,8 @@ proc osutils:vcsolution:header { vcversion } {
|
||||
append var \
|
||||
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \
|
||||
"# Visual Studio 2013\n"
|
||||
} elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141" ||
|
||||
"$vcversion" == "vc142" || "$vcversion" == "vclang" } {
|
||||
} elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141" ||
|
||||
"$vcversion" == "vc142" || "$vcversion" == "vc143" || "$vcversion" == "vclang" } {
|
||||
append var \
|
||||
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \
|
||||
"# Visual Studio 14\n"
|
||||
@@ -1290,6 +1292,9 @@ proc osutils:vcproj:readtemplate {theVcVer isUWP isExec} {
|
||||
} elseif { $theVcVer == "vc142" } {
|
||||
set aVCRTVer "vc14"
|
||||
set aToolset "v142"
|
||||
} elseif { $theVcVer == "vc143" } {
|
||||
set aVCRTVer "vc14"
|
||||
set aToolset "v143"
|
||||
} elseif { $theVcVer == "vclang" } {
|
||||
set aVCRTVer "vc14"
|
||||
set aToolset "ClangCL"
|
||||
|
@@ -38,6 +38,7 @@ rem Optional 3rd-party libraries to enable
|
||||
set "USE_FREETYPE=ON"
|
||||
set "USE_RAPIDJSON=OFF"
|
||||
set "USE_DRACO=OFF"
|
||||
set "USE_PTHREADS=OFF"
|
||||
|
||||
rem Archive tool
|
||||
set "THE_7Z_PARAMS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on"
|
||||
@@ -59,9 +60,14 @@ for /f %%i in ('git symbolic-ref --short HEAD') do ( set "aGitBranch=%%i" )
|
||||
|
||||
set "aBuildType=Release"
|
||||
set "aBuildTypePrefix="
|
||||
set "anExtraCxxFlags="
|
||||
if /I ["%USE_PTHREADS%"] == ["ON"] (
|
||||
set "anExtraCxxFlags=-pthread"
|
||||
set "aBuildTypePrefix=%aBuildTypePrefix%-pthread"
|
||||
)
|
||||
if ["%toDebug%"] == ["1"] (
|
||||
set "aBuildType=Debug"
|
||||
set "aBuildTypePrefix=-debug"
|
||||
set "aBuildTypePrefix=%aBuildTypePrefix%-debug"
|
||||
)
|
||||
|
||||
call :cmakeGenerate
|
||||
@@ -159,6 +165,7 @@ if ["%toCMake%"] == ["1"] (
|
||||
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
|
||||
-D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^
|
||||
-D BUILD_LIBRARY_TYPE:STRING="Static" ^
|
||||
-D CMAKE_CXX_FLAGS="%anExtraCxxFlags%" ^
|
||||
-D INSTALL_DIR:PATH="%aDestDir%" ^
|
||||
-D INSTALL_DIR_INCLUDE:STRING="inc" ^
|
||||
-D INSTALL_DIR_RESOURCE:STRING="src" ^
|
||||
@@ -256,6 +263,7 @@ if ["%toCMake%"] == ["1"] (
|
||||
cmake -G "MinGW Makefiles" ^
|
||||
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
|
||||
-D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^
|
||||
-D CMAKE_CXX_FLAGS="%anExtraCxxFlags%" ^
|
||||
-D CMAKE_INSTALL_PREFIX:PATH="%aDestDirSmpl%" ^
|
||||
-D SOURCE_MAP_BASE:STRING="%sourceMapBase%" ^
|
||||
-D OpenCASCADE_DIR:PATH="%aDestDir%/lib/cmake/opencascade" ^
|
||||
|
@@ -24,5 +24,6 @@ rem set "BUILD_Visualization=ON"
|
||||
rem set "BUILD_ApplicationFramework=ON"
|
||||
rem set "BUILD_DataExchange=ON"
|
||||
|
||||
rem set "USE_RAPIDJSON=OFF"
|
||||
rem set "USE_RAPIDJSON=ON"
|
||||
rem set "USE_DRACO=ON"
|
||||
rem set "USE_PTHREADS=ON"
|
||||
|
@@ -21,6 +21,8 @@ set "toInstall=1"
|
||||
set "toDebug=0"
|
||||
set "sourceMapBase="
|
||||
|
||||
set "USE_PTHREADS=OFF"
|
||||
|
||||
rem Configuration file
|
||||
if exist "%~dp0wasm_custom.bat" call "%~dp0wasm_custom.bat"
|
||||
|
||||
@@ -30,9 +32,14 @@ if not ["%aCmakeBin%"] == [""] ( set "PATH=%aCmakeBin%;%PATH%" )
|
||||
|
||||
set "aBuildType=Release"
|
||||
set "aBuildTypePrefix="
|
||||
set "anExtraCxxFlags="
|
||||
if /I ["%USE_PTHREADS%"] == ["ON"] (
|
||||
set "anExtraCxxFlags=-pthread"
|
||||
set "aBuildTypePrefix=%aBuildTypePrefix%-pthread"
|
||||
)
|
||||
if ["%toDebug%"] == ["1"] (
|
||||
set "aBuildType=Debug"
|
||||
set "aBuildTypePrefix=-debug"
|
||||
set "aBuildTypePrefix=%aBuildTypePrefix%-debug"
|
||||
)
|
||||
|
||||
call :cmakeGenerate
|
||||
@@ -64,6 +71,7 @@ if ["%toCMake%"] == ["1"] (
|
||||
cmake -G "MinGW Makefiles" ^
|
||||
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
|
||||
-D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^
|
||||
-D CMAKE_CXX_FLAGS="%anExtraCxxFlags%" ^
|
||||
-D CMAKE_INSTALL_PREFIX:PATH="%aDestDirSmpl%" ^
|
||||
-D SOURCE_MAP_BASE:STRING="%sourceMapBase%" ^
|
||||
-D OpenCASCADE_DIR:PATH="%aDestDirOcct%/lib/cmake/opencascade" ^
|
||||
|
@@ -121,8 +121,12 @@ if not "%DevEnvDir%" == "" (
|
||||
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
|
||||
set "DevEnvDir=%%i\Common7\IDE\"
|
||||
)
|
||||
) else if /I "%VCFMT%" == "vc143" (
|
||||
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[17.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
|
||||
set "DevEnvDir=%%i\Common7\IDE\"
|
||||
)
|
||||
) else if /I "%VCFMT%" == "vclang" (
|
||||
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,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
|
||||
set "DevEnvDir=%%i\Common7\IDE\"
|
||||
)
|
||||
) else if /I "%VCFMT%" == "gcc" (
|
||||
@@ -137,6 +141,7 @@ if not "%DevEnvDir%" == "" (
|
||||
echo vc14 = VS 2015
|
||||
echo vc141 = VS 2017
|
||||
echo vc142 = VS 2019
|
||||
echo vc143 = VS 2022
|
||||
echo vclang = VS 2019 with ClangCL toolset
|
||||
exit /B
|
||||
)
|
||||
@@ -167,10 +172,15 @@ if /I "%VCFMT%" == "vc9" (
|
||||
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
|
||||
)
|
||||
set "VCPlatformToolSet=v142"
|
||||
) else if /I "%VCFMT%" == "vclang" (
|
||||
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
|
||||
) else if /I "%VCFMT%" == "vc143" (
|
||||
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[17.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
|
||||
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
|
||||
)
|
||||
set "VCPlatformToolSet=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"
|
||||
) else if /I "%VCFMT%" == "gcc" (
|
||||
rem MinGW
|
||||
|
@@ -12,7 +12,9 @@ samples/samples.md
|
||||
../samples/CSharp/ReadMe.md
|
||||
../samples/CSharp/ReadMe_D3D.md
|
||||
../samples/qt/AndroidQt/ReadMe.md
|
||||
../samples/qt/IESample/ReadMe.md
|
||||
../samples/qt/OCCTOverview/ReadMe.md
|
||||
../samples/qt/Tutorial/ReadMe.md
|
||||
../samples/java/jniviewer/ReadMe.md
|
||||
../samples/ios/UIKitSample/ReadMe.md
|
||||
../samples/webgl/ReadMe.md
|
||||
@@ -20,6 +22,7 @@ samples/ocaf.md
|
||||
samples/ocaf_func.md
|
||||
samples/draw_scripts.md
|
||||
|
||||
samples/novice_guide.md
|
||||
tutorial/tutorial.md
|
||||
|
||||
build/build_upgrade.md
|
||||
|
@@ -6,6 +6,8 @@
|
||||
|
||||
tutorial/tutorial.md
|
||||
|
||||
samples/novice_guide.md
|
||||
|
||||
upgrade/upgrade.md
|
||||
|
||||
user_guides/foundation_classes/foundation_classes.md
|
||||
|
@@ -3,29 +3,25 @@ Build OCCT {#build_upgrade__building_occt}
|
||||
|
||||
@tableofcontents
|
||||
|
||||
@note Before building OCCT, make sure to have all required third-party libraries installed.
|
||||
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 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.
|
||||
On OS X we recommend to use native libraries.
|
||||
|
||||
@section build_occt_windows Windows
|
||||
The easiest way to install third-party libraries is to download archive with pre-built binaries, corresponding to your target configuration,
|
||||
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.
|
||||
|
||||
@subsection build_occt_win_cmake Building with CMake tool
|
||||
On Linux and macOS we recommend to use libraries maintained by distributive developers, when possible.
|
||||
|
||||
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*.
|
||||
@section build_occt_win_cmake Building with CMake tool
|
||||
|
||||
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 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
|
||||
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.
|
||||
OCCT requires CMake version 2.8.12 or later.
|
||||
|
||||
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).
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
CMake deals with three directories: source, build or binary and installation.
|
||||
|
||||
@@ -36,272 +32,286 @@ 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.
|
||||
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:
|
||||
|
||||
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
|
||||
|
||||
@subsubsection build_cmake_conf Configuration process
|
||||
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
|
||||
|
||||
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:
|
||||
@subsection build_cmake_conf Configuration process
|
||||
|
||||
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
|
||||
ccmake d:/occt
|
||||
|
||||
@figure{/build/build_occt/images/cmake_image000.png}
|
||||
|
||||
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**.
|
||||
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}
|
||||
|
||||
**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> ).
|
||||
@note Each configuration of the project should be built in its own directory.
|
||||
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. It begins with selection of a target configurator. It is "Visual Studio 10 2010 Win64" in our example.
|
||||
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.
|
||||
|
||||
@figure{/build/build_occt/images/cmake_image002.png}
|
||||
|
||||
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>.
|
||||
@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>.
|
||||
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.
|
||||
|
||||
Alternatively, if you are using CMake from the command line add options -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 .
|
||||
|
||||
**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.
|
||||
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}
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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 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.
|
||||
|
||||
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:
|
||||
|
||||
| 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 |
|
||||
| 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_RAPIDJSON | Boolean flag | Indicates whether RapidJSON product should be used in OCCT Data Exchange module for support of glTF mesh file format |
|
||||
| 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_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 |
|
||||
| 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 | Indicates whether FreeImage product should be used in OCCT visualization module for support of popular graphics image formats (PNG, BMP, etc.) |
|
||||
| USE_OPENVR | Boolean | Indicates whether OpenVR product should be used in OCCT visualization module for support of Virtual Reality |
|
||||
| USE_OPENGL | Boolean | Indicates whether TKOpenGl graphic driver using OpenGL library (desktop) should be built within OCCT visualization module |
|
||||
| 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_FREETYPE_* | Path | Path to Freetype binaries |
|
||||
| 3RDPARTY_FREETYPE_* | Path | Path to FreeType binaries |
|
||||
| 3RDPARTY_TCL_* 3RDPARTY_TK_* | Path | Path to Tcl/Tk binaries |
|
||||
| 3RDPARTY_FREEIMAGE* | Path | Path to Freeimage binaries |
|
||||
| 3RDPARTY_TBB* | Path | Path to TBB binaries |
|
||||
| 3RDPARTY_FREEIMAGE* | Path | Path to FreeImage binaries |
|
||||
| 3RDPARTY_TBB* | Path | Path to TBB binaries |
|
||||
| 3RDPARTY_VTK_* | Path | Path to VTK binaries |
|
||||
| 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_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_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_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 flag | Indicates whether MFC samples should be built together with OCCT. This option is only relevant to Windows platforms |
|
||||
| BUILD_SAMPLES_QT | Boolean flag | Indicates whether QT samples should be built together with OCCT. |
|
||||
| BUILD_Inspector | Boolean flag | Indicates whether Inspector should be built together with OCCT. |
|
||||
| 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_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_SAMPLES_MFC | Boolean | 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_Inspector | Boolean | 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_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 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 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. |
|
||||
| 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_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. |
|
||||
| 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_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_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 | 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_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_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_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_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_DOC | Path | Relative path to the documentation installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_DOC}) |
|
||||
| INSTALL_FREETYPE | Boolean flag | Indicates whether Freetype 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 flag | Indicates whether TBB 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 flag | Indicates whether TCL binaries 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 flag | Indicates whether OCCT overview documentation should be installed into the installation directory |
|
||||
| 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_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_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_FREEIMAGE | Boolean | 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_VTK | Boolean | 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_TEST_CASES | Boolean | 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 |
|
||||
|
||||
**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
|
||||
|
||||
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 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\>_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\>_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>_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>_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.
|
||||
|
||||
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:
|
||||
|
||||
1. Common path: *3RDPARTY_DIR*
|
||||
2. Path to a particular 3rd-party library: *3RDPARTY_\<PRODUCT\>_DIR*
|
||||
1. Common path: `3RDPARTY_DIR`
|
||||
2. Path to a particular 3rd-party library: `3RDPARTY_<PRODUCT>_DIR`
|
||||
3. Paths to headers and binaries:
|
||||
1. *3RDPARTY_\<PRODUCT\>_INCLUDE_DIR*
|
||||
2. *3RDPARTY_\<PRODUCT\>_LIBRARY_DIR*
|
||||
3. *3RDPARTY_\<PRODUCT\>_DLL_DIR*
|
||||
1. `3RDPARTY_<PRODUCT>_INCLUDE_DIR`
|
||||
2. `3RDPARTY_<PRODUCT>_LIBRARY_DIR`
|
||||
3. `3RDPARTY_<PRODUCT>_DLL_DIR`
|
||||
|
||||
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 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 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*, 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.
|
||||
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.
|
||||
|
||||
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).
|
||||
|
||||
For example, *3RDPARTY_FREETYPE_DIR* variable
|
||||
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).
|
||||
For example, `3RDPARTY_FREETYPE_DIR` variable
|
||||
|
||||
d:/3rdparty/freetype-2.4.10
|
||||
|
||||
can be changed to
|
||||
can be changed to
|
||||
|
||||
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. 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.
|
||||
@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.
|
||||
|
||||
@subsubsection build_cmake_gen Projects generation
|
||||
@subsection build_cmake_gen Projects generation
|
||||
|
||||
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.
|
||||
|
||||
@subsubsection build_cmake_build Building
|
||||
@subsection build_cmake_build Building
|
||||
|
||||
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}
|
||||
|
||||
By default the build solution process skips the building of the INSTALL and Overview project.
|
||||
|
||||
By default, the build solution process skips the building of the INSTALL and Overview projects.
|
||||
When the building process is finished build:
|
||||
* Overview project to generate OCCT overview documentation (if BUILD_DOC_Overview variable is checked)
|
||||
* the *INSTALL* project to run **the installation process**
|
||||
* *Overview* project to generate OCCT overview documentation (if `BUILD_DOC_Overview` variable is checked)
|
||||
* 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.
|
||||
|
||||
@subsubsection build_cmake_install Installation
|
||||
@subsection build_cmake_install Installation
|
||||
|
||||
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.
|
||||
|
||||
Normally you use the installation directory of OCCT to link against your specific application.
|
||||
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.
|
||||
|
||||
Normally you use the installation directory of OCCT to link against your specific application.
|
||||
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)
|
||||
|
||||
**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:
|
||||
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)
|
||||
|
||||
@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
|
||||
\libd
|
||||
\bin
|
||||
\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. 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).
|
||||
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).
|
||||
|
||||
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_win_codeblocks Building with Code::Blocks
|
||||
@subsection build_occt_crossplatform_cmake Cross-compiling (Android)
|
||||
|
||||
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**.
|
||||
It can be used as an alternative to CMake build system (see @ref build_occt_win_cmake) for all supported platforms.
|
||||
This section 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.
|
||||
|
||||
@subsubsection build_codeblocks_3rdparty Third-party libraries
|
||||
Required tools (download and install if it is required):
|
||||
- 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.
|
||||
|
||||
Before building OCCT, make sure to have all the needed third-party libraries installed, see @ref build_upgrade.
|
||||
Run GUI tool provided by CMake and:
|
||||
- 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**.
|
||||
|
||||
@subsubsection build_codeblocks_conf Configuration
|
||||
@figure{/build/build_occt/images/android_image001.png}
|
||||
|
||||
Before building it is necessary to set up build environment.
|
||||
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", and click "Next".
|
||||
@figure{/build/build_occt/images/android_image002.png}
|
||||
|
||||
The environment is defined in the file *custom.sh* (on Linux and OS X) or *custom.bat* (on Windows) which can be edited directly:
|
||||
- Specify a toolchain file at the next dialog to `android.toolchain.cmake`, and click "Finish".
|
||||
@figure{/build/build_occt/images/android_image003.png}
|
||||
|
||||
* 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:
|
||||
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}
|
||||
|
||||
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*;
|
||||
* *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.
|
||||
|
||||
@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/<OS>/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:
|
||||
* *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:
|
||||
* 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`.
|
||||
* For optional third-party libraries, set corresponding environment variable `HAVE_<LIBRARY_NAME>` to either *false*, e.g. `export HAVE_FREEIMAGE=false`.
|
||||
|
||||
| VCVER | Visual Studio version | Windows Platform | Binaries folder name |
|
||||
|-----------|-----------------------|----------------------------------|----------------------|
|
||||
@@ -315,267 +325,85 @@ If you have Visual Studio projects already available (pre-installed or generated
|
||||
| vc142 | 2019 (16) | Desktop (Windows API) | vc14 |
|
||||
| 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.
|
||||
That tool will analyze your environment and propose you to choose available options:
|
||||
|
||||
* Version of Visual Studio to be used (from the list of installed ones, detected by presence of environment variables like *VS100COMNTOOLS*).
|
||||
* 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).
|
||||
* Method to populate folder *inc* (short-cuts by default).
|
||||
* Location of third-party libraries (usually downloaded from OCCT web site, see above).
|
||||
* 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).
|
||||
* 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_linux.png}
|
||||
|
||||
Click "Save" to store the specified configuration in *custom.bat* file.
|
||||
|
||||
@subsubsection build_msvc_generate Projects generation
|
||||
Click "Save" to store the specified configuration in *custom.bat* (Windows) or *custom.sh* (other systems) file.
|
||||
|
||||
@subsection build_genproj_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.
|
||||
|
||||
@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.
|
||||
|
||||
|
||||
~~~~
|
||||
$ genproj.bat
|
||||
~~~~
|
||||
|
||||
Note that if *custom.bat* is not present, **genproj** will start **genconf** to configure environment.
|
||||
|
||||
@subsubsection build_msvc_build Building
|
||||
@subsection build_genproj_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.
|
||||
|
||||
Note: the MSVC project files are located in folders <i>adm\\msvc\\vc...</i>.
|
||||
The MSVC project files are located in folders <i>adm\\msvc\\vc...</i>.
|
||||
Binaries are produced in *win32* or *win64* folders.
|
||||
|
||||
To start DRAW, launch *draw.bat*.
|
||||
|
||||
@section build_occt_linux Linux
|
||||
@subsubsection build_codeblocks_build Code::Blocks
|
||||
|
||||
You may choose one of the following ways to generate, configure and build OCCT sources on Linux just keeping in mind
|
||||
this platform specific:
|
||||
Code::Blocks is a cross-platform IDE which can be used for building OCCT on Linux, macOS and Windows platforms.
|
||||
The generated Code::Blocks project could be found within subfolder *adm/<OS>/cbp*.
|
||||
|
||||
* @ref build_occt_win_cmake "Configuration, generation and building OCCT on Windows using CMake tool"
|
||||
* @ref build_occt_code_blocks "Building on Mac OS X with Code::Blocks IDE"
|
||||
To start **Code::Blocks**, launch script *codeblocks.sh*.
|
||||
To build all toolkits, click **Build->Build workspace** in the menu bar.
|
||||
|
||||
@section build_occt_crossplatform_cmake Android (cross-compiling)
|
||||
|
||||
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.
|
||||
|
||||
Required tools (download and install if it is required):
|
||||
- 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.
|
||||
|
||||
Run GUI tool provided by CMake.
|
||||
|
||||
@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.:
|
||||
To start *DRAWEXE*, which has been built with **Code::Blocks** on Mac OS X, run the script
|
||||
~~~~
|
||||
export HAVE_FREEIMAGE=false
|
||||
./draw.sh cbp [d]
|
||||
~~~~
|
||||
Option *d* is used if OCCT has been built in **Debug** mode.
|
||||
|
||||
Alternatively, or when *custom.sh* does not exist, you can launch *genconf.sh* to configure environment interactively:
|
||||
@subsubsection build_occt_macos_xcode XCode
|
||||
|
||||
@figure{/build/build_occt/images/genconf_osx.png}
|
||||
XCode is an IDE for development on macOS platform and targeting macOS and iOS platforms.
|
||||
**genproj** tool comes with a legacy XCode project files generator, but CMake is a preferred way for building OCCT on macOS platform.
|
||||
|
||||
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 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:
|
||||
* 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.
|
||||
* Select **File -> New -> Target -> Aggregate** in the menu.
|
||||
* 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.
|
||||
* 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.
|
||||
|
||||
<h2>Launching DRAW</h2>
|
||||
|
||||
To start *DRAWEXE*, which has been built with Xcode on Mac OS X, perform the following steps:
|
||||
To start *DRAWEXE*, which has been built with XCode on Mac OS X, perform the following steps:
|
||||
|
||||
1.Open Terminal application
|
||||
|
||||
2.Enter <i>\<OCCT_ROOT_DIR\></i>:
|
||||
2.Enter `<OCCT_ROOT_DIR>`:
|
||||
~~~~
|
||||
cd \<OCCT_ROOT_DIR\>
|
||||
~~~~
|
||||
|
||||
3.Run the script
|
||||
~~~~
|
||||
./draw_cbp.sh xcd [d]
|
||||
./draw.sh xcd [d]
|
||||
~~~~
|
||||
|
||||
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/<OS>/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.
|
||||
|
Before Width: | Height: | Size: 194 KiB |
@@ -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
|
||||
|
BIN
dox/samples/images/sample_overview_qt_geometry.png
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
dox/samples/images/sample_overview_qt_ocaf.png
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
dox/samples/images/sample_overview_qt_topology.png
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
dox/samples/images/sample_overview_qt_triangulation.png
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
dox/samples/images/sample_overview_qt_viewers.png
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
dox/samples/images/sample_overview_qt_xde.png
Normal file
After Width: | Height: | Size: 28 KiB |
115
dox/samples/novice_guide.md
Normal file
@@ -0,0 +1,115 @@
|
||||
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.
|
@@ -1,4 +1,4 @@
|
||||
OCAF Usage {#samples__ocaf}
|
||||
OCAF: Usage Tutorial {#samples__ocaf}
|
||||
========
|
||||
|
||||
## Getting Started
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Function Mechanism Usage {#samples__ocaf_func}
|
||||
OCAF: Function Mechanism {#samples__ocaf_func}
|
||||
========================
|
||||
|
||||
Let us describe the usage of the "Function Mechanism" of Open CASCADE Application Framework on a simple example.
|
||||
|
@@ -1,176 +1,56 @@
|
||||
Tutorials and Samples {#samples}
|
||||
=====================
|
||||
|
||||
Tutorial: Modelling a Bottle
|
||||
----------------------------
|
||||
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.
|
||||
- @subpage samples__tutorials
|
||||
* @ref samples__novice_guide
|
||||
<br>A document providing an introductory information to newcomers.
|
||||
* @ref samples__draw_scripts
|
||||
<br>A set of demo scripts demonstrating OCCT functionality from DRAW.
|
||||
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".
|
||||
- @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.
|
||||
|
||||
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.
|
||||
@page samples__tutorials Tutorials and Demos
|
||||
- @subpage samples__novice_guide
|
||||
- @subpage samples__draw_scripts
|
||||
- @subpage occt__tutorial
|
||||
- @subpage samples__ocaf
|
||||
- @subpage samples__ocaf_func
|
||||
|
||||
Read more about @subpage occt__tutorial
|
||||
|
||||
MFC
|
||||
---------
|
||||
|
||||
Visual C++ programming samples containing 10 Visual C++ projects
|
||||
illustrating how to use a particular module or functionality.
|
||||
|
||||
The list of MFC samples:
|
||||
|
||||
* Geometry
|
||||
* 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
|
||||
@page samples__projects Sample Projects
|
||||
- @subpage samples_qt_iesample
|
||||
- @subpage samples_qml_android_occt
|
||||
- @subpage samples_qt_tutorial
|
||||
- @subpage samples_qt_overview
|
||||
- @subpage samples_mfc_standard
|
||||
- @subpage samples_csharp_occt
|
||||
- @subpage samples_csharp_direct3d
|
||||
- @subpage occt_samples_webgl
|
||||
- @subpage samples_java_android_occt
|
||||
- @subpage occt_samples_ios_uikit
|
||||
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 50 KiB |
@@ -1,4 +1,4 @@
|
||||
Tutorial {#occt__tutorial}
|
||||
Modeling: Bottle Tutorial {#occt__tutorial}
|
||||
=======
|
||||
|
||||
@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:
|
||||
|
||||
@figure{/tutorial/images/tutorial_image001.png,"",240}
|
||||
@figure{/tutorial/images/tutorial_image001.png,"",240} height=350px
|
||||
|
||||
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.
|
||||
|
||||
@figure{/tutorial/images/tutorial_image002.png,"",240}
|
||||
@figure{/tutorial/images/tutorial_image002.png,"",240} height=350px
|
||||
|
||||
This modeling requires four steps:
|
||||
|
||||
@@ -145,16 +145,16 @@ However, the *TopoDS* package provides only the data structure of the topologica
|
||||
To create an edge, you use the BRepBuilderAPI_MakeEdge class with the previously computed curves:
|
||||
|
||||
~~~~{.cpp}
|
||||
TopoDS_Edge aEdge1 = BRepBuilderAPI_MakeEdge(aSegment1);
|
||||
TopoDS_Edge aEdge2 = BRepBuilderAPI_MakeEdge(aArcOfCircle);
|
||||
TopoDS_Edge aEdge3 = BRepBuilderAPI_MakeEdge(aSegment2);
|
||||
TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge(aSegment1);
|
||||
TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge(aArcOfCircle);
|
||||
TopoDS_Edge anEdge3 = 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, aEdge1 and aEdge3 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, anEdge1 and anEdge3 could have been computed in a simpler way:
|
||||
|
||||
~~~~{.cpp}
|
||||
TopoDS_Edge aEdge1 = BRepBuilderAPI_MakeEdge(aPnt1, aPnt3);
|
||||
TopoDS_Edge aEdge2 = BRepBuilderAPI_MakeEdge(aPnt4, aPnt5);
|
||||
TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge(aPnt1, aPnt3);
|
||||
TopoDS_Edge anEdge2 = 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:
|
||||
@@ -165,7 +165,7 @@ 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:
|
||||
|
||||
~~~~{.cpp}
|
||||
TopoDS_Wire aWire = BRepBuilderAPI_MakeWire(aEdge1, aEdge2, aEdge3);
|
||||
TopoDS_Wire aWire = BRepBuilderAPI_MakeWire(anEdge1, anEdge2, anEdge3);
|
||||
~~~~
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
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:
|
||||
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:
|
||||
|
||||
| Shape | Generates |
|
||||
| :----- | :----------------- |
|
||||
@@ -260,7 +260,7 @@ To compute the main body of the bottle, you need to create a solid shape. The si
|
||||
| Face | Solid |
|
||||
| Shell | Compound of Solids |
|
||||
|
||||
@figure{/tutorial/images/tutorial_image007.png,"",240}
|
||||
@figure{/tutorial/images/tutorial_image007.png,"",240} height=350px
|
||||
|
||||
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.
|
||||
@@ -297,7 +297,7 @@ For our purposes, we will specify that fillets must be:
|
||||
* applied on all edges of the shape
|
||||
* have a radius of *myThickness* / 12
|
||||
|
||||
@figure{/tutorial/images/tutorial_image008.png,"",240}
|
||||
@figure{/tutorial/images/tutorial_image008.png,"",240} height=350px
|
||||
|
||||
To apply fillets on the edges of a shape, you use the *BRepFilletAPI_MakeFillet* class. This class is normally used as follows:
|
||||
|
||||
@@ -353,7 +353,7 @@ 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.
|
||||
|
||||
@figure{/tutorial/images/tutorial_image009.png,"",240}
|
||||
@figure{/tutorial/images/tutorial_image009.png,"",240} height=350px
|
||||
|
||||
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:
|
||||
@@ -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.
|
||||
* Compute a solid from the two walls W1 and W2.
|
||||
|
||||
@figure{/tutorial/images/tutorial_image010.png,"",240}
|
||||
@figure{/tutorial/images/tutorial_image010.png,"",240} height=350px
|
||||
|
||||
To compute a thick solid, you create an instance of the *BRepOffsetAPI_MakeThickSolid* class by giving the following information:
|
||||
|
||||
@@ -438,7 +438,6 @@ To compare a given type with the type you seek, use the *STANDARD_TYPE* macro, w
|
||||
|
||||
~~~~{.cpp}
|
||||
if(aSurface->DynamicType() == STANDARD_TYPE(Geom_Plane)){
|
||||
//
|
||||
}
|
||||
~~~~
|
||||
|
||||
@@ -478,9 +477,9 @@ The collection for shapes can be found in the *TopTools* package. As *BRepOffset
|
||||
All the necessary data are now available so you can create your hollowed solid by calling the *BRepOffsetAPI_MakeThickSolid* MakeThickSolidByJoin method:
|
||||
|
||||
~~~~{.cpp}
|
||||
BRepOffsetAPI_MakeThickSolid BodyMaker;
|
||||
BodyMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3);
|
||||
myBody = BodyMaker.Shape();
|
||||
BRepOffsetAPI_MakeThickSolid aSolidMaker;
|
||||
aSolidMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3);
|
||||
myBody = aSolidMaker.Shape();
|
||||
~~~~
|
||||
|
||||
|
||||
@@ -493,7 +492,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.
|
||||
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.
|
||||
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:
|
||||
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:
|
||||
|
||||
* a coordinate system;
|
||||
* a radius.
|
||||
@@ -604,7 +603,7 @@ As the parametric equation of an ellipse is P(U) = O + (MajorRadius * cos(U) * X
|
||||
~~~~
|
||||
|
||||
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 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 the first derivative, D2 for the second one.
|
||||
|
||||
~~~~{.cpp}
|
||||
gp_Pnt2d anEllipsePnt1 = anEllipse1->Value(0);
|
||||
@@ -698,7 +697,7 @@ You are almost done building the bottle. Use the *TopoDS_Compound* and *BRep_Bui
|
||||
|
||||
Congratulations! Your bottle is complete. Here is the result snapshot of the Tutorial application:
|
||||
|
||||
@figure{/tutorial/images/tutorial_image019.png,"",320}
|
||||
@figure{/tutorial/images/tutorial_image019.png,"",320} height=450px
|
||||
|
||||
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.
|
||||
@@ -796,9 +795,9 @@ Complete definition of MakeBottle function (defined in the file src/MakeBottle.c
|
||||
|
||||
TopTools_ListOfShape facesToRemove;
|
||||
facesToRemove.Append(faceToRemove);
|
||||
BRepOffsetAPI_MakeThickSolid BodyMaker;
|
||||
BodyMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3);
|
||||
myBody = BodyMaker.Shape();
|
||||
BRepOffsetAPI_MakeThickSolid aSolidMaker;
|
||||
aSolidMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3);
|
||||
myBody = aSolidMaker.Shape();
|
||||
// Threading : Create Surfaces
|
||||
Handle(Geom_CylindricalSurface) aCyl1 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 0.99);
|
||||
Handle(Geom_CylindricalSurface) aCyl2 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 1.05);
|
||||
|
@@ -396,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.
|
||||
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, @ref build_occt_win_codeblocks, and @ref build_occt_macos_xcode.
|
||||
The alternative solution is to use project files generated by OCCT legacy tool **genproj**, see @ref build_occt_genproj.
|
||||
|
||||
@subsubsection upgrade_occt700_cdl_auto Automatic upgrade
|
||||
|
||||
|
Before Width: | Height: | Size: 488 KiB |
@@ -1,8 +1,9 @@
|
||||
OCCT CSharp sample {#samples_csharp_occt}
|
||||
.NET: Import/Export (C#|C++/CLI|WinForms|WPF) {#samples_csharp_occt}
|
||||
==================
|
||||
|
||||
This sample demonstrates how to use OCCT libraries in <b>.Net</b> application
|
||||
written using **CSharp** and **Windows Forms** or **Windows Presentation Foundation** (WPF).
|
||||
The sample could be found within OCCT repository in folder `/samples/CSharp/`.
|
||||
|
||||
The connection between .Net and OCCT (C++) level is provided by proxy library
|
||||
**OCCProxy**, written in C++/CLI. The proxy library contains a single *ref* class
|
||||
@@ -14,6 +15,8 @@ Both applications provide the same functionality as the standard OCCT Import/Exp
|
||||
The first project is called *IE_WinForms* and uses Windows Forms for GUI.
|
||||
The second application is called *IE_WPF_WinForms* and uses Windows Presentation Foundation.
|
||||
|
||||
@figure{samples_c__ie.png}
|
||||
|
||||
Note a few important details:
|
||||
|
||||
- OCCT template class *NCollection_Haft* is used to encapsulate C++ class into a field of *ref* class;
|
||||
|
@@ -1,8 +1,9 @@
|
||||
Direct3D CSharp sample {#samples_csharp_direct3d}
|
||||
==================
|
||||
.NET: D3D/OpenGL Viewer (C#|C++/CLI|WPF) {#samples_csharp_direct3d}
|
||||
==================
|
||||
|
||||
This sample demonstrates how to use OCCT and DirectX libraries in <b>.Net</b> application
|
||||
written using **CSharp** and **Windows Presentation Foundation** (WPF).
|
||||
The sample could be found within OCCT repository in folder `/samples/CSharp/`.
|
||||
|
||||
The connection between .Net, OCCT (C++) and DirectX level is provided by proxy libraries,
|
||||
**OCCProxy** and **D3DProxy**, written in C++/CLI. The proxy library **OCCProxy** contains a single
|
||||
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
@@ -311,7 +311,7 @@ void OcafSamples::ModifyBoxOcafSample()
|
||||
Handle(TFunction_Function) aFunction;
|
||||
if (!aLabel.FindAttribute(TFunction_Function::GetID(), aFunction))
|
||||
{
|
||||
myResult << "Object cannot be modify.";
|
||||
myResult << "Object cannot be modified.";
|
||||
return;
|
||||
}
|
||||
// Get the Standard_GUID of the TFunction_FunctionDriver of the selected object TFunction_Function attribute
|
||||
@@ -413,7 +413,7 @@ void OcafSamples::ModifyCylinderOcafSample()
|
||||
Handle(TFunction_Function) aFunction;
|
||||
if (!aLabel.FindAttribute(TFunction_Function::GetID(), aFunction))
|
||||
{
|
||||
myResult << "Object cannot be modify.";
|
||||
myResult << "Object cannot be modified.";
|
||||
return;
|
||||
}
|
||||
// Get the Standard_GUID of the TFunction_FunctionDriver of the selected object TFunction_Function attribute
|
||||
|
@@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
project(glfw-occt-demo)
|
||||
|
||||
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/adm/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(APP_VERSION_MAJOR 1)
|
||||
set(APP_VERSION_MINOR 0)
|
||||
@@ -24,15 +26,14 @@ source_group ("Sources" FILES
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
# Open CASCADE Technology
|
||||
find_package(OpenCASCADE REQUIRED NO_DEFAULT_PATH)
|
||||
if (OpenCASCADE_FOUND)
|
||||
message (STATUS "Using OpenCASCADE from \"${OpenCASCADE_DIR}\"" )
|
||||
INCLUDE_DIRECTORIES(${OpenCASCADE_INCLUDE_DIR})
|
||||
LINK_DIRECTORIES(${OpenCASCADE_LIBRARY_DIR})
|
||||
find_package (OpenCASCADE REQUIRED)
|
||||
if (NOT OpenCASCADE_FOUND)
|
||||
message (FATAL_ERROR "coult not find OpenCASCADE, please set OpenCASCADE_DIR variable" )
|
||||
else()
|
||||
message (WARNING "Could not find OpenCASCADE, please set OpenCASCADE_DIR variable." )
|
||||
set (OCCT_LIBRARY_DIR)
|
||||
set (OCCT_BIN_DIR)
|
||||
message (STATUS "Using OpenCASCADE from \"${OpenCASCADE_INSTALL_PREFIX}\"" )
|
||||
message (STATUS "OpenCASCADE_INCLUDE_DIR=${OpenCASCADE_INCLUDE_DIR}")
|
||||
message (STATUS "OpenCASCADE_LIBRARY_DIR=${OpenCASCADE_LIBRARY_DIR}")
|
||||
INCLUDE_DIRECTORIES(${OpenCASCADE_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
SET(OpenCASCADE_LIBS
|
||||
|
@@ -55,7 +55,7 @@ GlfwOcctWindow::GlfwOcctWindow (int theWidth, int theHeight, const TCollection_A
|
||||
myYBottom = myYTop + aHeight;
|
||||
|
||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||
myDisplay = new Aspect_DisplayConnection (glfwGetX11Display());
|
||||
myDisplay = new Aspect_DisplayConnection ((Aspect_XDisplay* )glfwGetX11Display());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
157
samples/glfw/adm/cmake/FindOpenCASCADE.cmake
Normal file
@@ -0,0 +1,157 @@
|
||||
# This script finds OpenCASCADE Technology libraries.
|
||||
# The script requires:
|
||||
# OpenCASCADE_DIR - root OCCT folder or folder with CMake configuration files
|
||||
#
|
||||
# Script will define the following variables on success:
|
||||
# OpenCASCADE_FOUND - package is successfully found
|
||||
# OpenCASCADE_INCLUDE_DIR - directory with headers
|
||||
# OpenCASCADE_LIBRARY_DIR - directory with libraries for linker
|
||||
# OpenCASCADE_BINARY_DIR - directory with DLLs
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
# MY_PLATFORM variable
|
||||
math (EXPR MY_BITNESS "32 + 32*(${CMAKE_SIZEOF_VOID_P}/8)")
|
||||
if (WIN32)
|
||||
set (MY_PLATFORM "win${MY_BITNESS}")
|
||||
elseif(APPLE)
|
||||
set (MY_PLATFORM "mac")
|
||||
else()
|
||||
set (MY_PLATFORM "lin")
|
||||
endif()
|
||||
|
||||
# MY_PLATFORM_AND_COMPILER variable
|
||||
if (MSVC)
|
||||
if (MSVC90)
|
||||
set (MY_COMPILER vc9)
|
||||
elseif (MSVC10)
|
||||
set (MY_COMPILER vc10)
|
||||
elseif (MSVC11)
|
||||
set (MY_COMPILER vc11)
|
||||
elseif (MSVC12)
|
||||
set (MY_COMPILER vc12)
|
||||
elseif (MSVC14)
|
||||
set (MY_COMPILER vc14)
|
||||
else()
|
||||
set (MY_COMPILER vc15)
|
||||
message (WARNING "Unknown msvc version. $$MY_COMPILER is used")
|
||||
endif()
|
||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCC)
|
||||
set (MY_COMPILER gcc)
|
||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (MY_COMPILER gcc)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set (MY_COMPILER clang)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||
set (MY_COMPILER icc)
|
||||
else()
|
||||
set (MY_COMPILER ${CMAKE_GENERATOR})
|
||||
string (REGEX REPLACE " " "" COMPILER ${MY_COMPILER})
|
||||
endif()
|
||||
set (MY_PLATFORM_AND_COMPILER "${MY_PLATFORM}/${MY_COMPILER}")
|
||||
|
||||
set (OpenCASCADE_DIR "" CACHE PATH "Path to Open CASCADE libraries.")
|
||||
|
||||
# default paths
|
||||
set (OpenCASCADE_INCLUDE_DIR "${OpenCASCADE_DIR}/inc")
|
||||
set (OpenCASCADE_LIBRARY_DIR "${OpenCASCADE_DIR}/${MY_PLATFORM_AND_COMPILER}/lib")
|
||||
set (OpenCASCADE_BINARY_DIR "${OpenCASCADE_DIR}/${MY_PLATFORM_AND_COMPILER}/bin")
|
||||
|
||||
# complete list of OCCT Toolkits (copy-paste from adm/UDLIST, since installed OCCT does not include UDLIST)
|
||||
set (OpenCASCADE_TKLIST "")
|
||||
set (OpenCASCADE_TKLIST ${OpenCASCADE_TKLIST} TKernel TKMath) # FoundationClasses
|
||||
set (OpenCASCADE_TKLIST ${OpenCASCADE_TKLIST} TKG2d TKG3d TKGeomBase TKBRep) # ModelingData
|
||||
set (OpenCASCADE_TKLIST ${OpenCASCADE_TKLIST} TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing) # ModelingAlgorithms
|
||||
set (OpenCASCADE_TKLIST ${OpenCASCADE_TKLIST} TKService TKV3d TKOpenGl TKMeshVS TKIVtk TKD3DHost) # Visualization
|
||||
set (OpenCASCADE_TKLIST ${OpenCASCADE_TKLIST} TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF) # ApplicationFramework
|
||||
set (OpenCASCADE_TKLIST ${OpenCASCADE_TKLIST} TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh) # DataExchange
|
||||
set (OpenCASCADE_TKLIST ${OpenCASCADE_TKLIST} TKDraw TKViewerTest) # Draw
|
||||
|
||||
# validate location of OCCT libraries and headers
|
||||
set (OpenCASCADE_INCLUDE_DIR_FOUND)
|
||||
set (OpenCASCADE_LIBRARY_DIR_FOUND)
|
||||
set (OpenCASCADE_LIBRARY_DEBUG_DIR_FOUND)
|
||||
set (OpenCASCADE_IMPLIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
set (OpenCASCADE_SHAREDLIB_RELEASE_FOUND)
|
||||
set (OpenCASCADE_SHAREDLIB_DEBUG_FOUND)
|
||||
if (EXISTS "${OpenCASCADE_INCLUDE_DIR}/Standard.hxx")
|
||||
set (OpenCASCADE_INCLUDE_DIR_FOUND ON)
|
||||
endif()
|
||||
|
||||
if (EXISTS "${OpenCASCADE_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}TKernel${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
set (OpenCASCADE_LIBRARY_DIR_FOUND ON)
|
||||
elseif (NOT WIN32 AND EXISTS "${OpenCASCADE_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}TKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set (OpenCASCADE_LIBRARY_DIR_FOUND ON)
|
||||
set (OpenCASCADE_IMPLIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
endif()
|
||||
|
||||
if (EXISTS "${OpenCASCADE_LIBRARY_DIR}d/${CMAKE_SHARED_LIBRARY_PREFIX}TKernel${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
set (OpenCASCADE_LIBRARY_DEBUG_DIR_FOUND ON)
|
||||
elseif (NOT WIN32 AND EXISTS "${OpenCASCADE_LIBRARY_DIR}d/${CMAKE_SHARED_LIBRARY_PREFIX}TKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set (OpenCASCADE_LIBRARY_DEBUG_DIR_FOUND ON)
|
||||
set (OpenCASCADE_IMPLIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
elseif (OpenCASCADE_LIBRARY_DIR_FOUND)
|
||||
message (STATUS "Only release OpenCASCADE libraries have been found")
|
||||
endif()
|
||||
|
||||
if (NOT OpenCASCADE_LIBRARY_DIR_FOUND AND OpenCASCADE_LIBRARY_DEBUG_DIR_FOUND)
|
||||
set (OpenCASCADE_LIBRARY_DIR_FOUND ON)
|
||||
message (WARNING "Only debug OpenCASCADE libraries have been found")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (EXISTS "${OpenCASCADE_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}TKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set (OpenCASCADE_SHAREDLIB_RELEASE_FOUND ON)
|
||||
endif()
|
||||
if (EXISTS "${OpenCASCADE_BINARY_DIR}d/${CMAKE_SHARED_LIBRARY_PREFIX}TKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set (OpenCASCADE_SHAREDLIB_DEBUG_FOUND ON)
|
||||
endif()
|
||||
else()
|
||||
if (EXISTS "${OpenCASCADE_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}TKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set (OpenCASCADE_SHAREDLIB_RELEASE_FOUND ON)
|
||||
endif()
|
||||
if (EXISTS "${OpenCASCADE_LIBRARY_DIR}d/${CMAKE_SHARED_LIBRARY_PREFIX}TKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set (OpenCASCADE_SHAREDLIB_DEBUG_FOUND ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (OpenCASCADE_INCLUDE_DIR_FOUND AND OpenCASCADE_LIBRARY_DIR_FOUND)
|
||||
set (OpenCASCADE_FOUND ON)
|
||||
set (OpenCASCADE_INSTALL_PREFIX ${OpenCASCADE_DIR})
|
||||
|
||||
# Define OCCT toolkits so that CMake can put absolute paths to linker;
|
||||
# the library existance is not checked here, since modules can be disabled.
|
||||
foreach (aLibIter ${OpenCASCADE_TKLIST})
|
||||
add_library (${aLibIter} SHARED IMPORTED)
|
||||
|
||||
set_property (TARGET ${aLibIter} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties (${aLibIter} PROPERTIES IMPORTED_IMPLIB_RELEASE "${OpenCASCADE_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${aLibIter}${OpenCASCADE_IMPLIB_SUFFIX}")
|
||||
if (OpenCASCADE_SHAREDLIB_RELEASE_FOUND)
|
||||
if (WIN32)
|
||||
set_target_properties (${aLibIter} PROPERTIES IMPORTED_LOCATION_RELEASE "${OpenCASCADE_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${aLibIter}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
else()
|
||||
set_target_properties (${aLibIter} PROPERTIES IMPORTED_LOCATION_RELEASE "${OpenCASCADE_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${aLibIter}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (OpenCASCADE_LIBRARY_DEBUG_DIR_FOUND)
|
||||
set_property (TARGET ${aLibIter} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties (${aLibIter} PROPERTIES IMPORTED_IMPLIB_DEBUG "${OpenCASCADE_LIBRARY_DIR}d/${CMAKE_SHARED_LIBRARY_PREFIX}${aLibIter}${OpenCASCADE_IMPLIB_SUFFIX}")
|
||||
if (OpenCASCADE_SHAREDLIB_DEBUG_FOUND)
|
||||
if (WIN32)
|
||||
set_target_properties (${aLibIter} PROPERTIES IMPORTED_LOCATION_DEBUG "${OpenCASCADE_BINARY_DIR}d/${CMAKE_SHARED_LIBRARY_PREFIX}${aLibIter}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
else()
|
||||
set_target_properties (${aLibIter} PROPERTIES IMPORTED_LOCATION_DEBUG "${OpenCASCADE_LIBRARY_DIR}d/${CMAKE_SHARED_LIBRARY_PREFIX}${aLibIter}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
# fallback searching for CMake configs
|
||||
if (NOT "${OpenCASCADE_DIR}" STREQUAL "")
|
||||
set (anOcctDirBak "${OpenCASCADE_DIR}")
|
||||
find_package (OpenCASCADE CONFIG QUIET PATHS "${OpenCASCADE_DIR}" NO_DEFAULT_PATH)
|
||||
set (OpenCASCADE_DIR "${anOcctDirBak}" CACHE PATH "Path to Open CASCADE libraries." FORCE)
|
||||
else()
|
||||
find_package (OpenCASCADE CONFIG QUIET)
|
||||
endif()
|
||||
endif()
|
@@ -1,12 +1,15 @@
|
||||
OCCT sample for iOS {#occt_samples_ios_uikit}
|
||||
iOS: 3D Viewer (Objective-C++|UIKit) {#occt_samples_ios_uikit}
|
||||
==================
|
||||
|
||||
UIKitSample consists of the Open CASCADE 3D Viewer which provides import of STEP files and toolbar with three buttons.
|
||||
The sample could be found within OCCT repository in folder `/samples/ios/UIKitSample/`.
|
||||
|
||||
The first and second buttons serve for import hardcoded STEP files. The third button displays "About" dialog.
|
||||
|
||||
The viewer supports zoom, pan and rotate actions. The viewer supports selection of solids as well.
|
||||
|
||||
@figure{sample_ios_uikit.png}
|
||||
|
||||
Installation and configuration:
|
||||
1. Make sure you are running Mac OS version 10.12.1 or above and properly installed XCode version 8.1 or above.
|
||||
2. Install Open CASCADE Technology (OCCT) and build static libraries for desired device or/and simulator on your workstation.
|
||||
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
@@ -1,7 +1,8 @@
|
||||
OCCT JniViewer sample for Android {#samples_java_android_occt}
|
||||
Android: 3D Viewer (Java|C++|Android SDK|JNI) {#samples_java_android_occt}
|
||||
==================
|
||||
|
||||
This sample demonstrates simple way of using OCCT libraries in Android application written using Java.
|
||||
The sample could be found within OCCT repository in folder `/samples/java/jniviewer/`.
|
||||
|
||||
The connection between Java and OCCT (C++) level is provided by proxy library, libTKJniSample.so, written in C++ with exported JNI methods of Java class OcctJniRenderer.
|
||||
The proxy library contains single C++ class OcctJni_Viewer encapsulating OCCT viewer and providing functionality to manipulate this viewer
|
||||
@@ -13,6 +14,8 @@ and the code can be programmed on Java level similarly to C++ one.
|
||||
See description of OCCT Java Wrapper in Advanced Samples and Tools on OCCT web site at
|
||||
https://www.opencascade.com/content/advanced-samples-and-tools
|
||||
|
||||
@figure{samples_java_android_occt.jpg}
|
||||
|
||||
Install Android Studio 4.0+ and install building tools (check Tools -> SDK Manager):
|
||||
- Android SDK (API level 21 or higher).
|
||||
- Android SDK build tools.
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@@ -27,7 +27,7 @@ CSelectionDialog::CSelectionDialog (CHLRDoc* aDoc,CWnd* pParent /*=NULL*/)
|
||||
myDoc = aDoc;
|
||||
myIsDisplayed = false;
|
||||
//{{AFX_DATA_INIT(CSelectionDialog)
|
||||
m_Algo = 0;
|
||||
m_Algo = 1;
|
||||
m_DisplayMode = 0;
|
||||
m_NbIsos = 2;
|
||||
m_DrawHiddenLine = TRUE;
|
||||
|
@@ -1,6 +1,21 @@
|
||||
MFC samples {#samples_mfc_standard}
|
||||
MFC: OCCT Samples (C++|MFC) {#samples_mfc_standard}
|
||||
==========
|
||||
|
||||
Visual C++ programming samples for Windows platform containing illustrating how to use a particular module or functionality, including the following MFC samples:
|
||||
|
||||
* Geometry
|
||||
* Modeling
|
||||
* Viewer2d
|
||||
* Viewer3d
|
||||
* ImportExport
|
||||
* Ocaf
|
||||
* Triangulation
|
||||
* HLR
|
||||
* Animation
|
||||
* Convert
|
||||
|
||||
@figure{samples_mvc.png}
|
||||
|
||||
1. Contents
|
||||
-----------------------
|
||||
|
||||
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
@@ -1,12 +1,15 @@
|
||||
OCCT AndroidQt sample for Android {#samples_qml_android_occt}
|
||||
Qt: 3D Viewer (C++|QtQuick|QML) {#samples_qml_android_occt}
|
||||
==================
|
||||
|
||||
This sample demonstrates a simple way of using OCCT libraries in Android application written using Qt/Qml.
|
||||
The sample could be found within OCCT repository in folder `/samples/qt/AndroidQt/`.
|
||||
|
||||
The connection between Qt/Qml and OCCT (C++) level is provided by proxy library, libAndroidQt.so, written in C++.
|
||||
The proxy library contains single C++ class AndroidQt encapsulating OCCT viewer and providing functionality to manipulate this viewer
|
||||
and to import OCCT shapes from supported format of CAD file (BREP).
|
||||
|
||||
@figure{samples_qml_android_occt.jpg}
|
||||
|
||||
Requirements for building sample:
|
||||
* Java Development Kit 1.7 or higher
|
||||
* Qt 5.3 or higher
|
||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@@ -95,6 +95,7 @@ View::View( Handle(AIS_InteractiveContext) theContext, QWidget* parent )
|
||||
myCurZoom = 0;
|
||||
setAttribute(Qt::WA_PaintOnScreen);
|
||||
setAttribute(Qt::WA_NoSystemBackground);
|
||||
setAttribute(Qt::WA_NativeWindow);
|
||||
|
||||
myDefaultGestures = myMouseGestureMap;
|
||||
myCurrentMode = CurAction3d_Nothing;
|
||||
@@ -106,8 +107,6 @@ View::View( Handle(AIS_InteractiveContext) theContext, QWidget* parent )
|
||||
setBackgroundRole( QPalette::NoRole );//NoBackground );
|
||||
// set focus policy to threat QContextMenuEvent from keyboard
|
||||
setFocusPolicy( Qt::StrongFocus );
|
||||
setAttribute( Qt::WA_PaintOnScreen );
|
||||
setAttribute( Qt::WA_NoSystemBackground );
|
||||
init();
|
||||
}
|
||||
|
||||
|
10
samples/qt/IESample/ReadMe.md
Normal file
@@ -0,0 +1,10 @@
|
||||
Qt: Import/Export (C++|Qt Widgets) {#samples_qt_iesample}
|
||||
==========
|
||||
|
||||
OCCT includes several samples based on Qt application framework.
|
||||
These samples are available on all supported desktop platforms.
|
||||
|
||||
This Import Export programming sample contains 3D Viewer and Import / Export functionality.
|
||||
The sample could be found within OCCT repository in folder `/samples/qt/IESample/`.
|
||||
|
||||
@figure{samples_qt.png}
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
@@ -1,6 +1,22 @@
|
||||
Qt OCCT Overview samples {#samples_qt_overview}
|
||||
Qt: OCCT Overview (C++|Qt Widgets) {#samples_qt_overview}
|
||||
==========
|
||||
|
||||
The Overview Qt application provides code snippets 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.
|
||||
This sample is described in the @ref samples__novice_guide "Novice guide" for new users.
|
||||
|
||||
@figure{sample_overview_qt.png}
|
||||
|
||||
1. Contents
|
||||
-----------------------
|
||||
|
||||
|
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 110 KiB |
11
samples/qt/Tutorial/ReadMe.md
Normal file
@@ -0,0 +1,11 @@
|
||||
Qt: Bottle Tutorial (C++|Qt Widgets) {#samples_qt_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"
|
@@ -8,6 +8,8 @@
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
|
||||
TopoDS_Shape
|
||||
MakeBottle(const Standard_Real myWidth , const Standard_Real myHeight , const Standard_Real myThickness);
|
||||
@@ -23,6 +25,17 @@ DocumentTut::~DocumentTut()
|
||||
|
||||
void DocumentTut::onMakeBottle()
|
||||
{
|
||||
Handle(AIS_InteractiveContext) aCtx = getContext();
|
||||
for (V3d_ListOfView::Iterator aViewIter (aCtx->CurrentViewer()->ActiveViews()); aViewIter.More(); aViewIter.Next())
|
||||
{
|
||||
const Handle(V3d_View)& aView = aViewIter.Value();
|
||||
Graphic3d_RenderingParams& aParams = aView->ChangeRenderingParams();
|
||||
aParams.RenderResolutionScale = 2.0f;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Drawer)& aDefDrawer = aCtx->DefaultDrawer();
|
||||
aDefDrawer->SetIsoOnTriangulation (true);
|
||||
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
TopoDS_Shape aBottle=MakeBottle(50,70,30);
|
||||
Handle(AIS_Shape) AISBottle=new AIS_Shape(aBottle);
|
||||
|
@@ -77,5 +77,8 @@ if (NOT "${SOURCE_MAP_BASE}" STREQUAL "")
|
||||
endif()
|
||||
endif()
|
||||
install(FILES occt-webgl-sample.html DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
install(FILES ${OpenCASCADE_RESOURCE_DIR}/DrawResources/OCC_logo.png DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
install(FILES ${OpenCASCADE_RESOURCE_DIR}/DrawResources/lamp.ico DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
install(FILES ${OpenCASCADE_RESOURCE_DIR}/DrawResources/OCC_logo.png DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
install(FILES ${OpenCASCADE_RESOURCE_DIR}/DrawResources/lamp.ico DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
if (CMAKE_CXX_FLAGS MATCHES "-pthread")
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.worker.js DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
endif()
|
||||
|
@@ -1,4 +1,4 @@
|
||||
OCCT WebGL Viewer sample {#occt_samples_webgl}
|
||||
WebGL: 3D Viewer (JavaScript|C++|WebAssembly) {#occt_samples_webgl}
|
||||
==================
|
||||
|
||||
This sample demonstrates simple way of using OCCT libraries in Web application written in C++ and translated into WebAssembly module using Emscripten SDK (emsdk):
|
||||
@@ -6,6 +6,9 @@ https://emscripten.org/
|
||||
|
||||
Sample consists of the Open CASCADE 3D Viewer with a button for opening a model in BREP format.
|
||||
The sample requires a WebGL 2.0 capable browser supporting WebAssembly 1.0 (Wasm).
|
||||
The sample could be found within OCCT repository in folder `/samples/webgl/`.
|
||||
|
||||
@figure{sample_webgl.png,"",240} height=408px
|
||||
|
||||
Installation and configuration:
|
||||
1. Install Emscripten SDK and activate minimal configuration (Python, Java and CLang) following *emsdk* documentation. Activate also MinGW when building sample on Windows host.
|
||||
|
@@ -185,12 +185,16 @@ void WasmOcctView::initWindow()
|
||||
emscripten_set_resize_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this, toUseCapture, onResizeCallback);
|
||||
|
||||
emscripten_set_mousedown_callback (aTargetId, this, toUseCapture, onMouseCallback);
|
||||
emscripten_set_mouseup_callback (aTargetId, this, toUseCapture, onMouseCallback);
|
||||
emscripten_set_mousemove_callback (aTargetId, this, toUseCapture, onMouseCallback);
|
||||
// bind these events to window to track mouse movements outside of canvas
|
||||
//emscripten_set_mouseup_callback (aTargetId, this, toUseCapture, onMouseCallback);
|
||||
//emscripten_set_mousemove_callback (aTargetId, this, toUseCapture, onMouseCallback);
|
||||
//emscripten_set_mouseleave_callback (aTargetId, this, toUseCapture, onMouseCallback);
|
||||
emscripten_set_mouseup_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this, toUseCapture, onMouseCallback);
|
||||
emscripten_set_mousemove_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this, toUseCapture, onMouseCallback);
|
||||
|
||||
emscripten_set_dblclick_callback (aTargetId, this, toUseCapture, onMouseCallback);
|
||||
emscripten_set_click_callback (aTargetId, this, toUseCapture, onMouseCallback);
|
||||
emscripten_set_mouseenter_callback (aTargetId, this, toUseCapture, onMouseCallback);
|
||||
emscripten_set_mouseleave_callback (aTargetId, this, toUseCapture, onMouseCallback);
|
||||
emscripten_set_wheel_callback (aTargetId, this, toUseCapture, onWheelCallback);
|
||||
|
||||
emscripten_set_touchstart_callback (aTargetId, this, toUseCapture, onTouchCallback);
|
||||
@@ -198,9 +202,12 @@ void WasmOcctView::initWindow()
|
||||
emscripten_set_touchmove_callback (aTargetId, this, toUseCapture, onTouchCallback);
|
||||
emscripten_set_touchcancel_callback(aTargetId, this, toUseCapture, onTouchCallback);
|
||||
|
||||
//emscripten_set_keypress_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this, toUseCapture, onKeyCallback);
|
||||
emscripten_set_keydown_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this, toUseCapture, onKeyDownCallback);
|
||||
emscripten_set_keyup_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this, toUseCapture, onKeyUpCallback);
|
||||
//emscripten_set_keypress_callback (aTargetId, this, toUseCapture, onKeyCallback);
|
||||
emscripten_set_keydown_callback (aTargetId, this, toUseCapture, onKeyDownCallback);
|
||||
emscripten_set_keyup_callback (aTargetId, this, toUseCapture, onKeyUpCallback);
|
||||
//emscripten_set_focus_callback (aTargetId, this, toUseCapture, onFocusCallback);
|
||||
//emscripten_set_focusin_callback (aTargetId, this, toUseCapture, onFocusCallback);
|
||||
emscripten_set_focusout_callback (aTargetId, this, toUseCapture, onFocusCallback);
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
@@ -474,6 +481,21 @@ EM_BOOL WasmOcctView::onResizeEvent (int theEventType, const EmscriptenUiEvent*
|
||||
return EM_TRUE;
|
||||
}
|
||||
|
||||
//! Update canvas bounding rectangle.
|
||||
EM_JS(void, jsUpdateBoundingClientRect, (), {
|
||||
Module._myCanvasRect = Module.canvas.getBoundingClientRect();
|
||||
});
|
||||
|
||||
//! Get canvas bounding top.
|
||||
EM_JS(int, jsGetBoundingClientTop, (), {
|
||||
return Math.round(Module._myCanvasRect.top);
|
||||
});
|
||||
|
||||
//! Get canvas bounding left.
|
||||
EM_JS(int, jsGetBoundingClientLeft, (), {
|
||||
return Math.round(Module._myCanvasRect.left);
|
||||
});
|
||||
|
||||
// ================================================================
|
||||
// Function : onMouseEvent
|
||||
// Purpose :
|
||||
@@ -486,6 +508,18 @@ EM_BOOL WasmOcctView::onMouseEvent (int theEventType, const EmscriptenMouseEvent
|
||||
}
|
||||
|
||||
Handle(Wasm_Window) aWindow = Handle(Wasm_Window)::DownCast (myView->Window());
|
||||
if (theEventType == EMSCRIPTEN_EVENT_MOUSEMOVE
|
||||
|| theEventType == EMSCRIPTEN_EVENT_MOUSEUP)
|
||||
{
|
||||
// these events are bound to EMSCRIPTEN_EVENT_TARGET_WINDOW, and coordinates should be converted
|
||||
jsUpdateBoundingClientRect();
|
||||
EmscriptenMouseEvent anEvent = *theEvent;
|
||||
anEvent.targetX -= jsGetBoundingClientLeft();
|
||||
anEvent.targetY -= jsGetBoundingClientTop();
|
||||
aWindow->ProcessMouseEvent (*this, theEventType, &anEvent);
|
||||
return EM_FALSE;
|
||||
}
|
||||
|
||||
return aWindow->ProcessMouseEvent (*this, theEventType, theEvent) ? EM_TRUE : EM_FALSE;
|
||||
}
|
||||
|
||||
@@ -557,6 +591,24 @@ bool WasmOcctView::navigationKeyModifierSwitch (unsigned int theModifOld,
|
||||
return hasActions;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : onFocusEvent
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
EM_BOOL WasmOcctView::onFocusEvent (int theEventType, const EmscriptenFocusEvent* theEvent)
|
||||
{
|
||||
if (myView.IsNull()
|
||||
|| (theEventType != EMSCRIPTEN_EVENT_FOCUS
|
||||
&& theEventType != EMSCRIPTEN_EVENT_FOCUSIN // about to receive focus
|
||||
&& theEventType != EMSCRIPTEN_EVENT_FOCUSOUT))
|
||||
{
|
||||
return EM_FALSE;
|
||||
}
|
||||
|
||||
Handle(Wasm_Window) aWindow = Handle(Wasm_Window)::DownCast (myView->Window());
|
||||
return aWindow->ProcessFocusEvent (*this, theEventType, theEvent) ? EM_TRUE : EM_FALSE;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : onKeyDownEvent
|
||||
// Purpose :
|
||||
|
@@ -181,6 +181,9 @@ private:
|
||||
//! Key up event.
|
||||
EM_BOOL onKeyUpEvent (int theEventType, const EmscriptenKeyboardEvent* theEvent);
|
||||
|
||||
//! Focus change event.
|
||||
EM_BOOL onFocusEvent (int theEventType, const EmscriptenFocusEvent* theEvent);
|
||||
|
||||
//! @name Emscripten callbacks (static functions)
|
||||
private:
|
||||
|
||||
@@ -205,6 +208,9 @@ private:
|
||||
static EM_BOOL onKeyUpCallback (int theEventType, const EmscriptenKeyboardEvent* theEvent, void* theView)
|
||||
{ return ((WasmOcctView* )theView)->onKeyUpEvent (theEventType, theEvent); }
|
||||
|
||||
static EM_BOOL onFocusCallback (int theEventType, const EmscriptenFocusEvent* theEvent, void* theView)
|
||||
{ return ((WasmOcctView* )theView)->onFocusEvent (theEventType, theEvent); }
|
||||
|
||||
private:
|
||||
|
||||
//! Register hot-keys for specified Action.
|
||||
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
@@ -42,6 +42,11 @@ function updateCanvasSize()
|
||||
window.onresize = updateCanvasSize;
|
||||
updateCanvasSize();
|
||||
|
||||
// capture keyboard input on mouse click
|
||||
occViewerCanvas.tabIndex = -1;
|
||||
occViewerCanvas.onclick = (theEvent) => { occViewerCanvas.focus() };
|
||||
occViewerCanvas.focus();
|
||||
|
||||
//! Check browser support.
|
||||
function isWasmSupported()
|
||||
{
|
||||
@@ -78,6 +83,7 @@ fileInput.onchange = function()
|
||||
OccViewerModule.openFromMemory (aFile.name, aDataBuffer, aDataArray.length, true);
|
||||
//OccViewerModule._free (aDataBuffer); will be freed by called method
|
||||
OccViewerModule.displayGround (true);
|
||||
occViewerCanvas.focus();
|
||||
};
|
||||
aReader.readAsArrayBuffer(aFile);
|
||||
};
|
||||
|
@@ -53,7 +53,6 @@ class TCollection_ExtendedString;
|
||||
class Prs3d_LineAspect;
|
||||
class Prs3d_BasicAspect;
|
||||
class TopoDS_Shape;
|
||||
class SelectMgr_EntityOwner;
|
||||
class SelectMgr_Filter;
|
||||
|
||||
//! The Interactive Context allows you to manage graphic behavior and selection of Interactive Objects in one or more viewers.
|
||||
|
@@ -22,9 +22,7 @@
|
||||
#include <SelectMgr_SelectableObject.hxx>
|
||||
|
||||
class AIS_InteractiveContext;
|
||||
class Graphic3d_MaterialAspect;
|
||||
class Prs3d_BasicAspect;
|
||||
class Bnd_Box;
|
||||
class V3d_View;
|
||||
|
||||
//! Defines a class of objects with display and selection services.
|
||||
|
@@ -257,27 +257,29 @@ Standard_Boolean AIS_LightSource::ProcessDragging (const Handle(AIS_InteractiveC
|
||||
{
|
||||
case AIS_DragAction_Start:
|
||||
{
|
||||
myStartTransform = theDragFrom;
|
||||
myLocTrsfStart = LocalTransformation();
|
||||
return Standard_True;
|
||||
}
|
||||
case AIS_DragAction_Update:
|
||||
{
|
||||
theCtx->MainSelector()->Pick (myStartTransform.x(), myStartTransform.y(), theView);
|
||||
mySensSphere->ResetLastDetectedPoint();
|
||||
SetLocalTransformation (myLocTrsfStart);
|
||||
theCtx->MainSelector()->Pick (theDragFrom.x(), theDragFrom.y(), theView);
|
||||
gp_Pnt aStartPosition = mySensSphere->LastDetectedPoint();
|
||||
|
||||
mySensSphere->ResetLastDetectedPoint();
|
||||
theCtx->MainSelector()->Pick (theDragTo.x(), theDragTo.y(), theView);
|
||||
gp_Pnt aCurrPosition = mySensSphere->LastDetectedPoint();
|
||||
if (aCurrPosition.X() != RealLast() && aStartPosition.Distance (aCurrPosition) > Precision::Confusion())
|
||||
if (aCurrPosition.X() != RealLast()
|
||||
&& aStartPosition.Distance (aCurrPosition) > Precision::Confusion())
|
||||
{
|
||||
gp_Quaternion aQRot;
|
||||
aQRot.SetRotation (gp_Vec (gp_Pnt (0, 0, 0), aStartPosition), gp_Vec (gp_Pnt (0, 0, 0), aCurrPosition));
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetRotation (aQRot);
|
||||
SetLocalTransformation (myLocTrsfStart * aTrsf);
|
||||
myLocTrsfStart = LocalTransformation();
|
||||
myStartTransform = theDragTo;
|
||||
theOwner->Selectable()->ClearDynamicHighlight (theCtx->MainPrsMgr());
|
||||
theCtx->HilightWithColor (this, Handle(Prs3d_Drawer)(), false);
|
||||
const Standard_Integer aHiMod = HasHilightMode() ? HilightMode() : 0;
|
||||
theOwner->UpdateHighlightTrsf (theCtx->CurrentViewer(), theCtx->MainPrsMgr(), aHiMod);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -475,7 +477,7 @@ void AIS_LightSource::updateLightLocalTransformation()
|
||||
// =======================================================================
|
||||
void AIS_LightSource::setLocalTransformation (const Handle(TopLoc_Datum3D)& theTrsf)
|
||||
{
|
||||
const gp_Trsf aTrsf = theTrsf->Transformation();
|
||||
const gp_Trsf aTrsf = !theTrsf.IsNull() ? theTrsf->Transformation() : gp_Trsf();
|
||||
switch (myLightSource->Type())
|
||||
{
|
||||
case Graphic3d_TypeOfLightSource_Ambient:
|
||||
|
@@ -20,7 +20,6 @@
|
||||
#include <Graphic3d_CLight.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
|
||||
class Prs3d_ShadingAspect;
|
||||
class Select3D_SensitiveSphere;
|
||||
|
||||
//! Interactive object for a light source.
|
||||
@@ -260,7 +259,6 @@ protected:
|
||||
Aspect_TypeOfMarker myCodirMarkerType; //!< icon of arrow co-directional to camera direction (look from)
|
||||
Aspect_TypeOfMarker myOpposMarkerType; //!< icon of arrow opposite to camera direction (look at)
|
||||
|
||||
Graphic3d_Vec2i myStartTransform; //!< position of starting transformation
|
||||
gp_Trsf myLocTrsfStart; //!< object transformation before transformation
|
||||
Standard_Real mySize; //!< presentation size
|
||||
Standard_Integer myNbArrows; //!< number of directional light arrows
|
||||
|
@@ -24,7 +24,6 @@
|
||||
|
||||
class Geom_Plane;
|
||||
class Geom_Axis2Placement;
|
||||
class gp_Pnt;
|
||||
|
||||
//! Constructs plane datums to be used in construction of
|
||||
//! composite shapes.
|
||||
|
@@ -41,7 +41,6 @@ class AIS_InteractiveContext;
|
||||
class AIS_Point;
|
||||
class AIS_RubberBand;
|
||||
class AIS_XRTrackedDevice;
|
||||
class Graphic3d_Camera;
|
||||
class SelectMgr_EntityOwner;
|
||||
class V3d_View;
|
||||
class WNT_HIDSpaceMouse;
|
||||
@@ -442,10 +441,13 @@ public: //! @name resize events
|
||||
virtual void ProcessInput() Standard_OVERRIDE {}
|
||||
|
||||
//! Handle focus event.
|
||||
//! Default implementation does nothing.
|
||||
//! Default implementation resets cached input state (pressed keys).
|
||||
virtual void ProcessFocus (bool theIsActivated) Standard_OVERRIDE
|
||||
{
|
||||
(void )theIsActivated;
|
||||
if (!theIsActivated)
|
||||
{
|
||||
ResetViewInput();
|
||||
}
|
||||
}
|
||||
|
||||
//! Handle window close event.
|
||||
|
@@ -27,13 +27,13 @@
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <Prs3d_ToolDisk.hxx>
|
||||
#include <Prs3d_ToolSphere.hxx>
|
||||
#include <Select3D_SensitivePrimitiveArray.hxx>
|
||||
#include <SelectMgr_SequenceOfOwner.hxx>
|
||||
#include <V3d.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_ViewCube, AIS_InteractiveObject)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_ViewCubeOwner, SelectMgr_EntityOwner)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_ViewCubeSensitive, Select3D_SensitivePrimitiveArray)
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -56,46 +56,48 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
//! Simple sensitive element for picking by point only.
|
||||
class AIS_ViewCubeSensitive : public Select3D_SensitivePrimitiveArray
|
||||
//=======================================================================
|
||||
//function : AIS_ViewCubeSensitive
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_ViewCubeSensitive::AIS_ViewCubeSensitive (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(Graphic3d_ArrayOfTriangles)& theTris)
|
||||
: Select3D_SensitivePrimitiveArray (theOwner)
|
||||
{
|
||||
DEFINE_STANDARD_RTTI_INLINE(AIS_ViewCubeSensitive, Select3D_SensitivePrimitiveArray)
|
||||
public:
|
||||
//! Constructor.
|
||||
AIS_ViewCubeSensitive (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(Graphic3d_ArrayOfTriangles)& theTris)
|
||||
: Select3D_SensitivePrimitiveArray (theOwner)
|
||||
InitTriangulation (theTris->Attributes(), theTris->Indices(), TopLoc_Location());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Matches
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_ViewCubeSensitive::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||
SelectBasics_PickResult& thePickResult)
|
||||
{
|
||||
return isValidRay (theMgr) && Select3D_SensitivePrimitiveArray::Matches (theMgr, thePickResult);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : isValidRay
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
bool AIS_ViewCubeSensitive::isValidRay (const SelectBasics_SelectingVolumeManager& theMgr) const
|
||||
{
|
||||
if (theMgr.GetActiveSelectionType() != SelectMgr_SelectionType_Point)
|
||||
{
|
||||
InitTriangulation (theTris->Attributes(), theTris->Indices(), TopLoc_Location());
|
||||
// disallow rectangular selection
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Checks whether element overlaps current selecting volume.
|
||||
virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||
SelectBasics_PickResult& thePickResult) Standard_OVERRIDE
|
||||
if (AIS_ViewCubeOwner* anOwner = dynamic_cast<AIS_ViewCubeOwner* >(myOwnerId.get()))
|
||||
{
|
||||
return isValidRay (theMgr)
|
||||
&& Select3D_SensitivePrimitiveArray::Matches (theMgr, thePickResult);
|
||||
const Standard_Real anAngleToler = 10.0 * M_PI / 180.0;
|
||||
const gp_Dir aRay = theMgr.GetViewRayDirection();
|
||||
const gp_Dir aDir = V3d::GetProjAxis (anOwner->MainOrientation());
|
||||
return !aRay.IsNormal (aDir, anAngleToler);
|
||||
}
|
||||
|
||||
//! Checks if picking ray can be used for detection.
|
||||
bool isValidRay (const SelectBasics_SelectingVolumeManager& theMgr) const
|
||||
{
|
||||
if (theMgr.GetActiveSelectionType() != SelectMgr_SelectionType_Point)
|
||||
{
|
||||
// disallow rectangular selection
|
||||
return false;
|
||||
}
|
||||
|
||||
if (AIS_ViewCubeOwner* anOwner = dynamic_cast<AIS_ViewCubeOwner* >(myOwnerId.get()))
|
||||
{
|
||||
const Standard_Real anAngleToler = 10.0 * M_PI / 180.0;
|
||||
const gp_Dir aRay = theMgr.GetViewRayDirection();
|
||||
const gp_Dir aDir = V3d::GetProjAxis (anOwner->MainOrientation());
|
||||
return !aRay.IsNormal (aDir, anAngleToler);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsBoxSide
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <V3d_TypeOfOrientation.hxx>
|
||||
#include <Select3D_SensitivePrimitiveArray.hxx>
|
||||
|
||||
class AIS_AnimationCamera;
|
||||
class AIS_ViewCubeOwner;
|
||||
@@ -724,4 +725,25 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
//! Simple sensitive element for picking by point only.
|
||||
class AIS_ViewCubeSensitive : public Select3D_SensitivePrimitiveArray
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_ViewCubeSensitive, Select3D_SensitivePrimitiveArray)
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT AIS_ViewCubeSensitive (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(Graphic3d_ArrayOfTriangles)& theTris);
|
||||
|
||||
//! Checks whether element overlaps current selecting volume.
|
||||
Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||
SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Checks if picking ray can be used for detection.
|
||||
Standard_EXPORT bool isValidRay (const SelectBasics_SelectingVolumeManager& theMgr) const;
|
||||
|
||||
};
|
||||
|
||||
#endif // _AIS_ViewCube_HeaderFile
|
||||
|
@@ -29,9 +29,6 @@
|
||||
#include <Standard_Handle.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
class Standard_OutOfRange;
|
||||
class Standard_NoSuchObject;
|
||||
class Standard_DomainError;
|
||||
class gp_Pnt2d;
|
||||
class gp_Vec2d;
|
||||
class Geom2d_BezierCurve;
|
||||
|
@@ -29,9 +29,6 @@
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
class Standard_OutOfRange;
|
||||
class Standard_NoSuchObject;
|
||||
class Standard_DomainError;
|
||||
class gp_Pnt2d;
|
||||
class gp_Dir2d;
|
||||
class gp_Lin2d;
|
||||
|
@@ -23,10 +23,6 @@
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
class Standard_NoSuchObject;
|
||||
class Standard_DomainError;
|
||||
class Standard_OutOfRange;
|
||||
class Standard_TypeMismatch;
|
||||
class gp_Pnt2d;
|
||||
class gp_Vec2d;
|
||||
class gp_Lin2d;
|
||||
|
@@ -29,9 +29,6 @@
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
|
||||
class Standard_OutOfRange;
|
||||
class Standard_NoSuchObject;
|
||||
class Standard_DomainError;
|
||||
class gp_Pnt;
|
||||
class gp_Vec;
|
||||
class Geom_BezierCurve;
|
||||
|
@@ -21,7 +21,6 @@
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
|
||||
class gp_Pnt2d;
|
||||
|
||||
class Adaptor3d_HVertex;
|
||||
DEFINE_STANDARD_HANDLE(Adaptor3d_HVertex, Standard_Transient)
|
||||
|
@@ -34,8 +34,6 @@
|
||||
#include <TColGeom_HArray1OfSurface.hxx>
|
||||
#include <AdvApp2Var_EvaluatorFunc2Var.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
class Standard_OutOfRange;
|
||||
class Standard_ConstructionError;
|
||||
class AdvApprox_Cutting;
|
||||
class AdvApp2Var_Criterion;
|
||||
class Geom_BSplineSurface;
|
||||
|
@@ -17,8 +17,8 @@
|
||||
| de l'approximation a deux variables
|
||||
| a utiliser dans AdvApp2Var
|
||||
|--------------------------------------------------------------*/
|
||||
#ifndef ApproxF2var_HeaderFile
|
||||
#define ApproxF2var_HeaderFile
|
||||
#ifndef AdvApp2Var_ApproxF2var_HeaderFile
|
||||
#define AdvApp2Var_ApproxF2var_HeaderFile
|
||||
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <AdvApp2Var_Data_f2c.hxx>
|
||||
|
@@ -12,8 +12,8 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
// AdvApp2Var_Data_f2c.hxx
|
||||
#ifndef Data_f2c_HeaderFile
|
||||
#define Data_f2c_HeaderFile
|
||||
#ifndef AdvApp2Var_Data_f2c_HeaderFile
|
||||
#define AdvApp2Var_Data_f2c_HeaderFile
|
||||
|
||||
#ifndef F2CTYPE_DEFINED
|
||||
typedef int integer;
|
||||
|
@@ -28,7 +28,6 @@
|
||||
#include <GeomAbs_IsoType.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
class Standard_NoSuchObject;
|
||||
class AdvApp2Var_Iso;
|
||||
class AdvApp2Var_Node;
|
||||
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
class Standard_NoSuchObject;
|
||||
class AdvApp2Var_Patch;
|
||||
|
||||
|
||||
|
@@ -37,8 +37,6 @@
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
class Standard_OutOfRange;
|
||||
class Standard_ConstructionError;
|
||||
class AdvApprox_Cutting;
|
||||
|
||||
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include <Standard_Real.hxx>
|
||||
#include <AdvApprox_Cutting.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Standard_DomainError;
|
||||
|
||||
|
||||
|
||||
|
@@ -33,8 +33,6 @@
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
class PLib_JacobiPolynomial;
|
||||
class Standard_OutOfRange;
|
||||
class Standard_ConstructionError;
|
||||
|
||||
|
||||
//! Approximate a function on an intervall [First,Last]
|
||||
|
@@ -29,9 +29,6 @@
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
class StdFail_NotDone;
|
||||
class Standard_DomainError;
|
||||
class Standard_OutOfRange;
|
||||
|
||||
|
||||
//! Bspline approximation of a surface.
|
||||
|
@@ -12,8 +12,8 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef math_ContMatrices_HeaderFile
|
||||
#define math_ContMatrices_HeaderFile
|
||||
#ifndef AppCont_ContMatrices_HeaderFile
|
||||
#define AppCont_ContMatrices_HeaderFile
|
||||
#include <math_Vector.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
|
||||
|
@@ -31,9 +31,6 @@
|
||||
#include <math_Vector.hxx>
|
||||
class FEmTool_ElementaryCriterion;
|
||||
class FEmTool_Curve;
|
||||
class Standard_NotImplemented;
|
||||
class Standard_DomainError;
|
||||
class AppDef_MultiLine;
|
||||
class math_Matrix;
|
||||
|
||||
|
||||
|
@@ -28,9 +28,6 @@
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
class Standard_ConstructionError;
|
||||
class Standard_DimensionError;
|
||||
class Standard_OutOfRange;
|
||||
class AppDef_MultiPointConstraint;
|
||||
|
||||
|
||||
|
@@ -27,9 +27,6 @@
|
||||
#include <TColgp_HArray1OfVec.hxx>
|
||||
#include <TColgp_HArray1OfVec2d.hxx>
|
||||
|
||||
class Standard_OutOfRange;
|
||||
class Standard_ConstructionError;
|
||||
class Standard_DimensionError;
|
||||
class gp_Vec;
|
||||
class gp_Vec2d;
|
||||
|
||||
|
@@ -28,8 +28,6 @@
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
class Standard_NotImplemented;
|
||||
class Standard_DomainError;
|
||||
class FEmTool_Curve;
|
||||
class math_Matrix;
|
||||
|
||||
|
@@ -35,14 +35,6 @@
|
||||
#include <math_Vector.hxx>
|
||||
#include <AppParCurves_Constraint.hxx>
|
||||
class AppDef_SmoothCriterion;
|
||||
class Standard_OutOfRange;
|
||||
class Standard_DimensionError;
|
||||
class Standard_DomainError;
|
||||
class Standard_ConstructionError;
|
||||
class StdFail_NotDone;
|
||||
class gp_VectorWithNullMagnitude;
|
||||
class AppDef_MultiLine;
|
||||
class AppParCurves_MultiBSpCurve;
|
||||
class math_Matrix;
|
||||
class FEmTool_Curve;
|
||||
class FEmTool_Assembly;
|
||||
|
@@ -26,23 +26,6 @@
|
||||
#include <Standard_Real.hxx>
|
||||
#include <math_IntegerVector.hxx>
|
||||
class math_Matrix;
|
||||
class AppParCurves_MultiPoint;
|
||||
class AppParCurves_MultiCurve;
|
||||
class AppParCurves_MultiBSpCurve;
|
||||
class AppParCurves_ConstraintCouple;
|
||||
class AppParCurves_LeastSquare;
|
||||
class AppParCurves_ResolConstraint;
|
||||
class AppParCurves_Function;
|
||||
class AppParCurves_BSpFunction;
|
||||
class AppParCurves_Gradient;
|
||||
class AppParCurves_Gradient_BFGS;
|
||||
class AppParCurves_ParLeastSquare;
|
||||
class AppParCurves_ResConstraint;
|
||||
class AppParCurves_ParFunction;
|
||||
class AppParCurves_BSpGradient;
|
||||
class AppParCurves_BSpGradient_BFGS;
|
||||
class AppParCurves_BSpParLeastSquare;
|
||||
class AppParCurves_BSpParFunction;
|
||||
|
||||
|
||||
//! Parallel Approximation in n curves.
|
||||
|
@@ -30,10 +30,6 @@
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
class Standard_OutOfRange;
|
||||
class Standard_DimensionError;
|
||||
class Standard_ConstructionError;
|
||||
class AppParCurves_MultiCurve;
|
||||
class gp_Pnt;
|
||||
class gp_Pnt2d;
|
||||
class gp_Vec;
|
||||
|
@@ -28,9 +28,6 @@
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
class Standard_OutOfRange;
|
||||
class Standard_DimensionError;
|
||||
class Standard_ConstructionError;
|
||||
class AppParCurves_MultiPoint;
|
||||
class gp_Pnt;
|
||||
class gp_Pnt2d;
|
||||
|
@@ -27,8 +27,6 @@
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
class Standard_Transient;
|
||||
class Standard_OutOfRange;
|
||||
class Standard_DimensionError;
|
||||
class gp_Pnt;
|
||||
class gp_Pnt2d;
|
||||
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <AppParCurves_SequenceOfMultiCurve.hxx>
|
||||
class AppParCurves_MultiCurve;
|
||||
class AppParCurves_MultiBSpCurve;
|
||||
|
||||
|
||||
|
||||
|
@@ -173,8 +173,17 @@ static Standard_Real ComputeTolReached(const Handle(Adaptor3d_Curve)& c3d,
|
||||
{
|
||||
Standard_Real t = IntToReal(i) / IntToReal(nbp);
|
||||
Standard_Real u = first * (1.0 - t) + last * t;
|
||||
gp_Pnt Pc3d = c3d->Value(u);
|
||||
gp_Pnt Pcons = cons.Value(u);
|
||||
gp_Pnt Pc3d, Pcons;
|
||||
try
|
||||
{
|
||||
Pc3d = c3d->Value(u);
|
||||
Pcons = cons.Value(u);
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
{
|
||||
d2 = Precision::Infinite();
|
||||
break;
|
||||
}
|
||||
if (Precision::IsInfinite(Pcons.X()) ||
|
||||
Precision::IsInfinite(Pcons.Y()) ||
|
||||
Precision::IsInfinite(Pcons.Z()))
|
||||
|
@@ -44,9 +44,6 @@
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
class Approx_SweepFunction;
|
||||
class StdFail_NotDone;
|
||||
class Standard_DomainError;
|
||||
class Standard_OutOfRange;
|
||||
class AdvApprox_Cutting;
|
||||
|
||||
|
||||
|
@@ -31,8 +31,6 @@
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
class Standard_NotImplemented;
|
||||
class Standard_OutOfRange;
|
||||
class gp_Pnt;
|
||||
|
||||
|
||||
|
@@ -91,7 +91,7 @@ static void ComputeTrsf2d(const Handle(TheWLine)& theline,
|
||||
//function : Parameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void Parameters(const ApproxInt_TheMultiLine& Line,
|
||||
void ApproxInt_Approx::Parameters(const ApproxInt_TheMultiLine& Line,
|
||||
const Standard_Integer firstP,
|
||||
const Standard_Integer lastP,
|
||||
const Approx_ParametrizationType Par,
|
||||
|
@@ -26,6 +26,8 @@
|
||||
#include <Precision.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <GeomInt_WLApprox.hxx>
|
||||
#include <GeomInt_TheMultiLineOfWLApprox.hxx>
|
||||
|
||||
// (Sqrt(5.0) - 1.0) / 4.0
|
||||
//static const Standard_Real aSinCoeff = 0.30901699437494742410229341718282;
|
||||
@@ -88,6 +90,94 @@ static Standard_Real EvalCurv(const Standard_Real dim,
|
||||
return curv;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BuildCurvature
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ApproxInt_KnotTools::BuildCurvature(
|
||||
const NCollection_LocalArray<Standard_Real>& theCoords,
|
||||
const Standard_Integer theDim,
|
||||
const math_Vector& thePars,
|
||||
TColStd_Array1OfReal& theCurv,
|
||||
Standard_Real& theMaxCurv)
|
||||
{
|
||||
// Arrays are allocated for max theDim = 7: 1 3d curve + 2 2d curves.
|
||||
Standard_Real Val[21], Par[3], Res[21];
|
||||
Standard_Integer i, j, m, ic;
|
||||
Standard_Integer dim = theDim;
|
||||
//
|
||||
theMaxCurv = 0.;
|
||||
if (theCurv.Length() < 3)
|
||||
{
|
||||
theCurv.Init(0.);
|
||||
return;
|
||||
}
|
||||
i = theCurv.Lower();
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
Standard_Integer k = i + j;
|
||||
ic = (k - theCurv.Lower()) * dim;
|
||||
Standard_Integer l = dim*j;
|
||||
for (m = 0; m < dim; ++m)
|
||||
{
|
||||
Val[l + m] = theCoords[ic + m];
|
||||
}
|
||||
Par[j] = thePars(k);
|
||||
}
|
||||
PLib::EvalLagrange(Par[0], 2, 2, dim, *Val, *Par, *Res);
|
||||
//
|
||||
theCurv(i) = EvalCurv(dim, &Res[dim], &Res[2 * dim]);
|
||||
//
|
||||
if (theCurv(i) > theMaxCurv)
|
||||
{
|
||||
theMaxCurv = theCurv(i);
|
||||
}
|
||||
//
|
||||
for (i = theCurv.Lower() + 1; i < theCurv.Upper(); ++i)
|
||||
{
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
Standard_Integer k = i + j - 1;
|
||||
ic = (k - theCurv.Lower()) * dim;
|
||||
Standard_Integer l = dim*j;
|
||||
for (m = 0; m < dim; ++m)
|
||||
{
|
||||
Val[l + m] = theCoords[ic + m];
|
||||
}
|
||||
Par[j] = thePars(k);
|
||||
}
|
||||
PLib::EvalLagrange(Par[1], 2, 2, dim, *Val, *Par, *Res);
|
||||
//
|
||||
theCurv(i) = EvalCurv(dim, &Res[dim], &Res[2 * dim]);
|
||||
if (theCurv(i) > theMaxCurv)
|
||||
{
|
||||
theMaxCurv = theCurv(i);
|
||||
}
|
||||
}
|
||||
//
|
||||
i = theCurv.Upper();
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
Standard_Integer k = i + j - 2;
|
||||
ic = (k - theCurv.Lower()) * dim;
|
||||
Standard_Integer l = dim*j;
|
||||
for (m = 0; m < dim; ++m)
|
||||
{
|
||||
Val[l + m] = theCoords[ic + m];
|
||||
}
|
||||
Par[j] = thePars(k);
|
||||
}
|
||||
PLib::EvalLagrange(Par[2], 2, 2, dim, *Val, *Par, *Res);
|
||||
//
|
||||
theCurv(i) = EvalCurv(dim, &Res[dim], &Res[2 * dim]);
|
||||
if (theCurv(i) > theMaxCurv)
|
||||
{
|
||||
theMaxCurv = theCurv(i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeKnotInds
|
||||
//purpose :
|
||||
@@ -100,75 +190,10 @@ void ApproxInt_KnotTools::ComputeKnotInds(const NCollection_LocalArray<Standard_
|
||||
//I: Create discrete curvature.
|
||||
NCollection_Sequence<Standard_Integer> aFeatureInds;
|
||||
TColStd_Array1OfReal aCurv(thePars.Lower(), thePars.Upper());
|
||||
// Arrays are allocated for max theDim = 7: 1 3d curve + 2 2d curves.
|
||||
Standard_Real Val[21], Par[3], Res[21];
|
||||
Standard_Integer i, j, m, ic;
|
||||
Standard_Real aMaxCurv = 0.;
|
||||
Standard_Integer dim = theDim;
|
||||
//
|
||||
i = aCurv.Lower();
|
||||
for(j = 0; j < 3; ++j)
|
||||
{
|
||||
Standard_Integer k = i+j;
|
||||
ic = (k - aCurv.Lower()) * dim;
|
||||
Standard_Integer l = dim*j;
|
||||
for(m = 0; m < dim; ++m)
|
||||
{
|
||||
Val[l + m] = theCoords[ic + m];
|
||||
}
|
||||
Par[j] = thePars(k);
|
||||
}
|
||||
PLib::EvalLagrange(Par[0], 2, 2, dim, *Val, *Par, *Res);
|
||||
//
|
||||
aCurv(i) = EvalCurv(dim, &Res[dim], &Res[2*dim]);
|
||||
//
|
||||
if(aCurv(i) > aMaxCurv)
|
||||
{
|
||||
aMaxCurv = aCurv(i);
|
||||
}
|
||||
//
|
||||
for(i = aCurv.Lower()+1; i < aCurv.Upper(); ++i)
|
||||
{
|
||||
for(j = 0; j < 3; ++j)
|
||||
{
|
||||
Standard_Integer k = i+j-1;
|
||||
ic = (k - aCurv.Lower()) * dim;
|
||||
Standard_Integer l = dim*j;
|
||||
for(m = 0; m < dim; ++m)
|
||||
{
|
||||
Val[l + m] = theCoords[ic + m];
|
||||
}
|
||||
Par[j] = thePars(k);
|
||||
}
|
||||
PLib::EvalLagrange(Par[1], 2, 2, dim, *Val, *Par, *Res);
|
||||
//
|
||||
aCurv(i) = EvalCurv(dim, &Res[dim], &Res[2*dim]);
|
||||
if(aCurv(i) > aMaxCurv)
|
||||
{
|
||||
aMaxCurv = aCurv(i);
|
||||
}
|
||||
}
|
||||
//
|
||||
i = aCurv.Upper();
|
||||
for(j = 0; j < 3; ++j)
|
||||
{
|
||||
Standard_Integer k = i+j-2;
|
||||
ic = (k - aCurv.Lower()) * dim;
|
||||
Standard_Integer l = dim*j;
|
||||
for(m = 0; m < dim; ++m)
|
||||
{
|
||||
Val[l + m] = theCoords[ic + m];
|
||||
}
|
||||
Par[j] = thePars(k);
|
||||
}
|
||||
PLib::EvalLagrange(Par[2], 2, 2, dim, *Val, *Par, *Res);
|
||||
//
|
||||
aCurv(i) = EvalCurv(dim, &Res[dim], &Res[2*dim]);
|
||||
if(aCurv(i) > aMaxCurv)
|
||||
{
|
||||
aMaxCurv = aCurv(i);
|
||||
}
|
||||
|
||||
BuildCurvature(theCoords, theDim, thePars, aCurv, aMaxCurv);
|
||||
//
|
||||
Standard_Integer i, j, dim = theDim;
|
||||
#ifdef APPROXINT_KNOTTOOLS_DEBUG
|
||||
std::cout << "Discrete curvature array is" << std::endl;
|
||||
for(i = aCurv.Lower(); i <= aCurv.Upper(); ++i)
|
||||
@@ -627,3 +652,172 @@ void ApproxInt_KnotTools::BuildKnots(const TColgp_Array1OfPnt& thePntsXYZ,
|
||||
#endif
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
//function : MaxParamRatio
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Real MaxParamRatio(const math_Vector& thePars)
|
||||
{
|
||||
Standard_Integer i;
|
||||
Standard_Real aMaxRatio = 0.;
|
||||
//
|
||||
for (i = thePars.Lower() + 1; i < thePars.Upper(); ++i)
|
||||
{
|
||||
Standard_Real aRat = (thePars(i + 1) - thePars(i)) / (thePars(i) - thePars(i - 1));
|
||||
if (aRat < 1.)
|
||||
aRat = 1. / aRat;
|
||||
|
||||
aMaxRatio = Max(aMaxRatio, aRat);
|
||||
}
|
||||
return aMaxRatio;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DefineParType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Approx_ParametrizationType ApproxInt_KnotTools::DefineParType(
|
||||
const Handle(IntPatch_WLine)& theWL,
|
||||
const Standard_Integer theFpar, const Standard_Integer theLpar,
|
||||
const Standard_Boolean theApproxXYZ,
|
||||
const Standard_Boolean theApproxU1V1,
|
||||
const Standard_Boolean theApproxU2V2
|
||||
)
|
||||
{
|
||||
if (theLpar - theFpar == 1)
|
||||
return Approx_IsoParametric;
|
||||
|
||||
const Standard_Integer nbp3d = theApproxXYZ ? 1 : 0,
|
||||
nbp2d = (theApproxU1V1 ? 1 : 0) + (theApproxU2V2 ? 1 : 0);
|
||||
|
||||
GeomInt_TheMultiLineOfWLApprox aTestLine(theWL, nbp3d, nbp2d, theApproxU1V1, theApproxU2V2,
|
||||
0., 0., 0., 0., 0., 0., 0., theApproxU1V1, theFpar, theLpar);
|
||||
|
||||
TColgp_Array1OfPnt aTabPnt3d(1, Max(1, nbp3d));
|
||||
TColgp_Array1OfPnt2d aTabPnt2d(1, Max(1, nbp2d));
|
||||
TColgp_Array1OfPnt aPntXYZ(theFpar, theLpar);
|
||||
TColgp_Array1OfPnt2d aPntU1V1(theFpar, theLpar);
|
||||
TColgp_Array1OfPnt2d aPntU2V2(theFpar, theLpar);
|
||||
|
||||
Standard_Integer i, j;
|
||||
|
||||
for (i = theFpar; i <= theLpar; ++i)
|
||||
{
|
||||
if (nbp3d != 0 && nbp2d != 0) aTestLine.Value(i, aTabPnt3d, aTabPnt2d);
|
||||
else if (nbp2d != 0) aTestLine.Value(i, aTabPnt2d);
|
||||
else if (nbp3d != 0) aTestLine.Value(i, aTabPnt3d);
|
||||
//
|
||||
if (nbp3d > 0)
|
||||
{
|
||||
aPntXYZ(i) = aTabPnt3d(1);
|
||||
}
|
||||
if (nbp2d > 1)
|
||||
{
|
||||
aPntU1V1(i) = aTabPnt2d(1);
|
||||
aPntU2V2(i) = aTabPnt2d(2);
|
||||
}
|
||||
else if (nbp2d > 0)
|
||||
{
|
||||
if (theApproxU1V1)
|
||||
{
|
||||
aPntU1V1(i) = aTabPnt2d(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
aPntU2V2(i) = aTabPnt2d(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer aDim = 0;
|
||||
|
||||
if (theApproxXYZ)
|
||||
aDim += 3;
|
||||
if (theApproxU1V1)
|
||||
aDim += 2;
|
||||
if (theApproxU2V2)
|
||||
aDim += 2;
|
||||
|
||||
Standard_Integer aLength = theLpar - theFpar + 1;
|
||||
NCollection_LocalArray<Standard_Real> aCoords(aLength * aDim);
|
||||
for (i = theFpar; i <= theLpar; ++i)
|
||||
{
|
||||
j = (i - theFpar) * aDim;
|
||||
if (theApproxXYZ)
|
||||
{
|
||||
aCoords[j] = aPntXYZ.Value(i).X();
|
||||
++j;
|
||||
aCoords[j] = aPntXYZ.Value(i).Y();
|
||||
++j;
|
||||
aCoords[j] = aPntXYZ.Value(i).Z();
|
||||
++j;
|
||||
}
|
||||
if (theApproxU1V1)
|
||||
{
|
||||
aCoords[j] = aPntU1V1.Value(i).X();
|
||||
++j;
|
||||
aCoords[j] = aPntU1V1.Value(i).Y();
|
||||
++j;
|
||||
}
|
||||
if (theApproxU2V2)
|
||||
{
|
||||
aCoords[j] = aPntU2V2.Value(i).X();
|
||||
++j;
|
||||
aCoords[j] = aPntU2V2.Value(i).Y();
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
||||
//Analysis of curvature
|
||||
const Standard_Real aCritRat = 500.;
|
||||
const Standard_Real aCritParRat = 100.;
|
||||
math_Vector aPars(theFpar, theLpar);
|
||||
Approx_ParametrizationType aParType = Approx_ChordLength;
|
||||
GeomInt_WLApprox::Parameters(aTestLine, theFpar, theLpar, aParType, aPars);
|
||||
TColStd_Array1OfReal aCurv(aPars.Lower(), aPars.Upper());
|
||||
Standard_Real aMaxCurv = 0.;
|
||||
BuildCurvature(aCoords, aDim, aPars, aCurv, aMaxCurv);
|
||||
|
||||
if (aMaxCurv < Precision::PConfusion()
|
||||
|| Precision::IsPositiveInfinite(aMaxCurv))
|
||||
{
|
||||
//Linear case
|
||||
return aParType;
|
||||
}
|
||||
|
||||
Standard_Real aMidCurv = 0.;
|
||||
Standard_Real eps = Epsilon(1.);
|
||||
j = 0;
|
||||
for (i = aCurv.Lower(); i <= aCurv.Upper(); ++i)
|
||||
{
|
||||
if (aMaxCurv - aCurv(i) < eps)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
++j;
|
||||
aMidCurv += aCurv(i);
|
||||
}
|
||||
|
||||
if (j > 1)
|
||||
{
|
||||
aMidCurv /= j;
|
||||
}
|
||||
|
||||
if (aMidCurv <= eps)
|
||||
return aParType;
|
||||
|
||||
Standard_Real aRat = aMaxCurv / aMidCurv;
|
||||
|
||||
if (aRat > aCritRat)
|
||||
{
|
||||
if(aRat > 5.*aCritRat)
|
||||
aParType = Approx_Centripetal;
|
||||
else
|
||||
{
|
||||
Standard_Real aParRat = MaxParamRatio(aPars);
|
||||
if (aParRat > aCritParRat)
|
||||
aParType = Approx_Centripetal;
|
||||
}
|
||||
}
|
||||
|
||||
return aParType;
|
||||
}
|
||||
|