1. Home
  2. Tips and tricks
  3. How to create a custom command

How to create a custom command

Apply to: All

QC’s flexibility allow us to work with blocks and customize the user interface to our likes. Besides, we’re able to use small expressions in LISP language to further personalize lists or to run some functions.

This article will show you how to deeply customize some CAD resources to save design time using LISP language.

Warning

For the fact that LISP is somewhat old, it loses performance in comparison to C and other up to date languages. With that in mind, use it only for very specific tasks.

 

More info

For example, lets use the CAD commando “osmode” (system variables) to access SnapE predefined values, and the “setvar” function to load the values.

Discovering system variable’s values…

1. Right click over SnapE, under the command window, and select the “Settings…”;
2. Change the geometry and reference options as you like, click “OK”;
3. At the command window, type OSMODE and copy the generated value;
4. Repeat previous steps with other options from step 2.

Tip

You can repeat steps 1, 2 and 3 as many times as you’d like to generate different configurations.

Now we’ve got the values, let’s create a command for each option generated.

Creating a command…

1.Type at the commando window the value _CUSTOMIZE;

2.At the “Customize – Commands” window, click in “Add command” (green + at the right);

3.At the “Name” column, type “SnapE Config 1”

4.At the “Command String” option, type: (setvar “osmode” 15359) (using “15359” as the value returned with the OSMODE previous command).

5.Repeat steps 2, 3 and 4 with the second previously returned value, but changing it’s name to “SnapE Config 2”.

Now we just need to call the command to define the parameters to our liking.

 

More Info

If you want to learn how to create a keyboard shortcut to cast this commands, click this link.

Was this article helpful?

Related Articles