choice:
INT ¬ Controls.PopUpRequest[["Draw Ops"],
LIST[
-- 1 -- Controls.BoolRequest[t.drawOptions.flatShade, "Flat Shade"],
-- 2 -- Controls.BoolRequest[t.drawOptions.hiddenLineElim, "Hidden Line Elimination"],
-- 3 -- Controls.BoolRequest[t.drawOptions.vertexNormals, "Vertex Normals"],
-- 4 -- Controls.BoolRequest[t.drawOptions.faceNormals, "Face Normals"],
-- 5 -- Controls.BoolRequest[t.drawOptions.verticesOnly, "Vertices Only"],
-- 6 -- Controls.BoolRequest[t.drawOptions.labelVertices, "Label Vertices"],
-- 7 -- Controls.BoolRequest[t.drawOptions.labelPolygons, "Label Polygons"],
-- 8 -- Controls.BoolRequest[t.drawSprite, "Sprite"],
-- 9 -- Controls.BoolRequest[t.drawPendant, "Pendant"],
-- 10 -- Controls.BoolRequest[t.drawClient, "Client Display"],
-- 11 -- Controls.BoolRequest[t.timing, "Timing"],
-- 12 -- Controls.BoolRequest[t.drawOptions.silhouettesOnly, "Silhouettes"],
-- 13 -- Controls.BoolRequest[t.drawOptions.backFaces=dashed, "Dashed Backfaces"],
-- 14 -- Controls.BoolRequest[t.drawCurves, "Curves"],
-- 15 -- Controls.BoolRequest[t.queryVertices, "Vertex Querying"],
-- 16 -- Controls.BoolRequest[t.drawOptions.tapered, "Tapered lines"],
-- 17 -- Controls.BoolRequest[t.drawOptions.dimFurtherLines, "Dim far lines"],
-- 18 -- ["SetDrawMode", "Line Drawing Mode (will prompt)"],
-- 19 -- ["Stuff", "Stuff to Tioga selection"],
-- 20 -- ["Write Vectors", "Write 2d vectors to a file"]]];
SELECT choice
FROM
1 => t.drawOptions.flatShade ¬ NOT t.drawOptions.flatShade;
2 => t.drawOptions.hiddenLineElim ¬ NOT t.drawOptions.hiddenLineElim;
3 => t.drawOptions.vertexNormals ¬ NOT t.drawOptions.vertexNormals;
4 => t.drawOptions.faceNormals ¬ NOT t.drawOptions.faceNormals;
5 => t.drawOptions.verticesOnly ¬ NOT t.drawOptions.verticesOnly;
6 => t.drawOptions.labelVertices ¬ NOT t.drawOptions.labelVertices;
7 => t.drawOptions.labelPolygons ¬ NOT t.drawOptions.labelPolygons;
8 => IF (t.drawSprite ¬ NOT t.drawSprite) THEN save ¬ TRUE;
9 => t.drawPendant ¬ NOT t.drawPendant;
10 => t.drawClient ¬ NOT t.drawClient;
11 => t.timing ¬ NOT t.timing;
12 => t.drawOptions.silhouettesOnly ¬ NOT t.drawOptions.silhouettesOnly;
13 => t.drawOptions.backFaces ¬ IF t.drawOptions.backFaces = dashed THEN on ELSE dashed;
14 => {
t.drawCurves ¬ NOT t.drawCurves;
IF t.drawCurves
AND t.shapes #
NIL
THEN
FOR n:
NAT
IN [0..t.shapes.length)
DO
m: G3dModel.Model ¬ G3dModel.GetModel[t.shapes[n]];
IF m.curves = NIL THEN G3dModel.SetCurves[t.shapes[n]];
ENDLOOP;
};
15 => IF (t.queryVertices ¬ NOT t.queryVertices) THEN save ¬ TRUE;
16 => t.drawOptions.tapered ¬ NOT t.drawOptions.tapered;
17 => t.drawOptions.dimFurtherLines ¬ NOT t.drawOptions.dimFurtherLines;
18 => {
choice:
INT ¬ Controls.MultiRequest["Line Drawing Mode is ",
LIST[
["Solid", t.drawOptions.lineType = solid AND NOT t.drawOptions.verticesOnly],
["Dashed", t.drawOptions.lineType = dashed AND NOT t.drawOptions.verticesOnly],
["Dotted", t.drawOptions.lineType = dotted AND NOT t.drawOptions.verticesOnly]]];
t.drawOptions.lineType ¬ SELECT choice FROM 2 => dashed, 3 => dotted, ENDCASE => solid;
};
19 => {
DoStuff:
PROC [context: Context] ~ {
Inner: PROC ~ {G3dTool.Draw[context, NIL, $Stuff, NIL, [], NIL, t, t]};
Imager.TranslateT[context, [-t.bounds.x, -t.bounds.y]];
Imager.DoSaveAll[context, Inner];
};
ImagerArtwork.PasteArtwork[DoStuff, t.bounds, ImagerArtwork.Points[],,, FALSE];
};
20 => {
fileName: ROPE ¬ Controls.TypescriptReadFileName[t.typescript];
IF fileName #
NIL
AND t.shapes #
NIL
THEN {
out: IO.STREAM ¬ PFS.StreamOpen[PFS.PathFromRope[fileName], create];
v: View ¬ G3dTool.GetView[NIL, t];
IO.PutF1[t.cmd.out, "Writing %g\n", IO.rope[fileName]];
FOR n:
NAT
IN [0..v.screens.length)
DO
s: Shape ¬ t.shapes[n];
screens: G3dTool.ScreenSequence ¬ v.screens[n];
FOR i:
NAT
IN [0..s.edges.length)
DO
e: G3dShape.Edge ¬ s.edges[i];
p0: G3dBasic.Pair ¬ screens[e.v0].pos;
p1: G3dBasic.Pair ¬ screens[e.v1].pos;
IO.PutFL[out, "%6.5f\t%6.5f\t%6.5f\t%6.5f\n",
LIST[IO.real[p0.x], IO.real[p0.y], IO.real[p1.x], IO.real[p1.y]]];
ENDLOOP;
ENDLOOP;
IO.Close[out];
};
};
ENDCASE;