Contents First Prev Home Next Last
QCad Scripting Manual
 
   

3 Calling a Script Function

Before you can call a script function within QCad, you need to open the Scripting IDE (Integrated Development Environment) as shown in Figure 1. The IDE opens in a separate window that allows you to manage scripts, create new scripts and to call script functions.

Figure 1:  The Scripting IDE can be used to manage, create and run scripts.

The Scripting IDE

To see how to run scripts from the IDE, please load an example script and run it. Make sure that you save and close all drawings you are currently working on before doing that. Now create a new empty drawing document. The script you will run later, will operate on the drawing that is currently open.

Now open the IDE from the scripting menu:

Scripts - Open IDE

Opening an Example Script

In the IDE window, open an example script that comes with every QCad distribution:

File - Import Script

Browse to the directory where you have installed QCad and from there to the subdirectory 'scripts'. There you can find a number of example scripts. Choose 'demo01.qs' and open it. The IDE now shows the code of this simple example script.

Running the Example Script

Project - Call Function...

A dialog shows all functions that are available within this script. In this example, there is only one function called 'main'. Choose this function and click OK.

QCad will run the function now which adds a couple of lines to the current drawing which form a pattern as shown in Figure 2.

Figure 2: Output of the example script "demo01.qs".

   
  Contents First Prev Home Next Last

Copyright 2004-2005 RibbonSoft, Inc.
All Rights Reserved.
This Manual was created with ManStyle.