MakeMovie - MapleSim Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : MapleSim : MapleSim Application Programming Interface : API Commands : MapleSim/LinkModel/MakeMovie

MakeMovie

create a movie from a MapleSim visualization model

 

Calling Sequence

Parameters

Options

Description

Examples

Calling Sequence

A := MapleSim:-LinkModel()

A:-MakeMovie(simrec, opts)

A:-MakeMovie(binfile, simfile, opts)

Parameters

simrec

-

(optional) string; simulation record

binfile

-

(optional) string; filename for binary data

simfile

-

(optional) string; filename with extension fmu or simrec

opts

-

(optional) keyword options for MakeMovie

Options

• 

fps = integer[1..60]

  

Specifies the frames per second. The default is 30.

• 

height = integer[1..4000]

  

Specifies the frame height, in pixels. The default is 480.

• 

moviedir = string

  

Specifies the directory in which to store the generated movie. The default is the user's home directory (kernelopts(homedir)).

• 

moviefile = string

  

Specifies the name of the generated movie file. The allowable extensions are .avi, .gif, and .webm, in either all lower case or all upper case. If no extension is given, then a .webm movie file is generated. The default is aMovie.webm.

• 

overwrite = true or false

  

If set to true, this means overwrite an existing moviefile. If false and the moviefile exists, an error is returned. The default is true.

• 

saveresults = string

  

Specifies the name under which the results are attached to the linked model. If it is an empty string the results are not attached. The default is the empty string.

• 

width = integer[1..4000]

  

Specifies the frame width, in pixels. The default is 640.

Description

• 

The MakeMovie command creates a standalone movie file from a linked MapleSim model that has visualization components. It returns the movie filename as a string.

• 

The content for the movie is provided in one of two ways: from a simulation record or from binary data and an associated simulation file.

– 

The optional argument simrec is a simulation record returned by either the Simulate command or the compiled procedure generated by GetCompiledProc.  Either method must be passed the keyword argument returntype = simrec.

– 

The optional arguments binfile and simfile can be passed in to define the movie content.

Examples

The following examples demonstrate three ways in which simulation data for a MapleSim model that contains visualization components can be used to create a standalone movie of the simulation.

In all cases, the link to the original MapleSim model is needed because it contains the definitions needed to render the visualization elements.

Link to an existing MapleSim file with visualization components.

exampledirFileTools:-JoinPathkerneloptstoolboxdir=MapleSim,data,examples:

AMapleSim:-LinkModelfilename=FileTools:-JoinPathexampledir,DoublePendulum.msim:

Use Simulate

Run the simulation and return a simulation record. Use the params option to Simulate to set the length of the upper arm of the double pendulum to 3 meters.

recA:-Simulatereturntype=simrec,params=L1_l=3:

Make a movie. By default, the name of the movie file is aMovie.webm and is stored in the home directory.

A:-MakeMovierec

Use with compiled procedure

Create a compiled procedure that returns a suitable data record.

CA:-GetCompiledProcaddoutputs=continuous:

• 

Call the compiled procedure to return the simulation record.

recCreturntype=simrec:

Make a movie file named MyMovie.webm and store it in the default directory.

A:-MakeMovierec,moviefile=MyMovie.webm

Use an FMU

Make a movie from the binary data generated by an FMU of the MapleSim model.

binfileFileTools:-JoinPathexampledir,DoublePendulum.bin:

simfileFileTools:-JoinPathexampledir,DoublePendulum.fmu:

A:-MakeMoviebinfile,simfile,moviefile=DP.webm

See Also

GetCompiledProc

MapleSim

MapleSim[LinkModel]

Simulate