UModeler X MCPis live — model with an AI agent
UModeler X

Scene Script Syntax (umx_parametric_shape)

Full syntax reference for the umx_parametric_shape script, which creates and edits parametric shapes.

umx_parametric_shape creates and edits the scene's parametric shapes from a single script. The Script Window uses the same syntax.

group "Table" @0,0,0
  box "Top" w=2 h=.1 d=1 @0,1,0
    mod subdivide
  cylinder "Vase" r=.15 h=.4 pivot=bottom @0,1.05,0

Statements

StatementWhat it does
<kind> ["name"] [k=v ...]Create a shape
group ["name"]Create an empty GameObject group
mod <type> [k=v ...]Add a modifier to the previous node
@"name" / @#idEdit an existing object
del "name" / del #idDelete
prefab "Asset" ["inst"]Place a prefab instance
save prefab "name" ["path"]Save the target as a prefab asset

Basic rules

  • One statement per line.
  • A 2-space indent means "child". Depth cannot increase by more than one level at a time, and tabs are not allowed.
  • A line starting with # is a comment.
  • Names are wrapped in double quotes and may contain spaces.
  • kind and parameter keys (the k in k=v) must be lowercase. Box and Width=2 are errors.
  • Decimals use a period. A leading zero may be omitted, as in .1.

Creating shapes

box "Crate" w=1 h=1 d=1 @0,0,0

The available kind values are:

box  sphere  cylinder  capsule  cone  torus  pipe  icosphere
stair  spiralstair  room  wedge  arch  dome  regpoly
superellipsoid  nurbs  gear  quadstrip (alias strip)  ngon  layout
group

Which parameters each type uses is listed in Shape Types and Parameters.


Transform tokens

TokenMeaning
@x,y,zPosition. Local when the line has a parent, world at the top level.
rot=x,y,zEuler rotation in degrees
sc=kUniform scale. sc=x,y,z sets it per axis.

All three apply to the object's Transform and are independent of the parametric parameters.


Parameter keys

Values are written as k=v. Both the short alias and the canonical name work.

AliasCanonicalType
wwidthfloat
hheightfloat
ddepthfloat
rradiusfloat
r1radius1float
r2radius2float
ththicknessfloat
shstepheightfloat
swstepwidthfloat
anganglefloat
—rotationfloat
segsegmentsint
—sidesint
—ringsint
ordorderint
sweepsweepangleint
e1roundness1float
e2roundness2float
cucontrolsuint
cvcontrolsvint
—widthsegs · depthsegs · heightsegsint
—heightsegment · disksegments · heightsegmentsint
ccwcounterclockwisebool
—closedbool
—curvedbool
—collider / collidermodebool
polypolyhedrontypestring
matmaterialasset path or name
hshotspotasset path or name

Booleans are turned on with 1 / true and off with 0 / false.

Keys that mean different things per kind

KindKey meanings
spiralstairr = center radius, sw = stair (tread) width, ang = start angle, sweep = total sweep (1 – 360), ccw=1 = spiral counter-clockwise
superellipsoide1 / e2 = vertical and horizontal roundness exponents (0.01 ≈ cube-like, 1 = ellipsoid, above 2 = concave star)
nurbscu / cv = control point counts, ord = degree, widthsegs / depthsegs = tessellation
quadstripcu = control point count (2 – 32), depthsegs = curve segments per span, w = ribbon width, th = thickness (0 = flat strip), ang = total twist, r1 / r2 = start and end width scale, closed=1 = closed loop
ngonr = circumradius, sides = vertex count (3 – 128), th = thickness (0 = a single flat face), curved=1 = closed curved contour, depthsegs = curve segments in curved mode
layoutw / d / h = size of the mesh-less AABB box (drawn as a wire box in the Scene view)
gearr1 = tip radius, r2 = root radius, r = bore radius, h = thickness, sides = teeth, th = tip tooth width ratio, ang = pressure angle

Pivot and anchoring

TokenMeaning
pivot=<keywords>Snap to an anchor point on the parent bounds.
pivot=<percent>Snap to a relative position (%) inside the parent bounds.
pivot=x,y,zThis shape's own absolute pivot.
offset=x,y,zLocal offset from the anchor point
ratio=field,fieldRead the listed size fields as ratios of the parent.

Anchor keywords

left right (X) · bottom top (Y) · back front (Z) · center

Join several axes with hyphens. Unspecified axes are centered.

pivot=bottom          # Y at min, X and Z centered
pivot=top-right       # Y at max, X at max
pivot=bottom-left-back

Percent

If the value contains a % anywhere, it is read as percent mode and each component is divided by 100.

pivot=50%,0%,50%     # center of the bottom face

Without a %, 0.5,0,0.5 is an absolute pivot coordinate, not a percentage.

Ratio sizes

Fields listed in ratio= treat their value as a ratio of the parent axis. With h=0.5 and ratio=height, the effective height is half the parent's.

Only these field names are accepted, and they are case-sensitive.

width  depth  height  radius  radius1  radius2  thickness  stepWidth  stepHeight
layout "Room" w=6 d=4 h=3 @0,0,0
  box "Ceiling" pivot=top ratio=width,depth w=1 d=1 h=0.2

Anchoring only works when the parent is a parametric shape or a layout. For the concepts, see Pivot and Anchoring.


Material and hotspot

box "Wall" w=4 h=3 d=.2 mat=Wood hs=Walls
box "Wall2" w=4 h=3 d=.2 mat="Assets/Materials/Wood.mat"
  • mat= — the material to apply, by asset path or asset name.
  • hs= — a hotspot layout asset to fit UVs to. When set, every face is fitted to the hotspot rects instead of the default procedural unwrap. Omit it to keep the default UVs.

Collider mode

box "TriggerVolume" w=2 h=2 d=2 collider=1

With collider=1 the renderable is hidden and a collider represents the shape. Box, Sphere, Icosphere, Capsule and Layout use primitive colliders without building a mesh; other kinds build the mesh and expose it through a MeshCollider. Dimensions stay in sync with the parameters, and isTrigger / convex are preserved.


Modifiers (mod)

Indent by 2 spaces under the previous node.

cylinder "Column" r=.3 h=4
  mod twist angle=360 twistaxis=Y
  mod subdivide

The available types are:

Twist  Bend  Push  Mirror  Screw  Subdivide  Shell  Decimate
LinearArray  RadialArray  FFD2x2x2  FFD3x3x3  FFD4x4x4
  • Type names and parameter names are case-insensitive.
  • The parameters are the ones exposed in the Inspector. Values may be floats, ints, booleans, vectors (x,y,z) or enum names.
  • An unknown type or parameter is rejected before execution and comes back with the list of valid values.

Modifiers cannot be attached to a group.


Groups

group "Chair" @0,0,0
  box "Seat" w=.5 h=.05 d=.5 @0,.45,0
  box "Leg" w=.05 h=.45 d=.05 @-.2,0,-.2

group is an empty GameObject. It accepts position, rotation and scale only — shape parameters, pivot, offset, ratio and modifiers are not allowed. Using them is reported as an error rather than silently ignored.


Editing existing objects

Open an object already in the scene with @"name" or @#id.

@"Top" w=2.4 h=.08
@"Top" @0,1.2,0 rot=0,45,0
@"Top"
  mod shell thickness=.02
  cylinder "Knob" r=.03 h=.05 @0,.08,0
  • Parameters, pivot and the local transform can be changed.
  • Child shapes and mod lines may be indented underneath. Children are parented to the target.
  • The parent is never changed.
  • If the target is not a parametric shape, only the transform is applied; parameters and modifiers are ignored with a warning.

Deleting

del "Knob"
del #-8123

del takes only a target. Adding parameters, a transform or a pivot is an error.


Prefabs

prefab "Chair" "Chair_A" @2,0,0
save prefab "Table" "Assets/Props/Table.prefab"

prefab — places an instance of an existing prefab asset. The first string is the prefab name or path; the second (optional) is the instance name. It takes a transform only — no children, modifiers or shape parameters.

save prefab — saves a scene object as a prefab asset. Omitting the path uses Assets/<objectName>.prefab; a given path must end with .prefab. Nested parametric shapes are saved along with it.


Object references and #id

The created and updated lists come back in "Name#id" form.

Created: Table#-8120, Top#-8123

#id works anywhere "name" does — del #-8123, @#-8123.

When several objects share a name, the first match is used and a warning is returned. Use #id when you must target exactly one.


Result data

A finished run returns the following.

FieldContents
createdCreated objects ("Name#id")
updatedUpdated objects
deletedNames of deleted objects
modifiersAddedNumber of modifiers added
failedFailed nodes — line number and reason
warningsWarning list

If the parse, validation or preflight stage reports an error, the scene is not touched at all. If an individual node fails during execution, only that node and its children are skipped and everything else proceeds, leaving the successful part in place.


Full example

# A bench
group "Bench" @0,0,0
  box "Seat" w=1.8 h=0.06 d=0.45 @0,0.44,0
  box "LegLeft" w=0.06 h=0.44 d=0.4 @-0.8,0,0
  box "LegRight" w=0.06 h=0.44 d=0.4 @0.8,0,0
  cylinder "BackRail" r=0.03 h=1.7 rot=0,0,90 @0,0.85,0.2
    mod twist angle=20 twistaxis=Y

# A ceiling panel sized as a ratio of the room
layout "Room" w=6 d=4 h=3 @10,0,0
  box "CeilingPanel" pivot=top ratio=width,depth w=0.9 d=0.9 h=0.1

# Thicken a seat that already exists
@"Seat" h=0.09
Scene Script Syntax (umx_parametric_shape) | UModeler X Manual