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 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 on the Home ribbon toolbar 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.