zoukankan      html  css  js  c++  java
  • 重要的视图类型解释。

    ---下面是一种视图抓取功能。 在下面还有别的。

    grab_bmp = gw.getViewportDib()
    BitMap:
    grab_bmp.filename  ="E:\shiyan_Experimental\012.bmp"
    "E:\shiyan_Experimental\012.bmp"
    save grab_bmp
    ---- 能作为一个保存。

    bmp_name = getSaveFileName caption:"Save Viewport to:" filename:bmp_name \

    types:"BMP(*.bmp)|*.bmp|TIFF(*.tif)|*.tif|JPG(*.jpg)|*.jpg|TGA(*.tga)|*.tga|"

    --上面是保存类型的函数。 getSaveFileName 就是保存对话框。这样的保险是显示保存。 我上面的是,隐士保存。其实 是各有需要。

    --caption:"Save Viewport to:" 保存的标题。  filename:bmp_name 在下面的名称处理。

    types:"BMP(*.bmp)|*.bmp|TIFF(*.tif)|*.tif|JPG(*.jpg)|*.jpg|TGA(*.tga)|*.tga|" ---保存类型的写法,这个很有用。

    if bmp_name != undefined then --if user has confirmed / entered a valid name

    (

    grab_bmp.filename = bmp_name --set output name to the one entered in the save file dialog

    save grab_bmp --save the bitmap

    display grab_bmp --display the bitmap in a VFB

    )

    View Code
    (

    ---------------------------------------------------------------------

    --GRABVIEWPORT MACROSCRIPT

    --Created:3/23/99

    --Edited:4/28/99

    --by Borislav Petrov

    --bobo@email.archlab.tuwien.ac.at

    ---------------------------------------------------------------------

    --Snapshot Active Viewport to Bitmap

    --Filename in format:

    --VPGRAB_MaxFileName_ViewportName_CurentFrame.ImageFormatExtension

    ---------------------------------------------------------------------

    --

    --Init Variables

    local grab_bmp
    --bitmap to put the snapshot into

    local bmp_name
    --name of the bitmap to save

    local get_viewport_name
    --viewport name

    local gac,gct,mfn
    --variables to hold ActiveCamera, CurrentTime, MaxFileName

    --

    --Start Macro

    grab_bmp
    = gw.getViewportDib() --get the viewport bitmap into variable --创建一张视图位图

    get_viewport_name
    = viewport.GetType() --get viewport name -- 返回视图的名字。

    gvn
    = get_viewport_name as string --convert viewport name to string ---转成string 后就会去掉相应的 #

    gvn
    = substring gvn 6 (gvn.count-5) --cut the string ---截取功能

    if gvn == "camera" then --if the remaining string is "camera"

    (

    gac
    = getActiveCamera() --get the camera

    gvn
    = gac.name --get the name of the camera

    )

    mfn
    = MaxFileName --get max file name ---max 文件名字,这里面做了一个得保存。

    if mfn == "" then --if there is no name

    mfn
    = "Untitled" --use "Untitled"

    else

    mfn
    = getFileNameFile mfn --use the file name without .MAX extension ---get 文件名字。

    gct
    = SliderTime as string --get current frame time --把当前的时间转换。

    --

    bmp_name
    = "VPGRAB_"+ mfn +"_" +gvn + "_" + gct --build the output file name ---上面的就是为了这里做铺垫。为了处理好名字的可变性。

    --

    --Display file save dialog

    bmp_name
    = getSaveFileName caption:"Save Viewport to:" filename:bmp_name \

    types:
    "BMP(*.bmp)|*.bmp|TIFF(*.tif)|*.tif|JPG(*.jpg)|*.jpg|TGA(*.tga)|*.tga|"

    --

    if bmp_name != undefined then --if user has confirmed / entered a valid name

    (

    grab_bmp.filename
    = bmp_name --set output name to the one entered in the save file dialog

    save grab_bmp
    --save the bitmap

    display grab_bmp
    --display the bitmap in a VFB

    )

    --

    )
    --end of script
  • 相关阅读:
    读写excel的组件
    一个关于C#语言中的Property的低级BUG,花了我二十分钟
    使用wwAppConfiguration类库来轻松读写应用程序配置信息
    为因地震死难的同胞默哀
    页面执行时生成静态文件的方法
    【转载】sp_spaceused2,看库里全部表占用的物理空间
    在微软中文技术论坛 CSDN cnblogs 三个微软社区中提问
    在内网服务器中获得真正的客户端ip的方法
    深拷贝的通用方法
    你知道在word中如何将段落标记替换成其他字符吗?
  • 原文地址:https://www.cnblogs.com/gaitian00/p/1976874.html
Copyright © 2011-2022 走看看