This action makes it possible to insert code based on modifications of the embedded model. Put the insertion point where you want to insert the actions, click Record Code (

), perform the actions in the
Model Builder window, and then click
Stop Recording (

). The recorded code then appears directly in the method editor window. For example, if you update the size settings for a Rectangle geometry object as in the following figure,

When recording code, a red dot on a Method node indicates the method where the recorded code appears, and a red frame surrounds the method editor window for that method.
As a convenience, there is also an action on the Home ribbon toolbar for creating a new method and starting the recording. Click
Record a New Method (

), enter a name for the new method in the
Record a New Method dialog box’s
Name field, perform the actions that you want to record, and then click
Stop Recording (

). In this way, you in principle do not need to see any code to record a method. If a method editor window is open, the recorded code appears directly just as when using Record Code above. When you record a new method, a red frame surrounds the modeling and application builder windows in the COMSOL Desktop to indicate that code recording is active.