choice:
INT ¬ Controls.PopUpRequest[["Output"],
LIST[
-- 1 -- ["Read Shape"],
-- 2 -- ["Read Shape and Auto Scale"],
-- 3 -- ["Write .SHAPE", "Output a points-polygons shape file"],
-- 4 -- ["Write .NONE", "Output a points-polygons .none file"],
-- 5 -- ["Write INTERPRESS", "Output interpress file of the current display"],
-- 6 -- ["IP stroke width", "width of strokes for IP output"],
-- 7 -- ["Write RIB", "write output to a named file"]]];
SELECT choice
FROM
1 => ReadShape[t, FALSE];
2 => ReadShape[t, TRUE];
3, 4 => {
shape: INT ¬ G3dTool.ChooseShape[t, "Output Shape"];
SELECT shape
FROM
-2 => G3dTool.TSWrite[t, "No shape to write."];
-1 => G3dTool.TSWrite[t, "Choose only one shape."];
ENDCASE => {
r: ROPE ¬ Controls.TypescriptReadFileName[t.typescript];
IF choice = 3
THEN G3dShape.ShapeToFile[r, t.shapes[shape]]
ELSE {
out: STREAM ¬ FS.StreamOpen[r, $create];
s: Shape ¬ t.shapes[shape];
IF NOT s.vertices.valid[normal] THEN G3dShape.SetVertexNormals[s];
IF
NOT G3dShape.ShapeToStreamPerFormat[s, out, $DotNone]
THEN G3dTool.TSWrite[t, "can't write shape"];
IO.Close[out];
};
};
};
5 => {
Draw: Controls.DrawProc ~ {
v: G3dTool.View ¬ G3dTool.GetView[viewer, t];
G3dTool.Draw[context, viewer, $IPOut, v.camera.matrix, v.viewport, v, t, t];
};
t.forInterpress ¬ TRUE;
Draw2d.IPOut[Controls.TypescriptReadFileName[t.typescript], Draw, t];
t.forInterpress ¬ FALSE;
};
6 => t.ipStrokeWidth ¬ Controls.GetReal[t.typescript, "Stroke width", t.ipStrokeWidth];
7 => G3dTool.WriteRIBtoFile[t, Controls.TypescriptReadFileName[t.typescript]];
ENDCASE;
G3dTool.SetCursor[t, FALSE];