Command Line Interface

Passing arguments to VertiBevel & making Commands.

Command Line Arguments:

It is now possible to create LW Commands to activate VertiBevel Presets and set various VertiBevel Parameters.  This allows you to assign a preset to a key on the keyboard, to its own button on the L6 interface, or call VB from an LScript.  Using the various arguments, you can create very powerful macros.  This can speed up your modeling projects a great deal.

To do this, do the following:

  1. Select  Modeler|Commands|Edit User Commands...
  2. (This assumes a default LW6.5 menu arrangement).
  3. Type in a name for the new command in the Command Name field. (It may help to start the name with VB to help you recognize it... i.e. VB_Basic2Step)
  4. Select "VertiBevel" as the Action.
  5. Type in the name of a preset you have created in VertiBevel in the Argument field, preceded by a "-p ".  It needs to be exact.  It is case sensitive.  Spaces are OK.  Example: "-p MyPreset"
  6. Click the Add button.
  7. Click OK to close the panel, or add others if desired.
  8.  Use Modeler|Interface|Edit Keyboard Shortcuts... and Modeler|Interface|Edit Menu Layout... to assign your newly created command to a key or menu. (This assumes a default LW6.5 menu arrangement).  Modeler will also automatically add it to the Construct|Additional menu, so you can access it there too.
  9. Select some polys and activate the command by hitting the assigned key or menu item.  It will be automatically applied without ever bringing up the VB interface.  If the preset name you typed as the argument for the command does not exist in the current preset file, the VB interface will be brought up.

There are several additional commands available for the command line.  They all use a "-" at the start of the command, so make sure you don't use any dashes in your preset or preset-file names (underscores "_"  and spaces work well).

VertiBevel Command Reference

No argument

Opens the VertiBevel interface with << LAST USED >> selected.


-p

Run Preset
Applies the given preset to the currently selected polys.  The preset is loaded from the current preset file (unless changed by -pfs or -pf) No interface will come up.

VertiBevel -p PresetName


-pfs

Preset File Set (permanently)
This changes your preset file, without having to go into the Preferences panel in the VB Panel, and set it.  Very handy for quickly switching between preset files. (Good for switching between sets of presets with the same names, but different scales for instance).

VertiBevel -pfs BigPresets.cfg


-pf

Use Preset File (for this time only)
This changes the preset file for the current command only.  It is useful for being able to always access a particular preset regardless of the current preset file.

VertiBevel -pf BigPresets.cfg -p PresetName


-s

Scale Preset (uniformly) by Amount
This is great for applying a preset at a different size.  (Try using this with << LAST USED >>, for speedy resizing of your last bevel).

VertiBevel -s 0.5 -p PresetName


-si

Scale Preset (inset only) by Amount
Same as -s, but only scales the inset values.

VertiBevel -si 0.375 -p PresetName


-ss

Scale Preset (shift only) by Amount
Same as -s, but only scales the shift values.

VertiBevel -ss 1.25 -p PresetName


-l

Load a Preset and open the VB interface with it.
Much like -p, but instead of applying it directly, it will open the interface to allow you to make adjustments to it, save it as a preset, etc... Very useful for LScript generated presets.

VertiBevel -l PresetName


-lo

Load (Only) a Preset.  This Loads the specified parameters from the Preset.  This changes parameters in the << LAST SAVED >> preset.  It is most useful for LScripts, but can be used to quickly change settings without opening the VB interface (see the note below on preset files).

VertiBevel -lo PresetName


-ns

No Save.  This parameter which can only be used when a -p argument is given, causes the preset that is used to Not be saved as << LAST USED >> when applied.  This is useful if you wish to reapply a preset at different scales for instance, but not make the scaled version the << LAST USED >>

VertiBevel -p PresetName -ns


Combining commands:

You may combine multiple commands in a single call.  Most calls can be combined, but a few can't (for instance -l or -lo and -p).  The preset file and preset names below are made up, don't expect to find them (<< LAST USED >> is real though).  Examples:

VertiBevel -pf BigPresets.cfg -l PresetName

Loads (in the VB panel) the preset "PresetName" from the preset file "BigPresets.cfg", but when VB is open, the preset file will still be the current one.

VertiBevel -pfs BigPresets.cfg -s 0.9 -p PresetName

Sets the current preset file to "BigPresets.cfg" and applies the preset "PresetName" at 0.9 scale.

VertiBevel -si 0.5 -ss 1.25 -pf SpecialPresets.cfg -p RoundCorner

Applies the preset "RoundCorner" from the preset file "SpecialPresets.cfg" with the inset scaled to 50% and the shift scaled to 125%.

VertiBevel -s 0.9 -p << LAST USED >>

Applies the most recently applied bevel at 90% of its last applied size.

VertiBevel -pf ParamsPresets.cfg -lo SoloBevelOn

Assuming you have created a preset in ParamsPresets.cfg which only specifies SOLOBEVEL as 1, then the above call will simply change the << LAST USED >> preset to bevel each poly individually. (See the Preset Files note below).


Preset Files:

Presets in a preset file are simply blocks of text which describe each of the individual parameters in that preset.  They may include some or all of the available settings.  Here is a complete preset block:

NAME DeepCorner
S_VAR 0
I_VAR 0
EDGES 0
SELFACES 1
SELBEVELS 0
SOLOBEVEL 0
FACEPOLYSURF << SOURCE >>
BEVELPOLYSURF << SOURCE >>
STEPS 5
0 0
0.013 0.002
0.09 0.014
0.099 0.09
0.1 0.1
ESP 0

Example preset block in a Preset file


The only required entry is the NAME entry.  The others may be omitted.  It is important to note that the STEPS entry must contain the appropriate number of inset/shift pairs following it (the first always being "0 0"), for it to work.  If you include an entry, make sure you give it a value.  If you don't want to specify a particular parameter, simply exclude it.

You can create (in a text editor, from an LScript, or another plugin or program) a text file that has a preset block in it, and you may call that preset from a command or LScript.  When calling a preset that occludes certain parameters, the occluded parameters will be the same as the << LAST USED >> preset.

It is possible to call VB from an LScript too. The syntax in an LScript is:

cmdseq("VertiBevel", "-p PresetName");

A complete (albeit basic) LScript would look like this:

//-----------------------------------------
// LScript Modeler
//

@version 2.0
@warnings
@script modeler

main
{
    cmdseq("VertiBevel", "-p CoolBevel1");
}

 

This is a snippet of the actual C++ code from VertiBevel that does the saving.  Those who know or can read C/C++ code may find this useful when writing preset savers

FILE* presetFile;

presetFile = fopen(fileName, "a");

if(presetFile){
    int i;

    fprintf(presetFile, "NAME %s\n", name);
    fprintf(presetFile, "S_VAR %.10G\n", aData->o_var);
    fprintf(presetFile, "I_VAR %.10G\n", aData->i_var);
    fprintf(presetFile, "EDGES %d\n", aData->inner_outer);
    fprintf(presetFile, "SELFACES %d\n", aData->faces);
    fprintf(presetFile, "SELBEVELS %d\n", aData->bevels);
    fprintf(presetFile, "SOLOBEVEL %d\n", aData->multi);
    fprintf(presetFile, "FACEPOLYSURF %s\n", aData->surface);
    fprintf(presetFile, "BEVELPOLYSURF %s\n",aData->bevsurf);
    fprintf(presetFile, "STEPS %d\n", aData->num_steps);
    for(i = 0; i < aData->num_steps; i++){
        fprintf(presetFile, "%.10G %.10G\n", 
                  aData->xs[i], aData->ys[i]);
    }
    fprintf(presetFile, "ESP %d\n", aData->esp);
    fclose(presetFile);
}

 

There is (or will be) a VB LScripts file section on our website.  You can find example LScripts and presets there.  We will be putting up new ones as we create them.  Anyone who creates groovy or otherwise useful LScripts and presets is encouraged to send them in, or put them on the YahooGroups files area.

VertiBevel Documentation - This page last updated 03/02/01