資源簡介
RSoft 光學仿真軟件 解壓即可用 包括BeamPROP、FullWAVE、BandSOLVE、GratingMOD、DiffractMOD、FemSIM,?以及MOST軟件。
代碼片段和文件信息
#!/usr/bin/env?python
import?sys?traceback?re
__HAS_TK?=?0
def?print_msg(msg):
????if?__HAS_TK:
????????tkMessageBox.showinfo(“Information“?msg)
????????print?msg
????else:
????????print?msg
def?print_err(msg):
????if?__HAS_TK:
????????tkMessageBox.showerror(“ERROR“?msg)
????????print?msg
????else:
????????print?msg????
????
def?exception?():
????
????“““?This?function?handles?any?exception?derived?from?Exception?and
????prints?it?out?in?a?message?box.??Code?merrily?stolen?from?the
????Thinking?in?Python?site.“““
????
????try:
????????type?value?tb?=?sys.exc_info?()
????????info?=?traceback.extract_tb?(tb)
????????filename?lineno?function?text?=?info[-1]?#?last?line?only
????????print_err?(“Exception:?%s:%d:?%s:?%s?(in?%s)“?%\
???????????????????(filename?lineno?type.__name__?str?(value)?function))
????finally:
????????type?=?value?=?tb?=?None?#?clean?up
print_msg(“Testing?if?Tkinter?is?available...?“)
try:
????import?Tkinter
except?ImportError:
????msg?=?“Sorry?Tkinter?does?not?appear?to?be?available.\n“\
??????????“Please?check?your?Python?installation.?“\
??????????“It?is?possible?that?you?have?not?installed?Tcl/Tk?and?Tkinter.“\
??????????“Please?visit?http://www.python.org?for?more?details.“????
????print_err(msg)
????sys.exit(1)
else:
????import?tkMessageBox
????print_msg(“OK?-?you?have?Tkinter“)
????print_msg(“TclVersion?=?%s?TkVersion?=?%s“%(Tkinter.TclVersion
?????????????????????????????????????????????????Tkinter.TkVersion))
????__HAS_TK?=?1
def?test_vtk_cone():
????import?vtkpython
????msg?=?“““Testing?a?sample?vtk?program.??You?should?see?a?300x300
????pixel?window?with?a?black?background?and?with?a?magenta?coloured
????Cone.??You?can?interact?with?the?cone?using?the?mouse.??To?quit
????the?test?press?q?on?the?window.??If?this?test?is?successful?then
????the?basic?vtkpython?installation?is?OK.“““
????print_msg?(re.sub(‘\s+‘?‘?‘?msg))
????#?create?a?rendering?window?and?renderer
????ren?=?vtkpython.vtkRenderer()
????renWin?=?vtkpython.vtkRenderWindow()
????renWin.AddRenderer(ren)
????iren?=?vtkpython.vtkRenderWindowInteractor()
????iren.SetRenderWindow(renWin)
????#?create?an?actor?and?give?it?cone?geometry
????cone?=?vtkpython.vtkConeSource()
????cone.SetResolution(40)
????coneMapper?=?vtkpython.vtkPolyDataMapper()
????coneMapper.SetInput(cone.GetOutput())
????coneActor?=?vtkpython.vtkActor()
????coneActor.SetMapper(coneMapper)
????coneActor.GetProperty?().SetColor?(0.5?0.5?1.0)????
????ren.AddActor(coneActor)
????#?enable?user?interface?interactor
????iren.Initialize()
????iren.Start()
def?test_vtk_tk_render_widget(root):
????import?vtkpython
????from?vtkRenderWidget?import?vtkTkRenderWidget
????
????msg?=?“““Testing?a?sample?vtk?program?that?uses?the
????vtkTkRenderWidget.??You?should?see?a?300x300?pixel?window?with?a
????black?background?and?with?a?magenta?coloured?Cone.??You?can
????interact?with?the?cone?using?the?mouse.??To?quit?the?test?press?q
????on?the?window.??If?this?test?is?successful?then
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????7425??2006-09-12?09:08??RSoft\examples\ring3.ind
?????文件???????6377??2006-09-17?21:24??RSoft\examples\log.txt
?????文件???????8871??2006-09-14?10:22??RSoft\examples\p.ind
?????文件????1516123??2006-09-17?21:24??RSoft\examples\bptmp.vtk
?????文件????????962??2006-09-15?20:31??RSoft\examples\grat_fiber.ind
?????文件????????970??2006-09-15?20:32??RSoft\examples\grtmp.run
?????文件????????447??2006-09-15?20:32??RSoft\examples\grtmp_log.txt
?????文件????????307??2006-09-15?20:32??RSoft\examples\grtmp.pcs
?????文件??????18458??2006-09-15?20:32??RSoft\examples\grtmp.dat
?????文件??????12110??2006-09-15?20:32??RSoft\examples\grtmp_sel.dat
?????文件????????452??2006-09-15?20:32??RSoft\examples\grtmp_post.pcs
?????文件????????872??2006-09-15?20:35??RSoft\examples\grat2.ind
?????文件???????1264??2004-04-22?11:00??RSoft\examples\DiffractMOD\Tutorial\Tut4\checkerboard3d.ind
?????目錄??????????0??2007-10-26?17:34??RSoft\examples\DiffractMOD\Tutorial\Tut4
?????文件???????1520??2004-04-22?11:00??RSoft\examples\DiffractMOD\Tutorial\Tut3\me
?????目錄??????????0??2007-10-26?17:34??RSoft\examples\DiffractMOD\Tutorial\Tut3
?????文件???????1628??2004-04-22?11:00??RSoft\examples\DiffractMOD\Tutorial\Tut2\filter.ind
?????目錄??????????0??2007-10-26?17:34??RSoft\examples\DiffractMOD\Tutorial\Tut2
?????文件???????1081??2004-04-22?11:00??RSoft\examples\DiffractMOD\Tutorial\Tut1\antiref.ind
?????目錄??????????0??2007-10-26?17:34??RSoft\examples\DiffractMOD\Tutorial\Tut1
?????目錄??????????0??2007-10-26?17:34??RSoft\examples\DiffractMOD\Tutorial
?????目錄??????????0??2007-10-26?17:34??RSoft\examples\DiffractMOD
?????文件??????14438??2003-02-10?17:00??RSoft\examples\GratingMOD\Tutorial\TutS4\grating3.dat
?????文件????????846??2003-04-16?14:10??RSoft\examples\GratingMOD\Tutorial\TutS4\grating3.ind
?????文件????????328??2003-04-16?14:11??RSoft\examples\GratingMOD\Tutorial\TutS4\grating3_inv.ind
?????目錄??????????0??2007-10-26?17:34??RSoft\examples\GratingMOD\Tutorial\TutS4
?????文件????????804??2003-04-16?14:10??RSoft\examples\GratingMOD\Tutorial\TutS3\constdsp.ind
?????目錄??????????0??2007-10-26?17:34??RSoft\examples\GratingMOD\Tutorial\TutS3
?????文件????????109??2002-03-04?11:00??RSoft\examples\GratingMOD\Tutorial\TutS2\two_chnl.dat
?????文件????????553??2003-04-16?14:10??RSoft\examples\GratingMOD\Tutorial\TutS2\two_chnl.ind
............此處省略1552個文件信息
評論
共有 條評論