DIRECTORY CDCells, CDGenerate, CDCurves, CD, CDDirectory, CDLayers, CDValue, CDPanel, CDRects, CDSequencer, CDCommandOps, TerminalIO; CDArraysImpl: CEDAR PROGRAM IMPORTS CDCells, CDGenerate, CDCurves, CDDirectory, CDLayers, CDValue, CDPanel, CDRects, CDCommandOps, TerminalIO = BEGIN Diags: CDGenerate.GeneratorProc = { n, cnt: INT_0; p1, p2, d1, d2: CD.Position; layer: CD.Layer _ CDLayers.CurrentLayer[design]; w: CD.Number _ CDLayers.LayerWidth[design, layer]; line: CD.Object; off: CD.Position; CDPanel.PutUpAll[design]; n _ CDValue.FetchInt[design, $cdMLAn]; p1 _ [0, 0]; p2 _ [CDValue.FetchInt[design, $cdMLAsx], CDValue.FetchInt[design, $cdMLAsy]]; d1 _ [CDValue.FetchInt[design, $cdMLAdx0], CDValue.FetchInt[design, $cdMLAdy0]]; d2 _ [CDValue.FetchInt[design, $cdMLAdx1], CDValue.FetchInt[design, $cdMLAdy1]]; ob _ CDCells.CreateEmptyCell[]; FOR i: INT IN [0..n) DO start: CD.Position _ [x: p1.x+i*d1.x+w/2, y: p1.y+i*d1.y+w/2]; stop: CD.Position _ [x: p2.x+i*d2.x+w/2, y: p2.y+i*d2.y+w/2]; IF start.x=stop.x OR start.y=stop.y THEN { sz: CD.Position _ [ABS[stop.x-start.x]+w, ABS[stop.y-start.y]+w]; line _ CDRects.CreateRect[sz, layer]; off _ [MIN[start.x, stop.x]-w/2, MIN[start.y, stop.y]-w/2]; } ELSE { [line, off] _ CDCurves.CreateLine[points: LIST[start, stop], w: w, layer: layer]; }; IF line#NIL THEN { cnt _ cnt+1; [] _ CDCells.IncludeOb[cell: ob, ob: line, trans: [off, original]]; } ENDLOOP; IF cnt>0 THEN [] _ CDDirectory.Include[design: design, object: ob, name: "x"] ELSE ob _ NIL; }; Redisplay: PROC [design: CD.Design] = { [] _ CDPanel.PutUp[design, $cdMLAsx]; [] _ CDPanel.PutUp[design, $cdMLAsy]; [] _ CDPanel.PutUp[design, $cdMLAdx0]; [] _ CDPanel.PutUp[design, $cdMLAdy0]; [] _ CDPanel.PutUp[design, $cdMLAdx1]; [] _ CDPanel.PutUp[design, $cdMLAdy1]; }; DefineV0: PROC [comm: CDSequencer.Command] = { TerminalIO.PutRope["redefine D1 for multi lines array command\n"]; CDValue.StoreInt[comm.design, $cdMLAdx0, comm.pos.x-comm.sPos.x]; CDValue.StoreInt[comm.design, $cdMLAdy0, comm.pos.y-comm.sPos.y]; Redisplay[comm.design]; }; DefineV1: PROC [comm: CDSequencer.Command] = { TerminalIO.PutRope["redefine D2 for multi lines array command\n"]; CDValue.StoreInt[comm.design, $cdMLAdx1, comm.pos.x-comm.sPos.x]; CDValue.StoreInt[comm.design, $cdMLAdy1, comm.pos.y-comm.sPos.y]; Redisplay[comm.design]; }; Gen: PROC [comm: CDSequencer.Command] = { ob: CD.Object; p: CD.Position _ [MIN[comm.sPos.x, comm.pos.x], MIN[comm.sPos.y, comm.pos.y]]; Redisplay[comm.design]; ob _ CDGenerate.FetchNCall[context, comm.design, "MLA", FALSE]; IF ob=NIL THEN { IF CDValue.FetchInt[comm.design, $cdMLAn]<1 THEN TerminalIO.PutRope["bad repetition number; "]; TerminalIO.PutRope["failed\n"] } ELSE [] _ CDCells.IncludeOb[design: comm.design, ob: ob, trans: [comm.sPos, original]]; }; Draw: PROC [comm: CDSequencer.Command] = { TerminalIO.PutRope["draw multi lines array with vector\n"]; CDValue.StoreInt[comm.design, $cdMLAsx, comm.pos.x-comm.sPos.x]; CDValue.StoreInt[comm.design, $cdMLAsy, comm.pos.y-comm.sPos.y]; Redisplay[comm.design]; Gen[comm]; }; ReDraw: PROC [comm: CDSequencer.Command] = { TerminalIO.PutRope["re-draw multi lines from panel\n"]; Gen[comm]; }; context: CDGenerate.Context _ CDGenerate.AssertContext["USER"]; [] _ CDGenerate.Register[context, "MLA", Diags, FALSE]; CDPanel.Number[number: [cdValueKey: $cdMLAn], button: [text: "array num:"], min: 0, max: 2000, default: 0, lambda: 1]; CDPanel.Number[number: [cdValueKey: $cdMLAsx], button: [text: "s[1].x:"], lambda: 0]; CDPanel.Number[number: [cdValueKey: $cdMLAsy], button: [text: "s[1].y:"], lambda: 0]; CDPanel.Line[]; CDPanel.Number[number: [cdValueKey: $cdMLAdx0], button: [text: " Dxa:"], lambda: 0]; CDPanel.Number[number: [cdValueKey: $cdMLAdy0], button: [text: "Dya:"], lambda: 0]; CDPanel.Number[number: [cdValueKey: $cdMLAdx1], button: [text: "Dxb:"], lambda: 0]; CDPanel.Number[number: [cdValueKey: $cdMLAdy1], button: [text: "Dyb:"], lambda: 0]; CDPanel.Line[]; CDCommandOps.RegisterWithMenu[menu: $RectProgramMenu, entry: "draw array with first line", key: $cdMLADraw, proc: Draw, doc: "array of arbitrary angled lines (size increased by 1 default width)"]; CDCommandOps.RegisterWithMenu[menu: $RectProgramMenu, entry: "draw array from panel", key: $cdMLAReDraw, proc: ReDraw, doc: "array of arbitrary angled lines (size increased by 1 default width)"]; CDCommandOps.RegisterWithMenu[menu: $RectProgramMenu, entry: " define Da for draw array", key: $cdMLAp0, proc: DefineV0, doc: "setup increment for first point of arrayed line"]; CDCommandOps.RegisterWithMenu[menu: $RectProgramMenu, entry: " define Db for draw array", key: $cdMLAp1, proc: DefineV1, doc: "setup increment for second point of arrayed line"]; END. $CDArraysImpl.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Created by: Christian Jacobi, August 25, 1986 5:16:02 pm PDT Last edited by: Christian Jacobi, October 20, 1986 1:01:13 pm PDT A package which helps to draw arrays of arbitrary angled lines with ChipNDale Κ«˜™Icodešœ Οmœ1™Jšœžœ5˜=šžœžœžœ˜*Jšœžœ žœžœ˜AJšœ%˜%Jšœžœžœ˜;J˜—šžœ˜Jšœ*žœ#˜QJ˜—šžœžœžœ˜J˜ JšœC˜CJšœ˜—Jšžœ˜—Jšžœžœ@˜MJšžœžœ˜Jšœ˜J˜—š  œžœ žœ ˜'Jšœ%˜%Jšœ%˜%Jšœ&˜&Jšœ&˜&Jšœ&˜&Jšœ&˜&Kšœ˜—K˜š œžœ ˜.KšœB˜BJšœA˜AJšœA˜AJšœ˜Kšœ˜—K˜š œžœ ˜.KšœB˜BJšœA˜AJšœA˜AJšœ˜Kšœ˜—K˜š œžœ ˜)Jšœžœ ˜Jšœžœ žœžœ˜NJšœ˜Kšœ8žœ˜?šžœžœžœ˜Jšžœ*žœ/˜_Jšœ˜J˜—JšžœS˜WKšœ˜—K˜š œžœ ˜*Kšœ;˜;Jšœ@˜@Jšœ@˜@Jšœ˜Jšœ ˜ Kšœ˜—K˜š œžœ ˜,Kšœ7˜7Jšœ ˜ Kšœ˜—J˜J˜?J˜7Jšœw˜wJšœU˜UJšœU˜UJšœ˜JšœU˜UJšœS˜SJšœS˜SJšœS˜SJšœ˜KšœΔ˜ΔKšœΓ˜ΓKšœ²˜²Kšœ³˜³Jšžœ˜—…—vE