.. _How can I open a file in DVT from Questa?:

How can I open a file in DVT from Questa?
=========================================

You can define the following procedure in a tcl script:

.. code-block:: 

    set ::env(DVT_HOME) /dvt/installation/location
    set ::env(DVT_WORKSPACE_PATH) /dvt/workspace/location

    proc dvtEdit { filename {linenumber 1} } {
        set line $linenumber
        if { $line < 1 } {
            set line 1
        }
        exec $::env(DVT_HOME)/bin/dvt_cli.sh openFile $filename -line $line &
    }
 
To make the new procedure available in the Questa tcl command line, add the script path to the ``MODELSIM_TCL`` environment variable:

.. code-block:: 

    MODELSIM_TCL=tcl_script_path.tcl:$MODELSIM_TCL
 
To set DVT as the default editor for opening files in Questa, run the following tcl command:

.. code-block:: 

    set PrefSource(altEditor) dvtEdit
 
To revert the settings for the default editor, run the following tcl command:

.. code-block:: 

    unset PrefSource(altEditor) dvtEdit

