How can I use Tcl scripts to learn VTK on a Mac?

2026-06-11 13:001阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计443个文字,预计阅读时间需要2分钟。

How can I use Tcl scripts to learn VTK on a Mac?

环境:VTK-8.1.1 Mac OS X 10.13.6 /usr/bin/tclsh build vtkcmake配置:cmake . -G Unix Makefiles -DVTK_USE_QVTK:BOOL=ON -DCMAKE_INSTALL_PREFIX=/usr/local -DVTK_USE_GUISUPPORT:BOOL=ON -DVTK_QT_VERSION=5 -DModule_vtkGUISupport


环境:
VTK-8.1.1
Mac OS X 10.13.6
/usr/bin/tclsh

How can I use Tcl scripts to learn VTK on a Mac?

build vtk,cmake一下:

cmake ./ -G "Unix Makefiles" \
-DVTK_USE_QVTK:BOOL=ON \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DVTK_USE_GUISUPPORT:BOOL=ON \
-DVTK_QT_VERSION=5 \
-DModule_vtkGUISupportQt:BOOL=ON \
-DModule_vtkGUISupportQtOpenGL:BOOL=ON \
-DModule_vtkGUISupportQtSQL:BOOL=ON \
-DModule_vtkGUISupportQtWebkit:BOOL=OFF \
-DModule_vtkRenderingQt:BOOL=ON \
-DModule_vtkViewsQt:BOOL=ON \
-DVTK_WRAP_TCL:BOOL=ON \
-DTCL_INTERNAL_PATH=/Users/weiyang/Downloads/VTK-8.1.1/ThirdParty/TclTk/internals/tk8.6

注意:Module_vtkGUISupportQtWebkit 是被关掉的。
然后make, make install。
接着尝试使用tcl脚本

tclsh assembly.tcl
can't find package vtk
while executing
"package require vtk"
(file "assembly.tcl" line 8)

查看默认的Tcl变量 auto_path:

weiyang@WeiMac  ~/Downloads  tclsh
% puts $auto_path
/System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources /usr/lib ~/Library/Tcl /Library/Tcl /System/Library/Tcl /System/Library/Tcl/8.5 ~/Library/Frameworks /Library/Frameworks /System/Library/Frameworks
%

寻找pkgIndex.tcl 的路径:

✘ weiyang@WeiMac  ~  find / -name pkgIndex.tcl 2>/dev/null
/usr/local/lib/tcltk/vtk-8.1/pkgIndex.tcl
/System/Library/Tcl/tklib0.5/crosshair/pkgIndex.tcl
/System/Library/Tcl/tklib0.5/tablelist/pkgIndex.tcl
/System/Library/Tcl/tklib0.5/tooltip/pkgIndex.tcl
...

将包含pkgIndex.tcl的路径​​/Users/weiyang/Downloads/VTK-8.1.1/Wrapping/Tcl​​放到 auto_path中。可设置环境变量TCLLIBPATH

weiyang@WeiMac  ~/Downloads/VTK-8.1.1/Examples/Rendering/Tcl  export TCLLIBPATH=/Users/weiyang/Downloads/VTK-8.1.1/Wrapping/Tcl
weiyang@WeiMac  ~/Downloads/VTK-8.1.1/Examples/Rendering/Tcl  tclsh
% puts $auto_path
/Users/weiyang/Downloads/VTK-8.1.1/Wrapping/Tcl /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources /usr/lib ~/Library/Tcl /Library/Tcl /System/Library/Tcl /System/Library/Tcl/8.5 ~/Library/Frameworks /Library/Frameworks /System/Library/Frameworks
% exit

然后就能正常解释,运行tcl脚本:

weiyang@WeiMac  ~/Downloads/VTK-8.1.1/Examples/Rendering/Tcl  vtk assembly.tcl


本文共计443个文字,预计阅读时间需要2分钟。

How can I use Tcl scripts to learn VTK on a Mac?

环境:VTK-8.1.1 Mac OS X 10.13.6 /usr/bin/tclsh build vtkcmake配置:cmake . -G Unix Makefiles -DVTK_USE_QVTK:BOOL=ON -DCMAKE_INSTALL_PREFIX=/usr/local -DVTK_USE_GUISUPPORT:BOOL=ON -DVTK_QT_VERSION=5 -DModule_vtkGUISupport


环境:
VTK-8.1.1
Mac OS X 10.13.6
/usr/bin/tclsh

How can I use Tcl scripts to learn VTK on a Mac?

build vtk,cmake一下:

cmake ./ -G "Unix Makefiles" \
-DVTK_USE_QVTK:BOOL=ON \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DVTK_USE_GUISUPPORT:BOOL=ON \
-DVTK_QT_VERSION=5 \
-DModule_vtkGUISupportQt:BOOL=ON \
-DModule_vtkGUISupportQtOpenGL:BOOL=ON \
-DModule_vtkGUISupportQtSQL:BOOL=ON \
-DModule_vtkGUISupportQtWebkit:BOOL=OFF \
-DModule_vtkRenderingQt:BOOL=ON \
-DModule_vtkViewsQt:BOOL=ON \
-DVTK_WRAP_TCL:BOOL=ON \
-DTCL_INTERNAL_PATH=/Users/weiyang/Downloads/VTK-8.1.1/ThirdParty/TclTk/internals/tk8.6

注意:Module_vtkGUISupportQtWebkit 是被关掉的。
然后make, make install。
接着尝试使用tcl脚本

tclsh assembly.tcl
can't find package vtk
while executing
"package require vtk"
(file "assembly.tcl" line 8)

查看默认的Tcl变量 auto_path:

weiyang@WeiMac  ~/Downloads  tclsh
% puts $auto_path
/System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources /usr/lib ~/Library/Tcl /Library/Tcl /System/Library/Tcl /System/Library/Tcl/8.5 ~/Library/Frameworks /Library/Frameworks /System/Library/Frameworks
%

寻找pkgIndex.tcl 的路径:

✘ weiyang@WeiMac  ~  find / -name pkgIndex.tcl 2>/dev/null
/usr/local/lib/tcltk/vtk-8.1/pkgIndex.tcl
/System/Library/Tcl/tklib0.5/crosshair/pkgIndex.tcl
/System/Library/Tcl/tklib0.5/tablelist/pkgIndex.tcl
/System/Library/Tcl/tklib0.5/tooltip/pkgIndex.tcl
...

将包含pkgIndex.tcl的路径​​/Users/weiyang/Downloads/VTK-8.1.1/Wrapping/Tcl​​放到 auto_path中。可设置环境变量TCLLIBPATH

weiyang@WeiMac  ~/Downloads/VTK-8.1.1/Examples/Rendering/Tcl  export TCLLIBPATH=/Users/weiyang/Downloads/VTK-8.1.1/Wrapping/Tcl
weiyang@WeiMac  ~/Downloads/VTK-8.1.1/Examples/Rendering/Tcl  tclsh
% puts $auto_path
/Users/weiyang/Downloads/VTK-8.1.1/Wrapping/Tcl /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources /usr/lib ~/Library/Tcl /Library/Tcl /System/Library/Tcl /System/Library/Tcl/8.5 ~/Library/Frameworks /Library/Frameworks /System/Library/Frameworks
% exit

然后就能正常解释,运行tcl脚本:

weiyang@WeiMac  ~/Downloads/VTK-8.1.1/Examples/Rendering/Tcl  vtk assembly.tcl