Modeler Commands

 

In this section, you will find descriptions of the commands available to Modeler scripts. These include commands found in both MeshDataEdit and Command Sequence modes. The commands outlined in this section will NOT work within Layout.

How to read this list of commands:

1. Command name

2. Description

3. Prototype:

returnVal command(parameters[optional]) (command Mode)

Modeler Command Modes:

CS          CommandSequence

MD          MeshDataEdit

IN            Internal

General Commands

new
The new() command will create a new object, and returns a Mesh Object Agent for the new object.

prototype:      new(Boolean)      (CS)

undo
redo

undo() can be called to back out a change made to your object. The number of levels of undo is specified in your LightWave Modeler configuration file (LWM.CFG). redo() returns the model to the state before the undo() function was called.

prototype:      undo()      (CS)

undogroupbegin
undogroupend

(LW9)

Groups all commands between these two statements into a single undo.


delete
delete() will clear all point/polygon information contained in the selected foreground layer(s).

prototype:      delete()      (CS)

cut
The cut() command cuts the selected geometry and stores it in Modeler’s internal data clipboard. As with most Modeler commands, it works only on the selected foreground layer(s).

prototype:      cut()     (CS)

copy
The copy() command lets you copy selected geometry into Modeler’s internal data clipboard. As with most Modeler commands, it works only on the selected foreground layer(s).

prototype:      copy()      (CS)

paste
The paste() command pastes geometry from Modeler’s internal data clipboard.

prototype:      paste()      (CS)

load
load() allows you to access LightWave objects on disk. This command affects data in the selected foreground layer(s).

prototype:      status load(filename)      (CS)

filename        string; file to be loaded.

save
save() allows you to access LightWave objects on disk. This command affects data in the selected foreground layer(s).

prototype:      status save(filename)      (CS)

filename        string; file to be saved.

revert
revert() causes the current object to revert to the copy stored on the disc under the object's filename, unless an optional filename is provided, in which case Modeler will revert to that file instead.

prototype:      status revert(filename)      (CS)

filename        string; file to be reverted to.

close
Use close() to close the active object. If the active object has been modified, then the user is prompted to save the mesh data before it is removed.

prototype:      close()      (CS)

closeall
Use closeall() to close ALL objects in Modeler. If any objects have been modified, then the user will be prompted to save each mesh before it is removed.

prototype:      closeall()      (CS)

exit
exit() will terminate Modeler. If any mesh data has been modified, the user gets a prompt to save the data before Modeler terminates.

prototype:      exit()      (CS)

selectvmap
Selects the specified VMap type and name for editing. The type can only be one of Morph, Spot, Weight, Subpatch weight or Texture UV. These types can be specified using the same type values provided to the VMap() Object Agent Constructor.

prototype:      selectvmap(type,name);      (CS)

meshedit
Invokes a MeshEdit plug-in of the specified name.

prototype:      meshedit(name);      (CS)

swaphidden
Use swaphidden() to toggle hidden mesh data in the current object to be visible and hide the currently visible mesh.

setobject
Use setobject() to select the active Modeler object. The optional index value specifies which object to select from among objects with the same name.

prototype:      setobject(string, [ index ])      (CS)

string            string; Object name.

index            integer; specifies which object to select from among objects with the same name.

setpivot
Use setpivot() to sets the pivot point for the current object to the specific location.

prototype:      setpivot(vector)      (CS)

vector            vector; position in 3D space.

boundingbox
boundingbox() is used to return the upper and lower vectors that represent the bounding box of the object in specified layers. If no layers are specified, then the selected foreground layer(s) are used by default.

boundingbox() can be called at anytime, regardless of mode. However, if boundingbox() is used during MeshDataEdit, layers cannot be specified, and any that are specified will be ignored.

When the specified layer(s) contains no point/polygon data, then nil is returned for each vector.

prototypes:      result boundingbox([layers])      (IN)

result              vector[2]; lower and upper vectors of bounding box or nil[2] if no data exists.

layers              integer or integer[]; an integer array of layer numbers, or layer

                       numbers separated by commas.

CommandInput

The CommandInput() function has been enabled for use in Modeler LScripts.  It can be used to invoke any CommandSequence functions specific to Modeler or common to both applications that have not specifically been addressed within LScript.
        ...
        CommandInput("Surf_SetWindowPos 100 50");
        ...

  You should continue to use any available LScript-specific functions that map to CommandSequence functions to provide argument type and value checking within your script.

Object Modify Commands

fixedflex
The fixedflex() function lets you establish operating parameters for other Modeler commands that involve flex transformations. The flexing commands include twist() and taper(). fixedflex() sets the operating parameters for these flex functions so that they operate on a fixed range along a specified axis. You can specify easements by using the "i" (ease-in) or "o" (ease-out) flags.

prototype:      status fixedflex(axis, start, end, easement)      (CS)

axis               constant; X, Y or Z.

start              number; start of range in degrees.

end               number; end of range in degrees.

easement      string; "i" or "o".

autoflex
Like fixedflex(), the autoflex() function modifies the operating parameters for flex transformation functions. However, this function sets parameters so the flexing commands will operate on an automatic range along the axis of the specified polarity

prototype:      status autoflex(axis, polarity,easement)      (CS)

axis              constant; X, Y or Z.

polarity          string; "+" or "-".

easement      string; "i" or "o".

deformregion
The deformregion() command establishes the area of 3D space that deformation functions, such as vortext() and pole(), will use. If the optional axis is omitted, the deformation effect is bounded in all directions by the specified radius. If an axis is indicated, the effect is unbounded along that particular axis.

prototypes:      status deformregion(radius [,center [,axis]])      (CS)

radius             vector or number; radius of region.

center             vector or number; center of region.

axis:               constant; X, Y or Z.

move
move() translates selected points by a specified offset. Note that the offset is relative to the center of the selected points, and not from the origin.

prototype:      move(offset)      (CS)

offset             vector or number; movement offset along all three axes.

prototype:      move(xoffset, yoffset, zoffset)      (CS)

xoffset          number; offset along X axis.

yoffset          number; offset along Y axis.

zoffset          number; offset along Z axis.

shear
Similar to move(), shear() translates selected points by a specified offset. However, points are translated only along the flex axis (established by the fixedflex() or autoflex() commands). Note that the offset is relative to the center of the selected points, and not the origin.

prototype:      shear(offset)      (CS)

offset            vector or number; offset value to apply to all axes.

prototype:      shear(xoffset, yoffset, zoffset)      (CS)

xoffset           number; offset along X axis.

yoffset           number; offset along Y axis.

zoffset           number; offset along Z axis.

magnet
magnet() also translates selected points by a specified offset, but the translation falls within the area established by the deformation region (established by the deformregion() command).

prototype:      magnet(offset)      (CS)

offset:            vector or number; offset value to apply to all axes.

prototype:      magnet(xoffset, yoffset, zoffset)      (CS)

xoffset           number; offset along X axis.

yoffset           number; offset along Y axis.

zoffset           number; offset along Z axis.

rotate
rotate() is used to rotate selected points along a specified axis by a specified number of degrees.

prototype:      rotate(angle, axis [,center])      (CS)

angle            number; amount of degrees to rotate.

axis              constant; X, Y or Z.

center           vector or number; center of rotation.

twist
Like rotate(), twist() will rotate selected points along a specified axis by a specified number of degrees. However, points are translated only along the flex axis (specified by the fixedflex() or autoflex() commands).

prototype:      status twist(angle, axis [,center])      (CS)

angle             number; amount of degrees to twist.

axis               constant; X, Y or Z.

center            vector or number; center of twist.

vortex
vortex() is also used to rotate selected points along a specified axis by a specified number of degrees. However, this command operates within the deformation region, whose parameters are established with the deformregion() command.

prototype:      vortex(angle, axis [,center])      (CS)

angle            number; amount of vortex degrees.

axis              constant; X, Y or Z.

center           vector or number; center of vortex.

scale
scale() is used to scale selected points by a given factor around an optional center point. Factors of 1 on any axis will maintain the points in their locations along that axis.

For example, to scale an object by one-half along the X and Y axes, while maintaining the current scale along the Z,

scale(<.5,.5,1>);

Notice in the example that no optional center vector was specified. This value will default to the origin (i.e., <0,0,0>), and all values will be relative to this point.

prototype:      status scale(amount[,center])      (CS)

amount         vector or number; scaling factor.

center           vector or number; relative center of scale.

taper
taper() is similar to scale() except that it uses the flex axis, established by either fixedflex() or autoflex(), to define its area of influence.

prototype:      status taper(amount[,center])      (CS)

amount          vector or number; tapering factor.

center            vector or number; relative center of taper.

pole
pole(), like taper(), is another member of the scale() family, except that it uses the deformation region, established by deformregion(), to constrain its area of influence.

Prototype:      status pole(amount [,center])      (CS)

amount          vector or number; pole factor.

center            vector or number; relative center of pole.

bend
The bend() command is used to bend selected points by a specified angle in a direction around an optional center. bend() adheres to the current flex axis established by either fixedflex() or autoflex().

prototype:      status bend(angle, direction [,center])     (CS)

angle             number; bend angle in degrees.

direction         number; bend direction in degrees.

center            vector or number; relative center around which to bend.

jitter
jitter() will randomly translate selected points using one of four different displacement functions.

UNIFORM distributes points across a uniform range. This is the default.

GAUSSIAN distributes the offsets in a bell curve around the starting point.

NORMAL shifts the points in and out along the local surface normal.

RADIAL shifts points in and out along a line through a central point given by the center parameter.

prototype:      status jitter(radius [,type [,cntr]])     (CS)

radius            number; jitter radius.

type              constant; UNIFORM, GAUSSIAN, NORMAL, or RADIAL.

cntr               vector or number; central point used by RADIAL.

smooth
smooth() is used to remove "kinks" in polygons that are connecting affected points.

prototype:      status smooth([iterations [,strength]])     (CS)

iterations       number; number of passes to use.

strength        number; strength of smoothing.

quantize
You can use the quantize() command to snap all the selected points to a three-dimensional grid defined by the size parameter.

prototype:      status quantize(size)      (CS)

size              vector or number; defines 3D grid.

mergepoints
mergepoints() can be used to merge selected points that lay within a certain minimum distance of each other. If the optional distance value is omitted, it is computed automatically.

prototype:      status mergepoints([dist])      (CS)

dist               number; the minimum point distance.

Object Commands

makebox
The makebox() command will create a three-dimensional box object with the specified extents and divisions.

prototype:      status makebox(lowcorner, highcorner [,nsegments])      (CS)

lowcorner       vector or number; low boundary point.

highcorner      vector or number; high boundary point.

nsegments     vector or number; count of box segments.

makeball
The makeball() command will create a three-dimensional, globe-like sphere.

prototype:      status makeball(radius, nsides, nsegments [,center])      (CS)

radius            vector or number; radius of sphere.

nsides           integer; number of sphere sides.

nsegments     integer; number of sphere segments.

center            vector or number; center of sphere.

maketesball
maketesball() is used to create a tessellated sphere. A tessellated sphere is similar to a globe sphere whose four-sided polygons have been tripled. The level parameter determines the amount of tessellation to be applied.

prototype:      status maketesball(radius, level [,center])      (CS)

radius            vector or number; radius of sphere.

level              integer; level of tessellation.

center           vector or number; center of sphere.

makedisc
Use the makedisc() command to create a cylindrical object with the number of sides and segments specified. The higher the number of sides, the smoother the cylinder will be.

prototype:      status makedisc(radius, top, bottom, axis, nsides [,nsegments [,center]] (CS)

radius            vector or number; radius of disc.

top                number; cylinder top along axis.

bottom          number; cylinder bottom along axis.

axis              constant; X, Y or Z.

nsides           integer; number of side.

nsegments     integer; number of segments (1).

center            vector or number; center of object.

makecone
Use the makecone() command to create a cylindrical object with the number of sides and segments specified. The higher the number of sides, the smoother the cylinder will be. makecone() will cause the top of the cylinder to narrow to a single point.

prototype:      status makecone(radius, top, bottom, axis, nsides[,nsegments [,center]] (CS)

radius            vector or number; radius of disc.

top                number; cylinder top along axis.

bottom          number; cylinder bottom along axis.

axis              constant; X, Y or Z.

nsides          integer; number of side.

nsegments    integer; number of segments (1).

center           vector or number; center of object.

maketext
The maketext() function will create a Modeler object that comprises the characters in a string. The resulting object will take on the aspect of the character font that has been loaded with the fontload() function. The font index value returned by fontload() must be passed to the maketext() function.

prototype:      number maketext(text, index, [,cornertype [,spacing[,scale[,axis[,pos]]]] (CS)

text               string; text to convert.

index             integer; font index from fontload().

cornertype     constant; SHARP or BUFFERED.

spacing          number; spacing between characters.

scale            number; character scaling factor.

axis              constant; X, Y or Z.

pos               vector or number;position of first character text.

The following LScript code snippet illustrates the use of these functions:

findex = fontload(fontName);
if(findex != nil)
{
    maketext("LScript",findex);

maketext() returns the width (in meters) of the resulting Modeler object.

Multiply Commands

lathe
lathe() will spin the current object around the specified axis, creating a new object with the indicated number of sides. The object to be lathed will typically be a two-dimensional template.

prototype:      status lathe(axis, nsides[,center [, end [, start]]])      (CS)

axis              constant; X, Y or Z.

nsides           integer; number of sides for new object.

center           vector or number; center about which to lathe.

end               number; ending angle in degrees.

start             number; starting angle in degrees.

extrude
extrude() is used to extend an object along a specified axis, optionally adding segments.

prototype:      status extrude(axis, extent[, nsegments])      (CS)

axis              constant; X, Y or Z.

extent           number; distance to extend along axis.

nsegments    integer; number of additional segment (default is 1).

mirror
The mirror() command will copy selected data through a plane, rotating it 180 degrees.

prototype:      status mirror(axis, offset)      (CS)

axis              constant; X, Y or Z.

offset             number; offset of plane along axis.

pathclone, pathextrude
The pathclone() and pathextrude() commands let you duplicate (clone) or extrude an object along a motion path created in and saved from LightWave 3D Layout. The optional start, end, and step parameters can be thought of as arguments to a loop counter. When you omit them, the starting and ending frames embedded in the motion path file are used as start and end, with a default step value of 1. By specifying these values, you can override those that appear in the motion path file.

You can vary the start and end values to cause your object to clone or extrude only along the portion of the motion path represented by those values. For instance, if a motion path were loaded that required 330 frames to traverse, issuing the command

pathextrude("my.mot",1,200,300);
pathextrude("my.mot",1,200,300) would cause your object to begin its extrusion at the frame-200 position of the motion path and continue on through frame-300 position. The sections of the path where your object would have extruded from frames 1 to 199, and from frames 301 to 330, will be empty.

Cloning an object using pathclone() will create a unique duplicate of your object at each step interval. Electing to extrude your object using pathextrude() will create one single, new object with a new segment at each step interval.

Both commands accept the same parameter counts and types.

prototype:      status pathextrude(filename, [,step[,start [,end]]])      (CS)

filename        string; name of motion path file.

step              number; count of objects/segments to create.

start              number; starting count.

end               number; ending count.

railextrude, railclone
railclone() and railextrude() are very similar to pathclone() and pathextrude() in that they will duplicate or extrude an object. Unlike their cousins, the rail commands operate using Modeler curves instead of motion path files. The curve (rail) to be used for either command must reside in a currently-active background layer.

prototype:      status railextrude(segs [,div [,flags [,strength]]])      (CS)

segs             number; segment count (0=compute).

div                constant; KNOTS or LENGTHS.

flags              string; "o" (orient) or "s" (scaled.)

strength        number.

soliddrill
soliddrill() is largely identical to axisdrill(), except that it uses a three-dimensional object in the active background layer(s), and it requires that the volume of the two objects (foreground and background) overlap.

prototype:      status soliddrill(operation[,surface])     (CS)

operation       constant, CORE, TUNNEL, SLICE or STENCIL.

surface          string, surface name(for STENCIL).

axisdrill
axisdrill() uses the two-dimensional object in the active background layer(s) as a template to "drill" through the object in the active foreground layer(s). Four different drilling operations are provided with axisdrill():

CORE will drill out the foreground polygons that fall within the background template’s shape, leaving only the core.

TUNNEL is the opposite of CORE; removes polygons that fall within the template’s shape, leaving non-core data.

SLICE cuts through the foreground object, creating a visible incision along the template’s edges.

STENCIL is identical to SLICE, except you can assign a surface name to all polygons that fall within the template’s shape.

The optional surface parameter is used when the STENCIL operation is specified.

prototype:      status axisdrill(operation, axis[,surface])      (CS)

operation       constant, CORE, TUNNEL, SLICE or STENCIL.

axis              constant, X, Y or Z (for STENCIL).

surface         string, surface name.

boolean
The boolean() command causes the object in the active foreground layer(s) to combine with the object in the active background layer(s). Four types of Boolean operation are supported:

UNION will merge the volumes of each object into a single, new object; interior surfaces where the two object overlap will be removed.

SUBTRACT will remove the volume of the background object(s) from the foreground object(s).

INTERSECT will create an object from the area the two objects had in common.

ADD will add background object(s) to the foreground object(s); intersection of polygons are sliced to form a common edge.

prototype:      status boolean(operation)      (CS)

operation        constant; UNION, SUBTRACT, INTERSECT or ADD.

bevel
The bevel() command allows you to add beveled edges to an object by specifying both inset and shift amounts.

prototype:      status bevel(inset, shift)      (CS)

inset             number; uniform amount of displacement along polygon plane.

shift              number; displacement amount perpendicular to polygon plane.

shapebevel
shapebevel() also adds a beveled edge to an object. However, it accepts a series of inset/shift pairs contained in a character string. Within the string, the inset/shift pairs are separated by a space. The same effect can be achieved using iterative or sequential bevel()s, but the results are not always correct because of the self-crossing effect that can occur.

The following code snippet that illustrates the use of this command was taken from that script:

prototype:      status shapebevel(pattern)      (CS)

pattern          string; pairs of inset/shift pairs.

Example:

s = string(-wide," ",wide," ",-wide," ",deep / 2);
shapebevel(s);

smoothshift
The smoothshift() command will shift selected polygons by aspecified offset. Any angles greater than  maxangle will cause the surface to break.

prototype:      status smoothshift(offset [,max [,scale]])      (CS)

offset             number; shift offset

max              number; maximum angle in degrees

scale             float; specifies the scaling factor.

smoothscale
The smoothscale() command will smooth scale the selected polygons by a specified offset distance.

Points and Polygons Commands

flip
flip() is used to reverse the surface normal of selected polygons. It can also be used to reverse the direction of Modeler curves.

prototype:      status flip(void)      (CS)

triple
triple() is used to convert all selected polygons into triangles. In particular, you will want to triple() an object (especially if it contains four-sided polygons) prior to subdividing it. The following code snippet illustrates this:

prototype:      status triple(void)      (CS)

Example:

points = polycount();
if(points[5] or points[6])
    // it has polygons with 4 or more sides
    triple();
    subdivide(METAFORM);

freezecurves
Use freezecurves() to convert all selected Modeler curves directly into polygons.

prototype:      status freezecurves(void)      (CS)

alignpols
The alignpols() command "flips" all selected polygons so they face the same direction (as much as is possible).

prototype:      status alignpols(void)      (CS)

removepols
removepols() will delete all selected polygons, leaving only their points.

prototype:      status removepols(void)      (CS)

unifypols
unifypols() will remove any duplicate polygons.

prototype:      status unifypols()      (CS)

skinpols
skinpols() will create a triangle mesh that connects two or more polygons and encloses the volume between them. This is sometimes called lofting. The original polygons aren’t required to have the same number of vertices.

prototype:      skinpols()      (CS)

mergepols
mergepols() will merge selected polygons into a single polygon. Each selected polygon must share at least one edge with another.

prototype:      mergepols()      (CS)

subdivide
Use subdivide() to split all triangles into four smaller triangles. This command will also split quads into four smaller quads. subdivide() supports three different forms:

FLAT subdivides polygons and leaves the newly divided polygons in the same plane as the originals.

SMOOTH extrapolates where subdivided detail should be placed to maintain and enhance the curvature of the original form

METAFORM smoothes dramatically; locations with greater detail will have more detail in the smoothing process.

prototype:      status subdivide(mode [,max])      (CS)

mode            constant; FLAT, SMOOTH or METAFORM.

max              number; maximum angle to consider (in degrees).

fracsubdivide
fracsubdivide() is similar to subdivide(), except that you can apply a fractal displacement value to each new vertex as a function of its position.

prototype:       status fracsubdivide(mode, fractal [,max])      (CS)

mode             constant; FLAT, SMOOTH or METAFORM.

fractal            number; fractal displacement amount.

max              number; maximum angle to consider (in degrees).

pointcount
pointcount() returns the number of selected points in the active foreground layer(s). This value will be identical to that returned by the editbegin() function. pointcount() can be called at any time.

prototype:      result pointcount()      (IN)

result            integer; selected-point count.

polycount
The return value of polycount() is more complex than pointcount(), as it groups return values by the number of vertices a polygon contains. polycount() returns six (6) integer elements, representing:

1      total number of selected polygons

2      total number of selected polygons that contain only one point.

3      total number of selected polygons that contain only two points.

4      total number of selected polygons that contain only three points.

5      total number of selected polygons that contain only four points.

6      total number of selected polygons that contain more than four points.

This data can be used to examine the state of an object. For instance, before METAFORMing an object, you must convert all four-sided polygons into triangles. You could accomplish this with the following code snippet:

totalpoints[6];
totalpoints = polycount();
if(totalpoints[5] || totalpoints[6])
    triple();

subdivide(METAFORM);

prototype:      result pointcount()      (IN)

result            integer; selected point count.

weldpoints
weldpoints() will merge selected points into a single point. The position of the resulting point is the same as that of the lastselected point before the weld.

prototype:      weldpoints()      (CS)

splitpols
splitpols() will divide a polygon into two smaller polygons. The new edge is created between selected points.

prototype:      splitpols()      (CS)

morphpols
morphpols() create a triangle mesh that connects exactly two polygons with the same number of vertices. The new mesh is divided into a number of segments along the line connecting the two original polygons.

prototype:      morphpols(nsegments)      (CS)

nsegments    integer; segments.

smoothcurves
Use smoothcurves() to smooth a composite of two curves at their joining point.

prototype:      smoothcurves()      (CS)

toggleCCstart, toggleCCend
toggleCCstart() and toggleCCend() affect the way the first and last points in curves are interpreted. You use toggleCCstart to toggle "on," the first (or last) point in a curve, and the point becomes a continuity control point. This point and the curve segment connected to it are no longer part of the curve, but the point can affect the shape of the first (or last) segment that is still part of the curve. toggleCCend toggles "off" the point.

prototype:      toggleCCstart()      (CS)

prototype:      toggleCCend()       (CS)

togglepatches
Toggling togglepatches() "on" converts the selected geometry into a subpatch control cage.

prototype:      togglepatches()      (CS)

make4patch
Use make4patch() to create a quad mesh from three or four curves. The perpendicular and parallel values determine the number of segments that will be created in directions perpendicular and parallel to the last-selected curve. The curves must share vertices to form a closed area.

prototype:              make4patch(nperpendicular, nparallel)     (CS)

nperpendicular        number of perpendicular segments.

nparallel                 number of parallel segments.

prototype:      swaphidden()      (CS)

changepart
(Re)assigns the part name of the currently selected polygons.

prototype:      changepart(name)      (CS)

unweld
unweld() disconnects the shared vertices of two or more polygons so that each has a complete set of unshared points.

prototype:      unweld()      (CS)

weldaverage
weldaverage() will weld selected points to their average position in 3D space.

prototype:      weldaverage()      (CS)

Surface Commands

setsurface
setsurface() sets the surface name to which all new data will be assigned. If it does not exist, it will be created.

prototype:     status setsurface(name)      (CS)

name           string; new surface name.

getdefaultsurface
The getdefaultsurface() command returns the selected surface name.

prototype:      string getdefaultsurface(void)      (IN)

changesurface
changesurface() will assign all selected polygons to a new or existing surface name.

prototype:      status changesurface(name)      (CS)

string             string; surface name to which selected polygons will belong.

nextsurface
nextsurface() allows you to navigate through Modeler’s internal list of surface names. Calling nextsurface() without parameters will return the first surface name in Modeler’s list. The next surface name can be returned by passing nextsurface() the name of the surface that precedes it. If the surface name provided is at the end of the list, a value of nil will be returned.

prototype:      result nextsurface([name])      (IN)

result            string; surface name.

name            string; optional surface name.

Example:

// display all the current surface names
surface = nextsurface();
info(surface);
while(true)
{
    if((surface = nextsurface(surface)) == nil)
    break;

     info(surface);
}

renamesurface
renamesurface() lets you change the name of an existing surface. Once renamed, the original surface name will no longer exist.

prototype:      status renamesurface(orig, new)      (IN)

orig               string; existing surface name.

new               string; new surface name.

createsurface
The createsurface() command will add a new surface name to Modeler’s internal list. If a surface with this name already exists, no action is taken.

prototype:      status createsurface(name)      (IN)

name            string; new surface name.

copysurface
The copysurface() command will add a new surface name to Modeler’s internal list, and copy the attributes of an existing surface into it.

prototype:      status copysurface(orig, new)      (IN)

orig               string; existing surface name.

new              string; new surface name.

Font Commands

fontcount
fontcount() will return the number of fonts that are currently loaded into Modeler. If the internal font list is empty, nil is returned.

prototype:      result fontcount(void)      (IN)

result            integer; number of fonts loaded.

fontindex
Given a font name, fontindex() will return the index value of that font. If the specified font cannot be located, nil is returned.

prototype:      result fontindex(name)      (IN)

result            integer; font index.

name            string; font name.

fontname
fontname() will return the name of the specified font when it is given a font index (returned by either fontload() or fontindex()).. If the provided index is invalid, nil is returned.

prototype:      result fontname(index)      (IN)

result            string or nil; font name.

index            integer; font index value.

fontload
fontload() lets you load Postscript fonts into Modeler to use with the text creation commands. The companion command fontclear() (discussed next) should be called when you are finished with a particular font.

prototype:      result fontload(name)      (IN)

result            integer; font index or nil.

name            string; font name with optional path.

Example:

fontName = getfile("Select a Font");
if(fontName == nil)
    return;
findex = fontload(fontName);
if(findex != nil)
{
    maketext("LScript",findex);
    fontclear(findex); // release the font immediately

fontclear
fontclear() should be called when you no longer need a Modeler font that has been loaded with the fontload() command.

prototype:      status fontclear(index)      (IN)

index             integer; font index value.

Plug-ins

cmdseq
cmdseq() lets your LScript invoke other plug-ins that have been installed into Modeler. This interface to other plug-ins is unidirectional, meaning you can pass information to them, but they cannot return values.

The name used to invoke another plug-in should be identical to the name that appears in your Custom menu button. The arguments you pass to a plug-in depend upon how that plug-in has been programmed. Most plug-ins will not accept parameters, not having been specifically designed to be invoked in this fashion.

prototype:       status cmdseq(name[,arguments])      (CS)

name             string; plug-in name.

arguments      string; value varies by plug-in.

Layer Commands

lyrfg
lyrbg

The lyrfg() and lyrbg() commands return the selected Modeler layers into the foreground—with the lyrfg() command —or the background—with the lyrbg() command used. Typically, you assign the return value of each of these commands to an array, but you can assign the value to a non-array variable by using associative assignments.

Usually, you will use these commands to "remember" the layers that the user has actively selected before your LScript starts changing any settings. When you are done, you should politely restore the users original layer settings by passing these values to the lyrsetfg() (or lyrsetbg() if the array contains active background information).

prototypes:      result lyrfg()      (IN)

                      result lyrbg()     (IN)

result integer[]; one or more layer values.

lyrdata, lyrempty
The lyrdata() and lyrempty() functions return an array of elements representing the layer numbers that either contain mesh data (lyrdata), or are empty of all data (lyrempty).

These functions will return a layer value, regardless of whether the layer is active foreground, active background, or entirely unselected. The prototypes for these functions are as follows:

prototypes:      result lyrdata()      (IN)
                     result lyrempty()   (IN)

result integer[]; one or more layer values.

lyremptyfg
lyremptybg

lyremptyfg() and lyremptybg() will return empty layers in the selected foreground or background layer(s), respectively. They will return nil if neccesary.

prototypes:      result lyremptyfg()      (IN)

                      result lyremptybg()     (IN)

result integer[]; one or more layer values.

lyrswap
lyrswap() can be used to instantly reverse the selected layer(s). Selected foreground layer(s) become selected background layer(s), while selected background layer(s) become the active foreground layers(s).

This command is identical to the single-quote key (‘) used in Modeler to swap layers.

prototype:      lyrswap()      (IN)

lyrsetfg, lyrsetbg
The lyrsetfg()and lyrsetbg() functions accept either an array of integer numbers, or a variable number of integer values that indicate the layer(s) to be selected as active.

prototypes:      lyrsetfg(lyr1[,lyr2...lyr20])      (IN)
                     lyrsetbg(layers)                    (IN)

lyr1 integer; layer number.

lyr2..lyr20 additional layers.

layers integer[]; elements are layer numbers.

setlayername
setlayername() sets the name for the selected foreground layer(s). Calling the function with no arguments removes any previously set layer names.

prototype:       setlayername([layerName])      (CS)

layername      string; name for the layer name.

Selection Commands

selpoint
Of all other LScript commands (except possibly selpolygon(), discussed next), selpoint() has the most complex parameter structure. selpoint() contains two "major modes" and a plethora of "minor modes" each with their own parameter counts and types.

Major Modes:

SET: the minor mode that follows, if any, will define points to be selected.

CLEAR: the minor mode that follows, if any, will define points to be deselected

One of these two major modes will always be the first parameter in selpoint(). They are the only non-optional parameters for the command, and can appear in the parameter list by themselves (i.e., selpoint(CLEAR) will deselect all selected points).

The minor modes supported by selpoint() let you designate point selection in a number of ways. The minor modes for selpoint() include:

Minor Modes:

VOLUME

Arguments: two vectors, indicating the low and high points of the bounding box

Description: selects/clears points that fall within a specified bounding box

CONNECT

Arguments: none

Description: selects points that are connected to points that are already selected. Works only with the SET major mode

NPEQ

Arguments: number, indicating the count of points that qualifying polygons should contain

Description: selects/clears all points belonging to polygons that contain exactly the number of points specified by the argument

NPLT

Arguments: number, indicating the count of points that qualifying polygons should not exceed

Description: selects/clears all points belonging to polygons that contain fewer than the number of points specified by the argument

NPGT

Arguments: number, indicating the count of points that qualifying polygons should exceed

Description: selects/clears all points belonging to polygons that contain more than the number of points specified by the argument

POINTNDX

Arguments: number, representing the linear index of the point; array, containing a list of integer values that represent linear point indices; initialization block, containing integer values representing linear point indices.

Description: selects/clears the point that exists in Modeler’s internal list of points at the specified index

POINTID

Arguments: point identifier, derived from some MeshDataEdit mode function; or an array or initialization block of point identifiers, as described in POINTNDX.

Description: selects/clears all points identified by the provided point identifier(s) It is important to note that you need to set your script into USER mode using the selmode() command before selpoint() (and selpolygon()) will work properly.

prototype:      status selpoint(major[,minor,params])     (CS)

major            constant; SET or CLEAR.

minor            constant; VOLUME, CONNECT, NPEQ, NPLT, NPGT or POINTID.

params         varies; minor-mode parameters outlined previously.

selpolygon
selpolygon() is a companion command to selpoint() that lets you select/deselect whole polygons instead of single points. While its major modes are identical to selpoint(), its minor modes vary in both numbers and functionality:

Major Modes:

SET: the minor mode that follows, if any, will define points to be selected.

CLEAR: the minor mode that follows, if any, will define points to be deselected

Minor Modes:

VOLEXCL

Arguments: two vectors, indicating the low and high points of the bounding box

Description: selects/clears polygons whose points fall completely within the specified bounding box

VOLINCL

Arguments: two vectors, indicating the low and high points of the bounding box

Description: selects/clears polygons that have at least one point that falls within the specified bounding box

CONNECT

Arguments: none

Description: selects polygons that are connected to polygons that are already selected. Works only with the SET major mode

NVEQ

Arguments: number, indicating the count of vertices that qualifying polygons should contain

Description: selects/clears all polygons that contain exactly the number of vertices specified by the argument

NVLT

Arguments: number, indicating the count of vertices that qualifying polygons should not exceed

Description: selects/clears all polygons that contain fewer than the number of vertices specified by the argument

NVGT

Arguments: number, indicating the count of vertices that qualifying polygons should exceed

Description: selects/clears all polygons that contain more than the number of vertices specified by the argument

SURFACE

Arguments: string, indicating the name of the surface assigned to qualified polygons

Description: selects/clears all polygons that have been assigned the specified surface name

FACE

Arguments: none

Description: selects/clears all polygons that Modeler considers to be of type "face"

CURVE

Arguments: none

Description: selects/clears all polygons that Modeler considers to be of type "curve".

NONPLANAR

Arguments: number, an optional numeric value that indicates the planar selection limit.

Description: selects/clears polygons that are less planar than the specified argument; if the optional argument is omitted, then the user’s default planar limit will be used.

POLYNDX

Arguments: number, representing the linear index of the polygon; array, containing a list of integer values that represent linear polygon indices; initialization block, containing integer values representing linear polygon indices.

Description: selects/clears the polygon that exists in Modeler’s internal list of polygons at the specified index.

POLYID

Arguments: identifier, derived from some MeshDataEdit mode function; or an array or initialization block of polygon identifiers, as described in POLYNDX.

Description: selects/clears all polygons identified by the provided polygon identifier(s)

PART

Part Name Selects a part by name.

BONE

These selection types are without argument, and will select all elements of that type within the current mesh. Is a synonym for Skelegon, and you can in fact also specify…

SKELEGON PATCH

These selection types are without argument, and will select all elements of that type within the current mesh.

MBALL

These selection types are without argument, and will select all elements of that type within the current mesh. stands for Metaball As with selpoint(), you must set your script session into USER mode using the selmode() command for selpolygon() to function properly.

prototype:      status selpolygon(major [,minor, params])      (CS)

major            constant; SET or CLEAR.

minor            constant; VOLEXCL, VOLINCL, CONNECT, NVEQ, NVLT, NVGT,
                   SURFACE, FACE, CURVE, NONPLANAR or POLYID.

params         varies; minor-mode parameters outlined previously.

selmode
selmode() is used by a number of different Modeler-specific commands, particularly the selpoint() and selpolygon() commands. Selection mode can be GLOBAL, USER, or DIRECT. GLOBAL selection is the default mode.

GLOBAL: All elements, whether or not they’re selected by the user.

USER: Only those elements selected by the user. This includes the implicit selection of all elements when nothing is explicitly selected, and selections by volume.

DIRECT: Elements selected directly with the point or polygon selection tools. This applies to both points and polygons regardless of which is currently active in the interface.

The selection commands selpoint() and selpolygon() will not function unless the USER selection mode is active.

prototype:      selmode(mode)      (IN)

mode            constant; GLOBAL, USER, or DIRECT.

selinvert
The selinvert() command will invert the current selection state (i.e., selected items become deselected while unselected items become selected).

prototype:      status selinvert(void)      (CS)

selhide
selhide() will hide from view all data that is either selected, if the SELECTED option is used, or unselected, if the UNSELECTED option is used.

prototype:      status selhide(which)      (CS)

which            constant; SELECTED or UNSELECTED.

selunhide
The selunhide() command is a companion to selhide(), and is used to bring the hidden data back into view.

prototype:      status selunhide()      (CS)