arcburn
04-06-2006, 12:26 AM
I am trying to work from the scripted primitive example in the MaxScript Reference and extend it further.
I scripted a box that draws upon another box.
The problem is the second box starts at the gridpoint that begins the primitive "nodeTM.translation = gridPoint"
How can I make the second box begin at the height of the first box?
plugin simpleObject squareTube
name:"SquareTube"
classID:#(63445,55332)
category:"Scripted Primitives"
(
local box1, box2
parameters main rollout:params
(
length type:#worldUnits ui:length default:1E-3
width type:#worldUnits ui:width default:1E-3
height type:#worldUnits ui:height default:1E-3
Ilength type:#worldunits ui:Ilength default:1E-3
Iwidth type:#worldunits ui:Iwidth default:1E-3
Iheight type:#worldUnits ui:height default:1E-3
)
rollout params "SquareTube"
(
spinner height "Height" type:#worldUnits range:[1E-3,1E9,1E-3]
spinner width "Width" type:#worldUnits range:[1E-3,1E9,1E-3]
spinner length "Length" type:#worldUnits range:[-1E9,1E9,1E-3]
spinner Iheight "Height" type:#worldUnits range:[1E-3,1E9,1E-3]
spinner Ilength "InnerBox" type:#worldUnits range:[-1E9,1E9,1E-3]
spinner Iwidth "InnerBox" type:#worldUnits range:[-1E9,1E9,1E-3]
)
on buildMesh do
(
if box1 == undefined then
(
box1 = createInstance box; box2 = createInstance box
)
box1.height = height;
box1.width = width;
box1.length = length;
box2.height = Iheight;
box2.width = Iwidth;
box2.length = Ilength;
mesh = box2.mesh + box1.mesh
)
tool create
(
on mousePoint click do
case click of
(
1: nodeTM.translation = gridPoint
5: #stop
)
on mouseMove click do
case click of
(
2: (Iwidth = abs gridDist.x; Ilength = abs gridDist.y)
3: (width = abs gridDist.x; length = abs gridDist.y)
4: Iheight = gridDist.z;
5: height = gridDist.z;
)
)
)
I scripted a box that draws upon another box.
The problem is the second box starts at the gridpoint that begins the primitive "nodeTM.translation = gridPoint"
How can I make the second box begin at the height of the first box?
plugin simpleObject squareTube
name:"SquareTube"
classID:#(63445,55332)
category:"Scripted Primitives"
(
local box1, box2
parameters main rollout:params
(
length type:#worldUnits ui:length default:1E-3
width type:#worldUnits ui:width default:1E-3
height type:#worldUnits ui:height default:1E-3
Ilength type:#worldunits ui:Ilength default:1E-3
Iwidth type:#worldunits ui:Iwidth default:1E-3
Iheight type:#worldUnits ui:height default:1E-3
)
rollout params "SquareTube"
(
spinner height "Height" type:#worldUnits range:[1E-3,1E9,1E-3]
spinner width "Width" type:#worldUnits range:[1E-3,1E9,1E-3]
spinner length "Length" type:#worldUnits range:[-1E9,1E9,1E-3]
spinner Iheight "Height" type:#worldUnits range:[1E-3,1E9,1E-3]
spinner Ilength "InnerBox" type:#worldUnits range:[-1E9,1E9,1E-3]
spinner Iwidth "InnerBox" type:#worldUnits range:[-1E9,1E9,1E-3]
)
on buildMesh do
(
if box1 == undefined then
(
box1 = createInstance box; box2 = createInstance box
)
box1.height = height;
box1.width = width;
box1.length = length;
box2.height = Iheight;
box2.width = Iwidth;
box2.length = Ilength;
mesh = box2.mesh + box1.mesh
)
tool create
(
on mousePoint click do
case click of
(
1: nodeTM.translation = gridPoint
5: #stop
)
on mouseMove click do
case click of
(
2: (Iwidth = abs gridDist.x; Ilength = abs gridDist.y)
3: (width = abs gridDist.x; length = abs gridDist.y)
4: Iheight = gridDist.z;
5: height = gridDist.z;
)
)
)
