DIRECTORY BasicObject3d, ColorMap, CoordSys, CSG, CSGGraphics, DisplayList3d, GraphicsColor, IO, Labels, Matrix3d, Menus, MessageWindow, Preprocess3d, Rope, Scratchpad2dUser, SVArtwork, SVEditUser, SVPolygon2d, SVTransforms, SVViewerTools, SVViewerUser, SweepGeometry, ViewerClasses, ViewerTools; SVEditUserImplC: CEDAR PROGRAM IMPORTS ColorMap, DisplayList3d, IO, Labels, Matrix3d, MessageWindow, Preprocess3d, Rope, Scratchpad2dUser, SVArtwork, SVEditUser, SVPolygon2d, SVTransforms, SVViewerTools, SVViewerUser, SweepGeometry, ViewerTools EXPORTS SVEditUser = BEGIN Artwork: TYPE = SVArtwork.Artwork; Assembly: TYPE = DisplayList3d.Assembly; AssemblyList: TYPE = DisplayList3d.AssemblyList; Camera: TYPE = CSGGraphics.Camera; Color: TYPE = GraphicsColor.Color; CoordSystem: TYPE = CoordSys.CoordSystem; EditToolData: TYPE = REF EditToolDataObj; EditToolDataObj: TYPE = SVEditUser.EditToolDataObj; LinearMesh: TYPE = SweepGeometry.LinearMesh; MasterObject: TYPE = DisplayList3d.MasterObject; Material: TYPE = SVArtwork.Material; Matrix4by4: TYPE = Matrix3d.Matrix4by4; MouseButton: TYPE = Menus.MouseButton; Path: TYPE = SVPolygon2d.Path; Point3d: TYPE = Matrix3d.Point3d; Polygon: TYPE = SVPolygon2d.Polygon; PointSetOp: TYPE = CSG.PointSetOp; RevoluteMesh: TYPE = SweepGeometry.RevoluteMesh; Scene: TYPE = DisplayList3d.Scene; ScratchpadData: TYPE = Scratchpad2dUser.ScratchpadData; ScratchViewerData: TYPE = Scratchpad2dUser.ScratchViewerData; Viewer: TYPE = ViewerClasses.Viewer; ViewerCell: TYPE = REF ViewerCellObj; ViewerCellObj: TYPE = SVEditUser.ViewerCellObj; ViewerToolData: TYPE = SVViewerUser.ViewerToolData; ViewerPictureData: TYPE = SVViewerUser.ViewerPictureData; SphereRec: TYPE = REF SphereRecObj; SphereRecObj: TYPE = BasicObject3d.SphereRecObj; BlockRec: TYPE = REF BlockRecObj; BlockRecObj: TYPE = BasicObject3d.BlockRecObj; CylinderRec: TYPE = REF CylinderRecObj; CylinderRecObj: TYPE = BasicObject3d.CylinderRecObj; ConeRec: TYPE = REF ConeRecObj; ConeRecObj: TYPE = BasicObject3d.ConeRecObj; TorusRec: TYPE = REF TorusRecObj; TorusRecObj: TYPE = BasicObject3d.TorusRecObj; globalOpIndex: NAT _ 1; globalOpCount: NAT = 3; globalOpArray: ARRAY[1..globalOpCount] OF Rope.ROPE _ ["union", "intersection", "difference"]; globalIsColor: BOOL _ FALSE; SelectOp: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { editToolData: EditToolData _ NARROW[clientData]; scene: Scene _ editToolData.sceneSection.currentScene; globalOpIndex _ IF globalOpIndex = globalOpCount THEN 1 ELSE globalOpIndex + 1; Labels.Set[editToolData.sceneSection.opLabel, globalOpArray[globalOpIndex]]; SELECT globalOpArray[globalOpIndex] FROM "union" => editToolData.sceneSection.op _ union; "intersection" => editToolData.sceneSection.op _ intersection; "difference" => editToolData.sceneSection.op _ difference; ENDCASE => ERROR; }; IsColor: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { editToolData: EditToolData _ NARROW[clientData]; scene: Scene _ editToolData.sceneSection.currentScene; truthRope: Rope.ROPE; globalIsColor _ NOT globalIsColor; truthRope _ IF globalIsColor THEN "TRUE" ELSE "FALSE"; Labels.Set[editToolData.artworkSection.isColor, truthRope]; }; First: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { editToolData: EditToolData _ NARROW[clientData]; scene: Scene _ editToolData.sceneSection.currentScene; asName: Rope.ROPE _ ViewerTools.GetContents[editToolData.sceneSection.assemblyName]; assembly, superA: Assembly; found: BOOL; namePresent: BOOL _ FALSE; IF mouseButton = blue THEN { MessageWindow.Append["Can't undo First!", TRUE]; MessageWindow.Blink[]; RETURN}; [assembly, superA, found] _ SVEditUser.FindAssemblyFromName[asName, scene]; IF NOT found THEN RETURN; DisplayList3d.MoveToFrontOfAssembly[assembly, superA, scene]; SVViewerUser.SceneNewVersion[editToolData.currentViewerToolData]; }; -- end of First DrawCS: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { editToolData: EditToolData _ NARROW[clientData]; scene: Scene _ editToolData.sceneSection.currentScene; asName: Rope.ROPE _ ViewerTools.GetContents[editToolData.sceneSection.assemblyName]; assembly: Assembly; cs: CoordSystem; viewerToolData: ViewerToolData; success: BOOL; viewerCell: ViewerCell; [assembly, ----, success] _ SVEditUser.FindAssemblyFromName[asName, scene]; IF NOT success THEN RETURN; cs _ assembly.coordSys; [viewerCell, success] _ SVEditUser.FindSceneInAllViewers[scene, editToolData.allViewers]; IF NOT success THEN ERROR; IF viewerCell.viewersOnScene = NIL THEN RETURN; viewerToolData _ NARROW[viewerCell.viewersOnScene.data]; SVViewerUser.DrawOneCSInViewer[viewerToolData, cs]; IF viewerCell.viewersOnScene.link = NIL THEN RETURN; FOR list: Viewer _ viewerCell.viewersOnScene.link, list.link UNTIL list = viewerCell.viewersOnScene DO viewerToolData _ NARROW[list.data]; SVViewerUser.DrawOneCSInViewer[viewerToolData, cs]; ENDLOOP; }; Delete: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { editToolData: EditToolData _ NARROW[clientData]; scene: Scene _ editToolData.sceneSection.currentScene; found: BOOL _ TRUE; success: BOOL; assemblyName: Rope.ROPE _ ViewerTools.GetContents[editToolData.sceneSection.assemblyName]; assembly, superAssembly: Assembly; IF mouseButton = blue THEN { MessageWindow.Append["Can't undo Delete!", TRUE]; MessageWindow.Blink[]; RETURN}; [assembly, superAssembly, success] _ SVEditUser.FindAssemblyFromName[assemblyName, scene]; IF NOT success THEN RETURN; success _ DisplayList3d.DeleteSubassemblyFromAssembly[assembly, superAssembly, scene]; DisplayList3d.DeleteCoordSysNamed[assemblyName, scene]; IF NOT success THEN ERROR; SVViewerUser.SceneNewVersion[editToolData.currentViewerToolData]; SVEditUser.DrawSceneInternal[parent, clientData, mouseButton, shift, control]; }; SetColor: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { editToolData: EditToolData _ NARROW[clientData]; scene: Scene _ editToolData.sceneSection.currentScene; color: Color; colorArtwork: Artwork; material: Material; materialName: Rope.ROPE _ SVEditUser.globalMatArray[editToolData.artworkSection.materialValue]; assembly: Assembly; found, success: BOOL; IF mouseButton = blue THEN { MessageWindow.Append["Can't undo SetColor!", TRUE]; MessageWindow.Blink[]; RETURN}; [color, success] _ SVViewerTools.GetColor[editToolData.artworkSection.rgb]; IF NOT success THEN RETURN; IF Rope.Equal[ViewerTools.GetContents[editToolData.sceneSection.assemblyName], "background", FALSE] THEN { scene.backgroundColor _ color; SVEditUser.DrawSceneInternal[parent, clientData, mouseButton, shift, control]; RETURN}; -- a special case to set background color [assembly, found] _ SVEditUser.GetAssembly[editToolData.sceneSection.assemblyName, scene]; IF NOT found THEN RETURN; [material, found] _ SVArtwork.RopeToMaterial[materialName]; IF NOT found THEN { MessageWindow.Append[Rope.Cat["Material ",materialName," not known."]]; MessageWindow.Blink[]; RETURN}; colorArtwork _ SVArtwork.CreateColorArtwork[color, material]; DisplayList3d.SetArtworkAssembly[assembly, colorArtwork, scene]; SVViewerUser.SceneNewVersion[editToolData.currentViewerToolData]; SVEditUser.DrawSceneInternal[parent, clientData, mouseButton, shift, control]; }; SetOp: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { editToolData: EditToolData _ NARROW[clientData]; scene: Scene _ editToolData.sceneSection.currentScene; pointSetOp: PointSetOp _ editToolData.sceneSection.op; compAssembly: Assembly; compName: Rope.ROPE _ ViewerTools.GetContents[editToolData.sceneSection.assemblyName]; found: BOOL; namePresent: BOOL _ FALSE; IF mouseButton = blue THEN { MessageWindow.Append["Can't undo SetOp!", TRUE]; MessageWindow.Blink[]; RETURN}; [compAssembly, found] _ SVEditUser.GetAssembly[editToolData.sceneSection.assemblyName, scene]; IF NOT found THEN RETURN; WITH compAssembly.object SELECT FROM mo: MasterObject => { MessageWindow.Append["Can't add op to primitive assembly "]; MessageWindow.Append[compName]; MessageWindow.Append["."]; MessageWindow.Blink[]; RETURN}; al: AssemblyList => al.pointSetOp _ pointSetOp; ENDCASE => ERROR; SVViewerUser.SceneNewVersion[editToolData.currentViewerToolData]; }; -- end of SetOp SetColorMap: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { Preprocess3d.SetUpColorMap[]; }; BWMap: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { ColorMap.GrayMap[]; ColorMap.SetUpGrayTable[]; }; RotX: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { editToolData: EditToolData _ NARROW[clientData]; scene: Scene _ editToolData.sceneSection.currentScene; degrees: REAL _ SVViewerTools.GetReal[editToolData.transformSection.degrees, 0]; wrt: CoordSystem; assembly: Assembly; found: BOOL; [wrt, found] _ SVEditUser.GetCoordSys[editToolData.sceneSection.wrt, scene]; IF NOT found THEN RETURN; [assembly, found] _ SVEditUser.GetAssembly[editToolData.sceneSection.assemblyName, scene]; IF NOT found THEN RETURN; IF mouseButton = blue THEN degrees _ -degrees; SVTransforms.XRotate[assembly,wrt,degrees]; SVViewerUser.SceneNewVersion[editToolData.currentViewerToolData]; SVEditUser.DrawSceneInternal[parent, clientData, mouseButton, shift, control]; }; RotY: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { editToolData: EditToolData _ NARROW[clientData]; scene: Scene _ editToolData.sceneSection.currentScene; degrees: REAL _ SVViewerTools.GetReal[editToolData.transformSection.degrees, 0]; wrt: CoordSystem; assembly: Assembly; found: BOOL; [wrt, found] _ SVEditUser.GetCoordSys[editToolData.sceneSection.wrt, scene]; IF NOT found THEN RETURN; [assembly, found] _ SVEditUser.GetAssembly[editToolData.sceneSection.assemblyName, scene]; IF NOT found THEN RETURN; IF mouseButton = blue THEN degrees _ -degrees; SVTransforms.YRotate[assembly,wrt,degrees]; SVViewerUser.SceneNewVersion[editToolData.currentViewerToolData]; SVEditUser.DrawSceneInternal[parent, clientData, mouseButton, shift, control]; }; RotZ: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { editToolData: EditToolData _ NARROW[clientData]; scene: Scene _ editToolData.sceneSection.currentScene; degrees: REAL _ SVViewerTools.GetReal[editToolData.transformSection.degrees, 0]; wrt: CoordSystem; assembly: Assembly; found: BOOL; [wrt, found] _ SVEditUser.GetCoordSys[editToolData.sceneSection.wrt, scene]; IF NOT found THEN RETURN; [assembly, found] _ SVEditUser.GetAssembly[editToolData.sceneSection.assemblyName, scene]; IF NOT found THEN RETURN; IF mouseButton = blue THEN degrees _ -degrees; SVTransforms.ZRotate[assembly,wrt,degrees]; SVViewerUser.SceneNewVersion[editToolData.currentViewerToolData]; SVEditUser.DrawSceneInternal[parent, clientData, mouseButton, shift, control]; }; Trans: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { editToolData: EditToolData _ NARROW[clientData]; scene: Scene _ editToolData.sceneSection.currentScene; wrt: CoordSystem; assembly: Assembly; found: BOOL; x, y, z: REAL; [x, y, z] _ SVViewerTools.GetThreeReals[editToolData.transformSection.transXYZ]; [wrt, found] _ SVEditUser.GetCoordSys[editToolData.sceneSection.wrt, scene]; IF NOT found THEN RETURN; [assembly, found] _ SVEditUser.GetAssembly[editToolData.sceneSection.assemblyName, scene]; IF NOT found THEN RETURN; IF mouseButton = blue THEN {x _ -x; y _ -y; z _ -z}; SVTransforms.Translate[assembly, wrt, x, y, z]; SVViewerUser.SceneNewVersion[editToolData.currentViewerToolData]; SVEditUser.DrawSceneInternal[parent, clientData, mouseButton, shift, control]; }; ScalePrimitive: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { editToolData: EditToolData _ NARROW[clientData]; scene: Scene _ editToolData.sceneSection.currentScene; errorStream: IO.STREAM; errorRope: Rope.ROPE; assembly: Assembly; found: BOOL; x, y, z: REAL; [x, y, z] _ SVViewerTools.GetThreeReals[editToolData.transformSection.scaleXYZ]; IF x = 0 OR y = 0 OR z = 0 THEN { MessageWindow.Append["Can't scale by 0", TRUE]; MessageWindow.Blink[]; RETURN}; [assembly, found] _ SVEditUser.GetAssembly[editToolData.sceneSection.assemblyName, scene]; IF NOT found THEN RETURN; IF NOT ISTYPE[assembly.object, MasterObject] THEN { errorStream _ IO.CreateOutputStreamToRope[]; errorStream.PutF["Can't ScalePrimitive! a cluster assembly [%g]",[rope[assembly.name]]]; errorRope _ IO.GetOutputStreamRope[errorStream]; MessageWindow.Append[errorRope, TRUE]; MessageWindow.Blink[]; RETURN}; IF mouseButton = blue THEN {x _ 1/x; y _ 1/y; z _ 1/z}; SVTransforms.ScalePrimitive[assembly, x, y, z]; SVViewerUser.SceneNewVersion[editToolData.currentViewerToolData]; SVEditUser.DrawSceneInternal[parent, clientData, mouseButton, shift, control]; }; EvenScale: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { editToolData: EditToolData _ NARROW[clientData]; scene: Scene _ editToolData.sceneSection.currentScene; assembly: Assembly; wrt: CoordSystem; found: BOOL; scalar: REAL; scalar _ SVViewerTools.GetReal[editToolData.transformSection.scalar, 0]; IF scalar = 0 THEN { MessageWindow.Append["Can't scale by 0", TRUE]; MessageWindow.Blink[]; RETURN}; [assembly, found] _ SVEditUser.GetAssembly[editToolData.sceneSection.assemblyName, scene]; IF NOT found THEN RETURN; [wrt, found] _ SVEditUser.GetCoordSys[editToolData.sceneSection.wrt, scene]; IF NOT found THEN RETURN; IF mouseButton = blue THEN {scalar _ 1/scalar}; SVTransforms.ScaleEven[assembly, wrt, scalar]; SVViewerUser.SceneNewVersion[editToolData.currentViewerToolData]; SVEditUser.DrawSceneInternal[parent, clientData, mouseButton, shift, control]; }; Edit: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { editToolData: EditToolData _ NARROW[clientData]; scratchpad: Viewer _ editToolData.scratchpad; scratchpadData: ScratchpadData _ NARROW[scratchpad.data]; scratchViewerData: ScratchViewerData _ scratchpadData.scratchViewerData; scene: Scene _ editToolData.sceneSection.currentScene; success: BOOL; mo: MasterObject; path: Path; poly: Polygon; moClassName: Rope.ROPE; objectName: Rope.ROPE _ ViewerTools.GetContents[editToolData.sceneSection.assemblyName]; assembly: Assembly; [assembly, ----, success] _ SVEditUser.FindAssemblyFromName[objectName, scene]; IF NOT success THEN RETURN; IF NOT ISTYPE[assembly.object, MasterObject] THEN { MessageWindow.Append["Cannot Edit Composite Assembly", TRUE]; MessageWindow.Blink[]; RETURN}; mo _ NARROW[assembly.object]; moClassName _ mo.class.name; SELECT TRUE FROM Rope.Equal[moClassName, "revoluteSweep"] => { path _ SweepGeometry.GetRevolutePath[NARROW[mo.lineBody, RevoluteMesh]]; Scratchpad2dUser.Edit[path, revo, scratchViewerData]; SVViewerTools.SetThreeReals[editToolData.transformSection.scaleXYZ, assembly.scalars[1], assembly.scalars[2], assembly.scalars[3]]; }; Rope.Equal[moClassName, "linearSweep"] => { linMesh: LinearMesh _ NARROW[mo.lineBody]; depth: REAL; poly _ SweepGeometry.GetLinearPoly[linMesh]; path _ SVPolygon2d.PolygonToPath[poly]; Scratchpad2dUser.Edit[path, lin, scratchViewerData]; depth _ linMesh.array[1][1][3]*2; SVViewerTools.SetReal[editToolData.linSection.depth, depth]; SVViewerTools.SetThreeReals[editToolData.transformSection.scaleXYZ, assembly.scalars[1], assembly.scalars[2], assembly.scalars[3]]; }; Rope.Equal[moClassName, "sphere"] => { radius: REAL; sphereRec: SphereRec _ NARROW[mo.mainBody]; radius _ sphereRec.radius; IF assembly.scalars[1] = assembly.scalars[2] AND assembly.scalars[2] = assembly.scalars[3] THEN {-- stuff the radius and 1's into the scalars SVViewerTools.SetReal[editToolData.sphereSection.radius, assembly.scalars[1]*radius]; SVViewerTools.SetThreeReals[editToolData.transformSection.scaleXYZ, 1,1,1]; } ELSE {-- radius = 1; write scalars SVViewerTools.SetReal[editToolData.sphereSection.radius, 1]; SVViewerTools.SetThreeReals[editToolData.transformSection.scaleXYZ, assembly.scalars[1]*radius, assembly.scalars[2]*radius, assembly.scalars[3]*radius]; }; }; Rope.Equal[moClassName, "block"] => { bx, by, bz: REAL; blockRec: BlockRec _ NARROW[mo.mainBody]; bx _ blockRec.x; by _ blockRec.y; bz _ blockRec.z;-- size of the primitive object SVViewerTools.SetThreeReals[editToolData.blockSection.xyz, bx*assembly.scalars[1], by*assembly.scalars[2], bz*assembly.scalars[3]]; SVViewerTools.SetThreeReals[editToolData.transformSection.scaleXYZ, 1,1,1]; }; Rope.Equal[moClassName, "cylinder"] => { radius, height: REAL; cylinderRec: CylinderRec _ NARROW[mo.mainBody]; radius _ cylinderRec.radius; height _ cylinderRec.height;-- dimensions of the master object IF assembly.scalars[1] = assembly.scalars[3] THEN { SVViewerTools.SetReal[editToolData.cylinderSection.radius, radius*assembly.scalars[1]]; SVViewerTools.SetReal[editToolData.cylinderSection.height, height*assembly.scalars[2]]; SVViewerTools.SetThreeReals[editToolData.transformSection.scaleXYZ, 1,1,1]; } ELSE { SVViewerTools.SetReal[editToolData.cylinderSection.radius, 1]; SVViewerTools.SetReal[editToolData.cylinderSection.height, 1]; SVViewerTools.SetThreeReals[editToolData.transformSection.scaleXYZ, assembly.scalars[1]*radius, assembly.scalars[2]*height, assembly.scalars[3]*radius]; }; }; Rope.Equal[moClassName, "cone"] => { radius, height: REAL; coneRec: ConeRec _ NARROW[mo.mainBody]; radius _ coneRec.radius; height _ coneRec.height;-- dimensions of the master object IF assembly.scalars[1] = assembly.scalars[3] THEN { SVViewerTools.SetReal[editToolData.coneSection.radius, radius*assembly.scalars[1]]; SVViewerTools.SetReal[editToolData.coneSection.height, height*assembly.scalars[2]]; SVViewerTools.SetThreeReals[editToolData.transformSection.scaleXYZ, 1,1,1]; } ELSE { SVViewerTools.SetReal[editToolData.coneSection.radius, 1]; SVViewerTools.SetReal[editToolData.coneSection.height, 1]; SVViewerTools.SetThreeReals[editToolData.transformSection.scaleXYZ, assembly.scalars[1]*radius, assembly.scalars[2]*height, assembly.scalars[3]*radius]; }; }; Rope.Equal[moClassName, "torus"] => { bigRadius, sectionRadius: REAL; torusRec: TorusRec _ NARROW[mo.mainBody]; bigRadius _ torusRec.bigRadius; sectionRadius _ torusRec.sectionRadius; SVViewerTools.SetReal[editToolData.torusSection.bigRadius, bigRadius]; SVViewerTools.SetReal[editToolData.torusSection.sectionRadius, sectionRadius]; SVViewerTools.SetThreeReals[editToolData.transformSection.scaleXYZ, assembly.scalars[1], assembly.scalars[2], assembly.scalars[3]]; }; ENDCASE => ERROR; }; -- end of Edit AddComposite: PUBLIC PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL] = TRUSTED { editToolData: EditToolData _ NARROW[clientData]; scene: Scene _ editToolData.sceneSection.currentScene; pointSetOp: PointSetOp _ editToolData.sceneSection.op; compName: Rope.ROPE _ ViewerTools.GetContents[editToolData.sceneSection.assemblyName]; newAssembly, superAssembly: Assembly; success: BOOL; addSucceeds: BOOL _ TRUE; [superAssembly, success] _ SVEditUser.GetSuper[editToolData]; IF NOT success THEN RETURN; newAssembly _ DisplayList3d.CreateClusterAssembly[compName, pointSetOp]; DisplayList3d.AddSubassemblyToAssembly[newAssembly, superAssembly, scene, Matrix3d.Identity[] ! DisplayList3d.NameAlreadyPresent => { MessageWindow.Append["This composite name is already registered. Try another.",TRUE]; MessageWindow.Blink[]; addSucceeds _ FALSE; CONTINUE}; DisplayList3d.AttemptToAddSubassemblyToPrimitive => { MessageWindow.Append["Attempt To Add Subassembly To Primitive", TRUE]; MessageWindow.Blink[]; addSucceeds _ FALSE; CONTINUE}]; IF NOT addSucceeds THEN RETURN; SVViewerUser.SceneNewVersion[editToolData.currentViewerToolData]; }; -- end of AddComposite END.  File: SVEditUserImplC.mesa Last edited by Bier on July 6, 1983 4:45 pm Author: Eric Bier Contents: All of the procedures called by SVEditTool when menus and buttons are pressed (part 3) Basic Shapes GLOBAL VARIABLES Prompts which cycle through possibilities (B) Command Buttons Make sure that the assembly named in "Assembly: " is the first element in the AssemblyList of its super assembly (useful when csg op = "difference" since the result of difference is that of the first element minus all of the rest. find the assembly mentioned by the edittool and draw its coordinate system. draw the first viewer if there is one. draw the rest (remember they are linked in a ring) mo: MasterObject; primList: LIST OF Assembly; get r, g, and b from x, y, and z. the name in the assembly slot should refer to an already existing Composite Assembly. Make its CSG pointSetOp equal to the op shown next to "Op:". Error if Assembly is a Primitive Assembly. Find out if the current object is a sweep shape. If so, extract its path and feed to the scratchpad. Otherwise complain in MessageWindow. A sphere may actually be an oblate spheroid if the scalars are uneven. If they are even, I will will stuff the radius. Otherwise, I will set radius = 1 and stuff the scalars in the scaling part of the transform section. **** This should also stuff the name of the sphere's parent in "With Respect To:". since the system doesn't currently allow shear in primitives, this is easy if sx = sz then stuff radius and height. Otherwise using scaling blank to list all scalars similar to cylinder in the case of the torus, we write the current scalars AND take the radius data directly from the torus record (master object) Use the name in the assembly slot to name this new composite. It is a subassembly of the assembly named in "WithRespectTo"; It has no sub-assemblies to begin with. Add * will now add objects to the assembly named in "WithRespectTo". ʶ˜Ihead1šœ™Jšœ+™+Jšœ™Jšœ`™`J˜šÏk ˜ Jšœ˜Jšœ ˜ Jšœ ˜ Jšœ˜Jšœ ˜ Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœ ˜ Jšœ˜Jšœ˜Jšœ ˜ Jšœ˜Jšœ˜Jšœ ˜ Jšœ ˜ Jšœ ˜ Jšœ ˜ Jšœ˜Jšœ ˜ Jšœ˜Jšœ˜Jšœ ˜ —J˜šœœ˜Jšœœ²˜ÕJšœ˜—Jš˜˜Jšœ œ˜"Jšœ œ˜(Jšœœ˜0Jšœœ˜"Jšœœ˜"Jšœ œ˜)Jšœœœ˜)Jšœœ˜3Jšœ œ˜,Jšœœ˜0Jšœ œ˜$Jšœ œ˜'Jšœ œ˜&Jšœœ˜Jšœ œ˜!Jšœ œ˜$Jšœ œœ ˜"Jšœœ˜0Jšœœ˜"Jšœœ#˜7Jšœœ&˜=Jšœœ˜$Jšœ œœ˜%Jšœœ˜/Jšœœ˜3Jšœœ"˜9—J˜Jšœ ™ ˜Jšœ œœ˜#Jšœœ˜0J˜Jšœ œœ ˜!Jšœ œ˜.J˜Jšœ œœ˜'Jšœœ ˜4J˜Jšœ œœ ˜Jšœ œ˜,J˜Jšœ œœ ˜!Jšœ œ˜.—J˜Jšœ™˜Jšœœ˜Jšœœ˜Jšœœœœ˜6Jšœ(˜(Jšœœœ˜—J˜Jšœ-™-J˜šÏnœœœ œœœœ,œœ˜xJšœœ ˜0Jšœ6˜6Jšœœœœ˜OJšœL˜Lšœ˜(Jšœ0˜0Jšœ>˜>Jšœ:˜:—Jšœœ˜Jšœ˜—J˜šžœœœ œœœœ,œœ˜wJšœœ ˜0Jšœ6˜6Jšœœ˜Jšœœ˜"Jšœ œœœ ˜6Jšœ;˜;Jšœ˜—J˜Jšœ™J˜šžœœœ œœœœ,œœ˜uJšœæ™æJšœœ ˜0Jšœ6˜6Jšœ œC˜TJšœ˜Jšœœ˜ Jšœ œœ˜šœœ˜Jšœ*œ˜0Jšœ˜Jšœ˜—JšœK˜KJšœœœœ˜Jšœ=˜=JšœA˜AJšœÏc˜—J˜Jšžœœœ œœœœ˜Tšœœœ˜!JšœK™KJšœœ ˜0Jšœ6˜6Jšœ œC˜TJšœ˜Jšœ˜Jšœ˜Jšœ œ˜Jšœ˜Jšœ Ÿœ:˜KJšœœ œœ˜Jšœ˜JšœY˜YJšœœ œœ˜Jšœ&™&Jšœœœœ˜/Jšœœ!˜8Jšœ3˜3Jšœ2™2Jšœ"œœœ˜4Jšœ9˜<šœ"˜)Jšœœ ˜#Jšœ3˜3—Jšœ˜Jšœ˜—J˜šžœœœ œœœœ,œœ˜vJšœœ ˜0Jšœ6˜6Jšœœœ˜Jšœ œ˜Jšœ™Jšœ™JšœœC˜ZJšœ"˜"šœœ˜Jšœ+œ˜1Jšœ˜Jšœ˜—JšœZ˜ZJšœœ œœ˜JšœV˜VJšœ7˜7Jšœœ œœ˜JšœA˜AJšœN˜NJšœ˜—J˜šžœœœ œœœœ,œœ˜xJšœœ ˜0Jšœ6˜6Jšœ!™!Jšœ ˜ Jšœ˜Jšœ˜JšœœH˜_Jšœ˜Jšœœ˜šœœ˜Jšœ-œ˜3Jšœ˜Jšœ˜—JšœK˜KJšœœ œœ˜šœ[œœ˜jJšœ˜JšœN˜NJšœŸ)˜2—JšœZ˜ZJšœœœœ˜Jšœ;˜;šœœœ˜JšœG˜GJšœ˜Jšœ˜—Jšœ=˜=Jšœ@˜@JšœA˜AJšœN˜NJšœ˜—J˜šžœœœ œœœœ,œœ˜uJšœ¿™¿Jšœœ ˜0Jšœ6˜6Jšœ6˜6Jšœ˜JšœœC˜VJšœœ˜ Jšœ œœ˜šœœ˜Jšœ*œ˜0Jšœ˜Jšœ˜—Jšœ^˜^Jšœœœœ˜šœœ˜$šœ˜Jšœ<˜šœ+œ˜3JšœW˜WJšœW˜WJšœK˜KJšœ˜—šœ˜Jšœ>˜>Jšœ>˜>Jšœ˜˜˜Jšœ˜—Jšœ˜—šœ$˜$Jšœ™Jšœœ˜Jšœœ˜'Jšœ˜JšœŸ"˜:šœ+œ˜3JšœS˜SJšœS˜SJšœK˜KJšœ˜—šœ˜Jšœ:˜:Jšœ:˜:Jšœ˜˜˜Jšœ˜—Jšœ˜—šœ%˜%Jšœ~™~Jšœœ˜Jšœœ˜)Jšœ˜Jšœ'˜'JšœF˜FJšœN˜NJšœƒ˜ƒJšœ˜—Jšœœ˜—JšœŸ˜—J˜šž œœœ œœœœ,œœ˜|Jšœë™ëJšœœ ˜0Jšœ6˜6Jšœ6˜6JšœœC˜VJšœ%˜%Jšœ œ˜Jšœ œœ˜Jšœ=˜=Jšœœ œœ˜JšœH˜Hšœ…˜…JšœPœ˜VJšœ˜Jšœœœ˜—šœ5˜5Jšœ@œ˜FJšœ˜Jšœœœ˜ —Jšœœ œœ˜JšœA˜AJšœŸ˜—J˜Jšœ˜J˜J˜—…—OjkÀ