Important view types.

Source: Internet
Author: User

--- The following is a view capture function. There is something else below.

Grab_bmp = GW. getviewportdib ()
Bitmap:
Grab_bmp .filename = "E: \ shiyan_experimental \ 012.bmp"
"E: \ shiyan_experimental \ 012.bmp"
Save grab_bmp
---- Can be saved as a bucket.

BMP _name = getsavefilename caption: "Save viewport to:" filename: BMP _name \

Types: "BMP (*. BMP) | *. BMP | tiff (*. TIF) | *. TIF | JPG (*. JPG) | *. JPG | TGA (*. TGA) | *. TGA |"

-- The above is a save type function. Getsavefilename is the Save dialog box. Such insurance is displayed and saved. I saved it as a hermit. In fact, they have their own needs.

-- Caption: "Save viewport to:" saved title. Filename: The name of BMP in the following format.

Types: "BMP (*. BMP) | *. BMP | tiff (*. TIF) | *. TIF | JPG (*. JPG) | *. JPG | TGA (*. TGA) | *. TGA | "--- method of saving type, which is very useful.

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

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 -- create a view bitmap

Get_viewport_name = viewport. GetType () -- get viewport name -- return the view name.

GVN = get_viewport_name as string -- convert viewport name to string --- after being converted to string, the corresponding #

GVN = substring GVN 6 (GVN. Count-5) -- cut the string --- truncation Function

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 file name, which must be saved.

If MFN = "" then -- if there is no name

MFN = "Untitled" -- use "Untitled"

Else

MFN = getfilenamefile MFN -- use the file name without. Max extension --- get file name.

GCT = slidertime as string -- get current frame time -- converts the current time.

--

BMP _name = "vpgrab _" + MFN + "_" + GVN + "_" + GCT -- Build the output file name --- above is to pave the way for this. To handle the name variability.

--

-- 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.