TubeDesignCmd: Commander.CommandProc ~ {
NewControl:
PROC
[name:
ROPE,
min,
max,
init:
REAL,
lin:
BOOL
¬
TRUE,
precision:
NAT
¬ 3]
RETURNS [c: Control] ~ {
c ¬ Controls.NewControl[
name, vSlider, t, min, max, init, TubeControl,, precision,,,,,,,,, IF lin THEN lin ELSE exp];
};
err: ROPE;
t: Tool ~ NEW[ToolRep];
SELECT Args.NArgs[cmd]
FROM
0 => t.tube ¬ ResetTube[];
1 => IF (err ¬ TubeFromFile[t, Args.GetRope[cmd]]) # NIL THEN RETURN[$Failure, err];
ENDCASE => RETURN[$Failure, designUsage];
t.details ¬ NEW[G3dTube.DetailsRep];
t.pendings ¬ NEW[PendingsRep];
t.hold ¬ G3dControl.InitHold[TubeControl, t];
t.tw0 ¬ NewControl["tw0", -1000., 1000., 0.0];
t.tw1 ¬ NewControl["tw1", -1000., 1000., 0.0];
t.tens0 ¬ NewControl["tens0", -3.0, 3.0, 0.0];
t.tens1 ¬ NewControl["tens1", -3.0, 3.0, 0.0];
t.r0 ¬ NewControl["r0", 0.0, 0.5, 0.0];
t.r1 ¬ NewControl["r1", 0.0, 0.5, 0.0];
t.size ¬ NewControl["size", 0.0, 4.0, 1.0];
t.epsilon ¬ NewControl["eps", 0.0, 0.2, 0.03, FALSE];
t.taper ¬ NewControl["taper", -3.0, 3.0, 0.0, FALSE];
t.cres ¬ NewControl["cres", 2.0, 25.0, 6.0, TRUE, 0];
t.lim ¬ NewControl["lim", 0.0, 1000.0, 500.0, TRUE, 0];
t.pendings ¬ NEW[PendingsRep ¬ [shape: TRUE]];
MakePick[t];
SetPick[t];
Moused[t, [[0, 0], up, left], $Buttons];
t.renderTool ¬ G3dTool.MakeTool[
name: Rope.Concat["3dTube ", IF t.tube # NIL THEN t.tube.name ELSE NIL],
extraButtons:
LIST[
Controls.ClickButton["Tube Ops", TubeOps, t],
Controls.ClickButton["IO Ops", IOOps, t],
Controls.ClickButton["Draw Ops", DrawOps, t]],
extraControls:
LIST[
t.hold.x, t.hold.y, t.hold.z, t.hold.pitch, t.hold.yaw, -- t.hold.roll, -- t.hold.mag,
t.tw0, t.tw1, t.r0, t.r1, t.tens0, t.tens1,
t.lim, t.epsilon, t.taper, t.size, t.cres],
controlSizes: [20, 200, 55, 20, 55, 150, 150],
client: [data: t, mouse: MouseProc, draw: DrawProc, destroy: DestroyProc],
ops: [FALSE, FALSE, FALSE, FALSE, FALSE, FALSE],
useArcBalls: FALSE,
arcBallSize: 80,
icon: icon];
};