MakeMovie

create a movie from a MapleSim visualization model

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.

 > $\mathrm{exampledir}≔\mathrm{FileTools}:-\mathrm{JoinPath}\left(\left[\mathrm{kernelopts}\left('\mathrm{toolboxdir}'=\mathrm{MapleSim}\right),"data","examples"\right]\right):$
 > $A≔\mathrm{MapleSim}:-\mathrm{LinkModel}\left('\mathrm{filename}'=\mathrm{FileTools}:-\mathrm{JoinPath}\left(\left[\mathrm{exampledir},"DoublePendulum.msim"\right]\right)\right):$

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.

 > $\mathrm{rec}≔A:-\mathrm{Simulate}\left('\mathrm{returntype}=\mathrm{simrec}','\mathrm{params}'=\left\{\mathrm{L1_l}=3\right\}\right):$

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

 > $A:-\mathrm{MakeMovie}\left(\mathrm{rec}\right)$

Use with compiled procedure

Create a compiled procedure that returns a suitable data record.

 > $C≔A:-\mathrm{GetCompiledProc}\left('\mathrm{addoutputs}'="continuous"\right):$
 • Call the compiled procedure to return the simulation record.
 > $\mathrm{rec}≔C\left('\mathrm{returntype}=\mathrm{simrec}'\right):$

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

 > $A:-\mathrm{MakeMovie}\left(\mathrm{rec},'\mathrm{moviefile}'="MyMovie.webm"\right)$

Use an FMU

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

 > $\mathrm{binfile}≔\mathrm{FileTools}:-\mathrm{JoinPath}\left(\left[\mathrm{exampledir},"DoublePendulum.bin"\right]\right):$
 > $\mathrm{simfile}≔\mathrm{FileTools}:-\mathrm{JoinPath}\left(\left[\mathrm{exampledir},"DoublePendulum.fmu"\right]\right):$
 > $A:-\mathrm{MakeMovie}\left(\mathrm{binfile},\mathrm{simfile},'\mathrm{moviefile}'="DP.webm"\right)$