Launching the Knowledge Debugger

You can start the Knowledgeware debugger by selecting the object you want to debug in the tree or using the Knowledge Monitor or the shortcut menus on actions.

This task shows you how to:


Before you begin: Create and save an action in Engineering Rules Capture containing a script. For example:
let m(Integer)
m=10
PopupMessage("from inside my action, line 1")
PopupMessage("from inside my action, line 2")
PopupMessage("from inside my action: #",m)

Debug an Action

You can start a code directly in debug mode when you work with an action. Launching a code in debug mode is the simplest way to run a given script, break on its first line, and interact with the knowledge debugger.

  1. Open the product containing the action.
  2. Right-click the action and select Action.object > Debug.
    The knowledge debugger appears.
  3. Click OK in the Insert Object dialog box.
    The knowledge debugger displays the action code, breaks on the first line, the Stack and Debugable fields show the action.
  4. Click Step over.
    The first message is displayed and the parameters view shows the value of m=10.
  5. Double-click 10 and enter another value, 15 for example.
  6. Click Step over.
    The second message is displayed.
  7. Close the knowledge debugger.
    The third message is displayed and the value is still 15.

Add an Object to Debug in the Tree

Another way to open the knowledge debugger is to click the Add to Debug Context command and selecting the object you want to debug in the tree. Use this method when the object that you want to debug does not appear in the tree.

  1. From the Knowledge Essentials section of the action bar, click Knowledge Monitor Debug .
  2. In the Knowledge Monitor Configure dialog box, click Add to Debug Context.
  3. Click the object that you want to debug in the tree.
    The knowledge debugger shows the script to debug.
  4. Add breakpoints to your code and run it using the debugger commands as shown in the scenario above.

Result:

Add an Object to Debug from the Knowledge Monitor

You can attach the knowledge debugger to a 3DEXPERIENCE session from the Knowledge Monitor. The code that you want to debug must have been run at least once before launching the knowledge debugger. This method lets you add scripts to the list of debuggable objects and add breakpoints to your scripts. For example, it can be useful if the action is launched by a rule pointing this action using the action->Run() expression.

  1. From the Knowledge Essentials section of the action bar, click Knowledge Monitor Debug
  2. Select your options and click OK.
  3. Run the script that you want to debug.
  4. Click Open Knowledge Monitor.
  5. In the Knowledge Monitor window, the object you want to debug in the left tree and select Add to Debuggable Objects.
    The objects are added to the knowledge debugger.
  6. Add breakpoints to your code and run it using the debugger commands as shown in the scenario above.