DIRECTORY CoordSys, CSG, CSGGraphics, DisplayList3d, JaMSolidviews, Menus, Rope, SVEditUser, SVError, SVInterfaceTypes, SVModelTypes, SVRayTypes, SVSceneTypes, SVSlices, SVViewerUser, SVTransforms, ViewerClasses; JaMSolidviewsImpl: CEDAR PROGRAM IMPORTS CoordSys, DisplayList3d, SVEditUser, SVError, SVViewerUser, SVTransforms EXPORTS JaMSolidviews = BEGIN Assembly: TYPE = SVSceneTypes.Assembly; Camera: TYPE = SVModelTypes.Camera; CoordSysList: TYPE = SVModelTypes.CoordSysList; CoordSystem: TYPE = SVModelTypes.CoordSystem; CSGTree: TYPE = SVRayTypes.CSGTree; EditToolData: TYPE = SVInterfaceTypes.EditToolData; FrameBox: TYPE = REF FrameBoxObj; FrameBoxObj: TYPE = SVModelTypes.FrameBoxObj; Scene: TYPE = SVSceneTypes.Scene; ScratchpadData: TYPE = SVInterfaceTypes.ScratchpadData; ScratchViewerData: TYPE = SVInterfaceTypes.ScratchViewerData; Slice: TYPE = SVSlices.Slice; Viewer: TYPE = ViewerClasses.Viewer; ViewerToolData: TYPE = SVInterfaceTypes.ViewerToolData; editToolData: EditToolData; RegisterThisEditTool: PUBLIC PROC [etd: EditToolData] ~ { editToolData _ etd; }; Init: PROC [] ~ { }; GetCoordSys: PRIVATE PROC [csRope: Rope.ROPE, scene: Scene] RETURNS [cs: CoordSystem, success: BOOL] ~ TRUSTED { csList: CoordSysList; success _ TRUE; csList _ CoordSys.MakeListFromTree[scene.coordSysRoot]; cs _ CoordSys.FindCoordSysInList[csRope, csList ! CoordSys.CoordSysNotFound => {success _ FALSE; CONTINUE}]; IF NOT success THEN { SVError.Append["Assembly ", TRUE]; SVError.Append[csRope]; SVError.Append[" not found", FALSE, TRUE]; SVError.Blink[]; }; }; GetAssembly: PRIVATE PROC [asRope: Rope.ROPE, scene: Scene] RETURNS [as: Assembly, success: BOOL] = TRUSTED { success _ TRUE; [as, ----] _ DisplayList3d.FindAssemblyFromName[asRope, scene !DisplayList3d.AssemblyNotFound => { SVError.Append["Assembly ", TRUE]; SVError.Append[asRope]; SVError.Append[" not found", FALSE, TRUE]; SVError.Blink[]; success _ FALSE; CONTINUE}] }; RotX: PROC [asRope: Rope.ROPE, csRope: Rope.ROPE, degrees: REAL] ~ TRUSTED { scene: Scene _ editToolData.sceneSection.currentScene; wrt: CoordSystem; assembly: Assembly; found: BOOL; [wrt, found] _ GetCoordSys[csRope, scene]; IF NOT found THEN RETURN; [assembly, found] _ GetAssembly[asRope, scene]; IF NOT found THEN RETURN; SVTransforms.XRotate[assembly.coordSys, wrt, degrees]; SVEditUser.SceneNewVersion[editToolData.currentViewerToolData]; SVEditUser.PaintSceneAllViewers[SVViewerUser.EraseAndDrawSceneEtc, editToolData, scene]; }; EvenScaleChildren: PROC [asRope: Rope.ROPE, scalar: REAL] ~ TRUSTED { scene: Scene _ editToolData.sceneSection.currentScene; assembly: Assembly; found: BOOL; [assembly, found] _ GetAssembly[asRope, scene]; IF NOT found THEN RETURN; SVTransforms.ScaleEvenChildren[assembly, NIL, scalar]; SVEditUser.SceneNewVersion[editToolData.currentViewerToolData]; SVEditUser.PaintSceneAllViewers[SVViewerUser.EraseAndDrawSceneEtc, editToolData, scene]; }; SetBoundBox: PROC [boundBoxes: BOOL] ~ TRUSTED { camera: Camera; currentScene: Scene _ editToolData.sceneSection.currentScene; currentViewerToolData: ViewerToolData _ NARROW[editToolData.currentViewerToolData]; camera _ currentViewerToolData.camera; camera.useBoundBoxes _ boundBoxes; }; Init[]; END. *File: JaMSolidviewsImpl.mesa Last edited by: Bier on January 3, 1985 10:29:30 pm PST Copyright c 1984 by Xerox Corporation. All rights reserved. Contents: Someday this may be a way to call Solidviews procedures from a JaM typescript. For now, it is a set of procedures to be called from the Cedar Language Interpreter. JaM, State: TYPE = JaM.State; JaM.RegisterInit[name: "Solidviews", init: JamSolidviewsInit]; JamSolidviewsInit: PROC[state: State] ~ { state.Register["RotX", RotX]; state.Register["EvenScaleChildren", EvenScaleChildren]; }; Κ>˜Ihead™J™7Jšœ Οmœ1™™>J˜—š œžœ™)Jšœ™Jšœ7™7J™—š  œžœžœžœžœžœžœ˜pJ˜Jšœ žœ˜Jšœ7˜7Jšœ/˜/Jšœ*žœžœ˜<šžœžœ žœ˜Jšœžœ˜"Jšœ˜Jšœžœžœ˜*Jšœ˜Jšœ˜—J˜—š  œžœžœžœžœžœžœ˜mJšœ žœ˜šœΟcœ4˜=Jšœ$˜$Jšœžœ˜"Jšœ˜Jšœžœžœ˜*Jšœ˜Jšœ žœ˜Jšžœ˜ —Jšœ˜—š  œžœžœžœ žœžœ˜LJšœ6˜6Jšœ˜Jšœ˜Jšœžœ˜ J˜Jšœ*˜*Jšžœžœžœžœ˜Jšœ/˜/Jšžœžœžœžœ˜Jšœ6˜6Jšœ?˜?LšœX˜XJ˜—š  œžœžœ žœžœ˜EJšœ6˜6Jšœ˜Jšœžœ˜ J˜Jšœ/˜/Jšžœžœžœžœ˜Jšœ)žœ ˜6Jšœ?˜?LšœX˜XJ˜J˜—š  œžœžœžœ˜0J˜Jšœ=˜=Jšœ(žœ%˜SJšœ&˜&Jšœ"˜"J˜J˜—J˜Jšžœ˜—…— €