Skip to content

Instantly share code, notes, and snippets.

@JokerMartini
Created August 20, 2015 15:51
Show Gist options
  • Save JokerMartini/5ffffb699428776de1ca to your computer and use it in GitHub Desktop.
Save JokerMartini/5ffffb699428776de1ca to your computer and use it in GitHub Desktop.
Maxscript: This snippet demonstrates a simple plane primitive plugin for 3ds Max.
plugin simpleObject quad
name:"Quad"
category:"Training Primitives"
classID:#(0x4927806d, 0x3d9ca278)
(
parameters main rollout:params
(
width type:#float ui:width default:0
length type:#float ui:length default:0
)
rollout params "Parameters"
(
spinner width "Width: " range:[0,10000,0] fieldWidth:50
spinner length "Length : " range:[0,10000,0] fieldWidth:50
)
on buildMesh do
(
vert_array = #()
face_array = #()
vert_array[1] = [0, 0, 0]
vert_array[2] = [width, 0, 0]
vert_array[3] = [width, length, 0]
vert_array[4] = [0, length, 0]
if width * length >= 0 then
(
face_array[1] = [1, 2, 3]
face_array[2] = [3, 4, 1]
)
else
(
face_array[1] = [3, 2, 1]
face_array[2] = [1, 4, 3]
)
setMesh mesh verts:vert_array faces:face_array
setEdgeVis mesh 1 3 false
setEdgeVis mesh 2 3 false
)
tool create
(
on mousePoint click do
case click of (1: coordsys grid (nodeTM.translation = gridPoint))
on mouseMove click do
case click of (2:(width = gridDist.x; length = gridDist.y); 3: #stop)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment