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 (
) in the
Method toolbar’s
Code section. 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 the recorded code for that action appears in the Method Editor window.
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.
For convenience, there is also an action in the Home ribbon toolbar (as well as in the
Method toolbar), in the
Main section, for creating a new method and starting the recording. Click
Record Method (
); enter a name for the new method in the
Name field and choose a type of method —
Application method (the default) or
Model method — from the
Method type list of the
Record Method dialog box; perform the actions that you want to record; and then click
Stop Recording (
). In principle, you 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 Model Builder and Application Builder windows in the COMSOL Desktop to indicate that code recording is active.