/*----------------------------------------------------------------------------*/ /* Scenome 1.0 Worksheet Scripts */ /* */ /* Copyright (c) 2007 Scenomics. All Rights Reserved. */ /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /* WorksheetRenderInWireframe */ /*----------------------------------------------------------------------------*/ macro WorksheetRenderInWireframe() [Category="Worksheet Commands", Guid="{1F91F9CA-F612-46d4-A453-4B81096121A9}", Image=".\\icons\\render_wire.bmp"] { Model.ActiveView.RenderWireframe(); } /*----------------------------------------------------------------------------*/ /* WorksheetRenderInFilled */ /*----------------------------------------------------------------------------*/ macro WorksheetRenderInFilled() [Category="Worksheet Commands", Guid="{1F91F9CB-F612-46d4-A453-4B81096121A9}", Image=".\\icons\\render_filled.bmp"] { Model.ActiveView.RenderFilled(); } /*----------------------------------------------------------------------------*/ /* WorksheetRenderInSolid */ /*----------------------------------------------------------------------------*/ macro WorksheetRenderInSolid() [Category="Worksheet Commands", Guid="{1F91F9CC-F612-46d4-A453-4B81096121A9}", Image=".\\icons\\render_solid.bmp"] { Model.ActiveView.RenderSolid(); } /*----------------------------------------------------------------------------*/ /* WorksheetRenderInTextured */ /*----------------------------------------------------------------------------*/ macro WorksheetRenderInTextured() [Category="Worksheet Commands", Guid="{1F91F9CD-F612-46d4-A453-4B81096121A9}", Image=".\\icons\\render_texture.bmp"] { Model.ActiveView.RenderTextured(); } /*----------------------------------------------------------------------------*/ /* WorksheetColorVellum */ /*----------------------------------------------------------------------------*/ macro WorksheetColorVellum() [Category="Worksheet Commands", Guid="{1F91F913-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\set_worksheet_color_vellum.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.TopColor.SetRGB( 0xb4, 0xb4, 0xc0 ); a_oView.MiddleColor.SetRGB( 0xb4, 0xb4, 0xc0 ); a_oView.BottomColor.SetRGB( 0xb4, 0xb4, 0xc0 ); a_oView.GridColor.SetRGB( 0xaa, 0xaa, 0xb6 ); a_oView.GridQuadrantColor.SetRGB( 0x88, 0x88, 0x88 ); } /*----------------------------------------------------------------------------*/ /* WorksheetColorDawn */ /*----------------------------------------------------------------------------*/ macro WorksheetColorDawn() [Category="Worksheet Commands", Guid="{1F91F910-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\set_worksheet_color_dawn.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.TopColor.SetRGB( 0xb42, 0xb63, 0xc84 ); a_oView.MiddleColor.SetRGB( 0xbFF, 0xAD, 0xc5B ); a_oView.BottomColor.SetRGB( 0xc0, 0xb4, 0xcb4 ); a_oView.GridColor.SetRGB( 0xaa, 0xaa, 0xb6 ); a_oView.GridQuadrantColor.SetRGB( 0x88, 0x88, 0x88 ); } /*----------------------------------------------------------------------------*/ /* WorksheetColorDay */ /*----------------------------------------------------------------------------*/ macro WorksheetColorDay() [Category="Worksheet Commands", Guid="{1F91F911-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\set_worksheet_color_day.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.TopColor.SetRGB( 0x7d, 0x9e, 0xc0 ); a_oView.MiddleColor.SetRGB( 0xb4, 0xb4, 0xc0 ); a_oView.BottomColor.SetRGB( 0xb4, 0xb4, 0xc0 ); a_oView.GridColor.SetRGB( 0xaa, 0xaa, 0xb6 ); a_oView.GridQuadrantColor.SetRGB( 0x88, 0x88, 0x88 ); } /*----------------------------------------------------------------------------*/ /* WorksheetColorNight */ /*----------------------------------------------------------------------------*/ macro WorksheetColorNight() [Category="Worksheet Commands", Guid="{1F91F912-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\set_worksheet_color_night.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.TopColor.SetRGB( 0x5e, 0x00, 0x00 ); a_oView.MiddleColor.SetRGB( 0x94, 0x97, 0x91 ); a_oView.BottomColor.SetRGB( 0xb4, 0xb4, 0xc0 ); a_oView.GridColor.SetRGB( 0xaa, 0xaa, 0xb6 ); a_oView.GridQuadrantColor.SetRGB( 0x88, 0x88, 0x88 ); } /*----------------------------------------------------------------------------*/ /* WorksheetColorGray */ /*----------------------------------------------------------------------------*/ macro WorksheetColorGray() [Category="Worksheet Commands", Guid="{1F91F914-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\set_worksheet_color_gray.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.Fog = 0; a_oView.TopColor.SetRGB( 0x80, 0x80, 0x80 ); a_oView.MiddleColor.SetRGB( 0x80, 0x80, 0x80 ); a_oView.BottomColor.SetRGB( 0x80, 0x80, 0x80 ); a_oView.GridColor.SetRGB( 0x72, 0x72, 0x72 ); a_oView.GridQuadrantColor.SetRGB( 0x40, 0x40, 0x40 ); } /*----------------------------------------------------------------------------*/ /* WorksheetColorSilver */ /*----------------------------------------------------------------------------*/ macro WorksheetColorSilver() [Category="Worksheet Commands", Guid="{1F91F9C7-F612-46d4-A453-4B81096121A9}", Image=".\\icons\\set_worksheet_color_silver.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.TopColor.SetRGB( 0xC0, 0xC0, 0xC0 ); a_oView.MiddleColor.SetRGB( 0xC0, 0xC0, 0xC0 ); a_oView.BottomColor.SetRGB( 0xC0, 0xC0, 0xC0 ); a_oView.GridColor.SetRGB( 0xA7, 0xA7, 0xA7 ); a_oView.GridQuadrantColor.SetRGB( 0x40, 0x40, 0x40 ); } /*----------------------------------------------------------------------------*/ /* WorksheetCameraNormalize */ /*----------------------------------------------------------------------------*/ macro WorksheetCameraNormalize() [Category="Worksheet Commands", Guid="{1F91F94F-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_normalize_camera.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.Orientation.X = 0.0; a_oView.Orientation.Y = 0.0; a_oView.Orientation.Z = 0.0; } /*----------------------------------------------------------------------------*/ /* WorksheetGridReset */ /*----------------------------------------------------------------------------*/ macro WorksheetGridReset() [Category="Worksheet Commands", Guid="{1F91F8FE-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_reset_grid.bmp"] { ModelView a_oView = Model.ActiveView; Matrix editTransform = Model.Grid.GetTransform(); editTransform.Position[0] = 0; editTransform.Position[1] = 0; editTransform.Position[2] = 0; editTransform.Orientation[0] = 0.0; editTransform.Orientation[1] = 0.0; editTransform.Orientation[2] = 0.0; editTransform.Scale[0] = 1.0; editTransform.Scale[1] = 1.0; Model.Grid.SetTransform( editTransform ); a_oView.QuadrantSpacing = 8.0; Model.Grid.Begin.X = -32.0; Model.Grid.Begin.Y = -32.0; Model.Grid.End.X = 32.0; Model.Grid.End.Y = 32.0; } /*----------------------------------------------------------------------------*/ /* WorksheetGridNormalize */ /*----------------------------------------------------------------------------*/ macro WorksheetGridNormalize() [Category="Worksheet Commands", Guid="{1F91F8FF-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_grid_normalize.bmp"] { ModelView a_oView = Model.ActiveView; Matrix editTransform = Model.Grid.GetTransform(); editTransform.Orientation[0] = 0.0; editTransform.Orientation[1] = 0.0; editTransform.Orientation[2] = 0.0; Model.Grid.SetTransform( editTransform ); } /*----------------------------------------------------------------------------*/ /* WorksheetGridOverlay */ /*----------------------------------------------------------------------------*/ macro WorksheetGridOverlay() [Category="Worksheet Commands", Guid="{1F91F900-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_grid_overlay.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.SetGridOverlay(); } /*----------------------------------------------------------------------------*/ /* WorksheetGridUnderlay */ /*----------------------------------------------------------------------------*/ macro WorksheetGridUnderlay() [Category="Worksheet Commands", Guid="{1F91F901-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_grid_underlay.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.SetGridUnderlay(); } /*----------------------------------------------------------------------------*/ /* WorksheetGridZBuffer */ /*----------------------------------------------------------------------------*/ macro WorksheetGridZBuffer() [Category="Worksheet Commands", Guid="{1F91F902-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_grid_zbuffer.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.SetGridZBuffer(); } /*----------------------------------------------------------------------------*/ /* WorksheetGridEnlarge */ /*----------------------------------------------------------------------------*/ macro WorksheetGridEnlarge() [Category="Worksheet Commands", Guid="{1F91F905-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_grid_size_large.bmp"] { ModelView a_oView = Model.ActiveView; Model.Grid.Begin.X -= 8.0; Model.Grid.Begin.Y -= 8.0; Model.Grid.End.X += 8.0; Model.Grid.End.Y += 8.0; } /*----------------------------------------------------------------------------*/ /* WorksheetGridShrink */ /*----------------------------------------------------------------------------*/ macro WorksheetGridShrink() [Category="Worksheet Commands", Guid="{1F91F906-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_grid_size_small.bmp"] { ModelView a_oView = Model.ActiveView; Model.Grid.Begin.X += 8.0; Model.Grid.Begin.Y += 8.0; Model.Grid.End.X -= 8.0; Model.Grid.End.Y -= 8.0; } /*----------------------------------------------------------------------------*/ /* WorksheetGridTop */ /*----------------------------------------------------------------------------*/ macro WorksheetGridTop() [Category="Worksheet Commands", Guid="{1F91F908-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_orientation_top.bmp"] { ModelView a_oView = Model.ActiveView; Matrix editTransform = Model.Grid.GetTransform(); editTransform.Orientation[0] = 0.0; editTransform.Orientation[1] = 0.0; editTransform.Orientation[2] = 0.0; Model.Grid.SetTransform( editTransform ); } /*----------------------------------------------------------------------------*/ /* WorksheetGridFront */ /*----------------------------------------------------------------------------*/ macro WorksheetGridFront() [Category="Worksheet Commands", Guid="{1F91F909-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_orientation_front.bmp"] { ModelView a_oView = Model.ActiveView; Matrix editTransform = Model.Grid.GetTransform(); editTransform.Orientation[0] = -90.0; editTransform.Orientation[1] = 0.0; editTransform.Orientation[2] = 0.0; Model.Grid.SetTransform( editTransform ); } /*----------------------------------------------------------------------------*/ /* WorksheetGridSide */ /*----------------------------------------------------------------------------*/ macro WorksheetGridSide() [Category="Worksheet Commands", Guid="{1F91F90A-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_orientation_side.bmp"] { ModelView a_oView = Model.ActiveView; Matrix editTransform = Model.Grid.GetTransform(); editTransform.Orientation[0] = 0.0; editTransform.Orientation[1] = -90.0; editTransform.Orientation[2] = 0.0; Model.Grid.SetTransform( editTransform ); } /*----------------------------------------------------------------------------*/ /* WorksheetCameraReset */ /*----------------------------------------------------------------------------*/ macro WorksheetCameraReset() [Category="Worksheet Commands", Guid="{1F91F90B-F612-46D4-A453-4B81096121A9}", Image="EDITTOOLS!IDB_RESETCAMERA_COMMAND"] { ModelView a_oView = Model.ActiveView; a_oView.Orientation.X = 0.0; a_oView.Orientation.Y = 0.0; a_oView.Orientation.Z = 0.0; a_oView.Position.X = 0.0; a_oView.Position.Y = 0.0; a_oView.Position.Z = 0.0; a_oView.Zoom = 1.0; } /*----------------------------------------------------------------------------*/ /* WorksheetSetBoundingBoxColorRed */ /*----------------------------------------------------------------------------*/ macro WorksheetSetBoundingBoxColorRed() [Category="Worksheet Commands", Guid="{1F91F951-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\set_bounding_box_red.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.BoundingBoxColor.SetRGB( 0xFF, 0x40, 0x40 ); } /*----------------------------------------------------------------------------*/ /* WorksheetSetBoundingBoxColorGreen */ /*----------------------------------------------------------------------------*/ macro WorksheetSetBoundingBoxColorGreen() [Category="Worksheet Commands", Guid="{1F91F953-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\set_bounding_box_green.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.BoundingBoxColor.SetRGB( 0x92, 0xF7, 0x73 ); } /*----------------------------------------------------------------------------*/ /* WorksheetSetBoundingBoxColorBlue */ /*----------------------------------------------------------------------------*/ macro WorksheetSetBoundingBoxColorBlue() [Category="Worksheet Commands", Guid="{1F91F952-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\set_bounding_box_blue.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.BoundingBoxColor.SetRGB( 0xD8, 0xD9, 0xFA ); } /*----------------------------------------------------------------------------*/ /* WorksheetCameraZoomIn */ /*----------------------------------------------------------------------------*/ macro WorksheetCameraZoomIn() [Category="Worksheet Commands", Guid="{1F91F954-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_zoom_in.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.Zoom *= 2.0; } /*----------------------------------------------------------------------------*/ /* WorksheetCameraZoomOut */ /*----------------------------------------------------------------------------*/ macro WorksheetCameraZoomOut() [Category="Worksheet Commands", Guid="{1F91F955-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_zoom_in.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.Zoom /= 2.0; } /*----------------------------------------------------------------------------*/ /* WorksheetRenderFullBoundingBox */ /*----------------------------------------------------------------------------*/ macro WorksheetRenderFullBoundingBox() [Category="Worksheet Commands", Guid="{1F91F91C-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\full_bounding_box.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.FullBoundingBox = true; } /*----------------------------------------------------------------------------*/ /* WorksheetRenderPartialBoundingBox */ /*----------------------------------------------------------------------------*/ macro WorksheetRenderPartialBoundingBox() [Category="Worksheet Commands", Guid="{1F91F91D-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\partial_bounding_box.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.FullBoundingBox = false; } /*----------------------------------------------------------------------------*/ /* WorksheetRenderWithFog */ /*----------------------------------------------------------------------------*/ macro WorksheetRenderWithFog() [Category="Worksheet Commands", Guid="{1F91F91E-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_render_fog.bmp"] { ModelView a_oView = Model.ActiveView; // Only turn on fog if we are in perspective view. // ModelView Projection Values: // 0 == Perspective // 1 == General Isometric // 2 == Top // 3 == Front // 4 == Side if( a_oView.GetProjection() == 0 ) { if ( a_oView.Fog == 0 ) { a_oView.FarClip = 100000; a_oView.Fog = 1; a_oView.FogStart = 1; a_oView.FogEnd = 100000; a_oView.FogColor.SetRGB( 230, 220, 255 ); a_oView.TopColor.SetRGB( 230, 220, 255 ); a_oView.MiddleColor.SetRGB( 230, 220, 255 ); a_oView.BottomColor.SetRGB( 230, 220, 255 ); } if ( a_oView.Fog == 1 ) { a_oView.Fog = 0; } } } /*----------------------------------------------------------------------------*/ /* WorksheetRenderWithoutFog */ /*----------------------------------------------------------------------------*/ macro WorksheetRenderWithoutFog() [Category="Worksheet Commands", Guid="{1F91F91F-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_render_clear.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.Fog = 0; } /*----------------------------------------------------------------------------*/ /* WorksheetLayoutOnePanel */ /*----------------------------------------------------------------------------*/ macro WorksheetLayoutOnePanel() [Category="Worksheet Commands", Guid="{1F91F9B4-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_layout_one.bmp"] { Application.Window.Split( 1, 1, 100, 100 ); ModelView a_oTopView = Application.Window.GetView( 0, 0 ); a_oTopView.Orientation.X = 45.0; a_oTopView.Orientation.Y = 0.0; a_oTopView.Orientation.Z = 0.0; a_oTopView.Position.X = 2.0; a_oTopView.Position.Y = -50.0; a_oTopView.Position.Z = 35.0; a_oTopView.NearClip = 10.0; a_oTopView.FarClip = 10000000.0; a_oTopView.Zoom = 1.0; a_oTopView.Axes = false; a_oTopView.Grid = true; a_oTopView.TopColor.SetRGB( 0x80, 0x80, 0x80 ); a_oTopView.MiddleColor.SetRGB( 0x80, 0x80, 0x80 ); a_oTopView.BottomColor.SetRGB( 0x80, 0x80, 0x80 ); a_oTopView.GridColor.SetRGB( 0x64, 0x64, 0x64 ); a_oTopView.GridQuadrantColor.SetRGB( 0x40, 0x40, 0x40 ); a_oTopView.SetPerspective(); a_oTopView.RenderFilled(); a_oTopView.RenderSolid(); } /*----------------------------------------------------------------------------*/ /* WorksheetLayoutTwoPanel */ /*----------------------------------------------------------------------------*/ macro WorksheetLayoutTwoPanel() [Category="Worksheet Commands", Guid="{1F91F9B5-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_layout_two.bmp"] { Application.Window.Split( 2, 1, 50, 50 ); ModelView a_oTopView = Application.Window.GetView( 0, 0 ); ModelView a_oBottomView = Application.Window.GetView( 1, 0 ); a_oTopView.SetTop(); a_oTopView.Orientation.X = 0.0; a_oTopView.Orientation.Y = 0.0; a_oTopView.Orientation.Z = 0.0; a_oTopView.Position.X = 0.0; a_oTopView.Position.Y = 0.0; a_oTopView.Position.Z = 0.0; a_oTopView.Zoom = 1.0; a_oTopView.NearClip = -10000.0; a_oTopView.FarClip = 10000.0; a_oTopView.TopColor.SetRGB( 0x80, 0x80, 0x80 ); a_oTopView.MiddleColor.SetRGB( 0x80, 0x80, 0x80 ); a_oTopView.BottomColor.SetRGB( 0x80, 0x80, 0x80 ); a_oTopView.GridColor.SetRGB( 0x64, 0x64, 0x64 ); a_oTopView.GridQuadrantColor.SetRGB( 0x40, 0x40, 0x40 ); a_oTopView.Backfacing = true; a_oTopView.RenderWireframe(); a_oTopView.RenderSolid(); a_oBottomView.Orientation.X = 45.0; a_oBottomView.Orientation.Y = 0.0; a_oBottomView.Orientation.Z = 0.0; a_oBottomView.Position.X = 2.0; a_oBottomView.Position.Y = -50.0; a_oBottomView.Position.Z = 35.0; a_oBottomView.NearClip = 10.0; a_oBottomView.FarClip = 10000000.0; a_oBottomView.Axes = false; a_oBottomView.Grid = true; a_oBottomView.TopColor.SetRGB( 0x80, 0x80, 0x80 ); a_oBottomView.MiddleColor.SetRGB( 0x80, 0x80, 0x80 ); a_oBottomView.BottomColor.SetRGB( 0x80, 0x80, 0x80 ); a_oBottomView.GridColor.SetRGB( 0x64, 0x64, 0x64 ); a_oBottomView.GridQuadrantColor.SetRGB( 0x40, 0x40, 0x40 ); a_oBottomView.SetPerspective(); a_oBottomView.RenderFilled(); a_oBottomView.RenderSolid(); } /*----------------------------------------------------------------------------*/ /* WorksheetLayoutFourPanel */ /*----------------------------------------------------------------------------*/ macro WorksheetLayoutFourPanel() [Category="Worksheet Commands", Guid="{1F91F9B6-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_layout_four.bmp"] { Application.Window.Split( 2, 2, 50, 50 ); ModelView a_oTopLeftView = Application.Window.GetView( 0, 0 ); ModelView a_oBottomLeftView = Application.Window.GetView( 1, 0 ); ModelView a_oTopRightView = Application.Window.GetView( 0, 1 ); ModelView a_oBottomRightView = Application.Window.GetView( 1, 1 ); Matrix editTransform = Model.Grid.GetTransform(); editTransform.Orientation[0] = 0.0; editTransform.Orientation[1] = 0.0; editTransform.Orientation[2] = 0.0; Model.Grid.SetTransform( editTransform ); a_oTopLeftView.Orientation.X = 45.0; a_oTopLeftView.Orientation.Y = 0.0; a_oTopLeftView.Orientation.Z = 0.0; a_oTopLeftView.Position.X = 2.0; a_oTopLeftView.Position.Y = -50.0; a_oTopLeftView.Position.Z = 35.0; a_oTopLeftView.NearClip = 10.0; a_oTopLeftView.FarClip = 10000000.0; a_oTopLeftView.Zoom = 1.0; a_oTopLeftView.Axes = false; a_oTopLeftView.Grid = true; a_oTopLeftView.TopColor.SetRGB( 0x80, 0x80, 0x80 ); a_oTopLeftView.MiddleColor.SetRGB( 0x80, 0x80, 0x80 ); a_oTopLeftView.BottomColor.SetRGB( 0x80, 0x80, 0x80 ); a_oTopLeftView.GridColor.SetRGB( 0x64, 0x64, 0x64 ); a_oTopLeftView.GridQuadrantColor.SetRGB( 0x40, 0x40, 0x40 ); a_oTopLeftView.SetPerspective(); a_oTopLeftView.RenderFilled(); a_oTopLeftView.RenderSolid(); a_oBottomLeftView.SetTop(); a_oBottomLeftView.Backfacing = true; a_oBottomLeftView.Orientation.X = 0.0; a_oBottomLeftView.Orientation.Y = 0.0; a_oBottomLeftView.Orientation.Z = 0.0; a_oBottomLeftView.Position.X = 0.0; a_oBottomLeftView.Position.Y = 0.0; a_oBottomLeftView.Position.Z = 0.0; a_oBottomLeftView.Zoom = 1.0; a_oBottomLeftView.NearClip = -10000.0; a_oBottomLeftView.FarClip = 10000.0; a_oBottomLeftView.Axes = false; a_oBottomLeftView.Grid = true; a_oBottomLeftView.TopColor.SetRGB( 0x80, 0x80, 0x80 ); a_oBottomLeftView.MiddleColor.SetRGB( 0x80, 0x80, 0x80 ); a_oBottomLeftView.BottomColor.SetRGB( 0x80, 0x80, 0x80 ); a_oBottomLeftView.GridColor.SetRGB( 0x64, 0x64, 0x64 ); a_oBottomLeftView.GridQuadrantColor.SetRGB( 0x40, 0x40, 0x40 ); a_oBottomLeftView.RenderWireframe(); a_oBottomLeftView.RenderSolid(); a_oTopRightView.SetSide(); a_oTopRightView.Backfacing = true; a_oTopRightView.Orientation.X = 0.0; a_oTopRightView.Orientation.Y = 0.0; a_oTopRightView.Orientation.Z = 0.0; a_oTopRightView.Position.X = 0.0; a_oTopRightView.Position.Y = 0.0; a_oTopRightView.Position.Z = 0.0; a_oTopRightView.NearClip = -10000.0; a_oTopRightView.FarClip = 10000.0; a_oTopRightView.Axes = false; a_oTopRightView.Grid = true; a_oTopRightView.TopColor.SetRGB( 0x80, 0x80, 0x80 ); a_oTopRightView.MiddleColor.SetRGB( 0x80, 0x80, 0x80 ); a_oTopRightView.BottomColor.SetRGB( 0x80, 0x80, 0x80 ); a_oTopRightView.GridColor.SetRGB( 0x64, 0x64, 0x64 ); a_oTopRightView.GridQuadrantColor.SetRGB( 0x40, 0x40, 0x40 ); a_oTopRightView.RenderWireframe(); a_oTopRightView.RenderSolid(); a_oBottomRightView.SetFront(); a_oBottomRightView.Backfacing = true; a_oBottomRightView.Orientation.X = 0.0; a_oBottomRightView.Orientation.Y = 0.0; a_oBottomRightView.Orientation.Z = 0.0; a_oBottomRightView.Position.X = 0.0; a_oBottomRightView.Position.Y = 0.0; a_oBottomRightView.Position.Z = 0.0; a_oBottomRightView.NearClip = -10000.0; a_oBottomRightView.FarClip = 10000.0; a_oBottomRightView.Axes = false; a_oBottomRightView.Grid = true; a_oBottomRightView.TopColor.SetRGB( 0x80, 0x80, 0x80 ); a_oBottomRightView.MiddleColor.SetRGB( 0x80, 0x80, 0x80 ); a_oBottomRightView.BottomColor.SetRGB( 0x80, 0x80, 0x80 ); a_oBottomRightView.GridColor.SetRGB( 0x64, 0x64, 0x64 ); a_oBottomRightView.GridQuadrantColor.SetRGB( 0x40, 0x40, 0x40 ); a_oBottomRightView.RenderWireframe(); a_oBottomRightView.RenderSolid(); } /*----------------------------------------------------------------------------*/ /* WorksheetViewTop */ /*----------------------------------------------------------------------------*/ macro WorksheetViewTop() [Category="Worksheet Commands", Guid="{1F91F9B7-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_orientation_top.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.SetTop(); a_oView.Orientation.X = 0.0; a_oView.Orientation.Y = 0.0; a_oView.Orientation.Z = 0.0; a_oView.NearClip = -1000000.0; a_oView.FarClip = 1000000.0; Matrix editTransform = Model.Grid.GetTransform(); editTransform.Orientation[0] = 0.0; editTransform.Orientation[1] = 0.0; editTransform.Orientation[2] = 0.0; Model.Grid.SetTransform( editTransform ); } /*----------------------------------------------------------------------------*/ /* WorksheetViewSide */ /*----------------------------------------------------------------------------*/ macro WorksheetViewSide() [Category="Worksheet Commands", Guid="{1F91F9B8-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_orientation_side.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.SetSide(); a_oView.Orientation.X = 0.0; a_oView.Orientation.Y = 0.0; a_oView.Orientation.Z = 0.0; a_oView.NearClip = -1000000.0; a_oView.FarClip = 1000000.0; Matrix editTransform = Model.Grid.GetTransform(); editTransform.Orientation[0] = 0.0; editTransform.Orientation[1] = -90.0; editTransform.Orientation[2] = 0.0; Model.Grid.SetTransform( editTransform ); } /*----------------------------------------------------------------------------*/ /* WorksheetViewFront */ /*----------------------------------------------------------------------------*/ macro WorksheetViewFront() [Category="Worksheet Commands", Guid="{1F91F9B9-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_orientation_front.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.SetFront(); a_oView.Orientation.X = 0.0; a_oView.Orientation.Y = 0.0; a_oView.Orientation.Z = 0.0; a_oView.NearClip = -1000000.0; a_oView.FarClip = 1000000.0; Matrix editTransform = Model.Grid.GetTransform(); editTransform.Orientation[0] = -90.0; editTransform.Orientation[1] = 0.0; editTransform.Orientation[2] = 0.0; Model.Grid.SetTransform( editTransform ); } /*----------------------------------------------------------------------------*/ /* WorksheetViewPerspective */ /*----------------------------------------------------------------------------*/ macro WorksheetViewPerspective() [Category="Worksheet Commands", Guid="{1F91F9BA-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_orientation_perspective.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.Orientation.X = 0.0; a_oView.Orientation.Y = 0.0; a_oView.Orientation.Z = 0.0; a_oView.Zoom = 1.0; // Check the near clipping plane before setting the perspective view. If the value is not 1, then set it to 1. double test_nearclip = a_oView.NearClip; if ( test_nearclip != 1 ) { a_oView.NearClip = 1; } a_oView.SetPerspective(); } /*----------------------------------------------------------------------------*/ /* WorksheetViewBack */ /*----------------------------------------------------------------------------*/ macro WorksheetViewBack() [Category="Worksheet Commands", Guid="{1F91F90C-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_orientation_back.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.SetFront(); a_oView.Orientation.X = 0.0; a_oView.Orientation.Y = 0.0; a_oView.Orientation.Z = 180.0; } /*----------------------------------------------------------------------------*/ /* WorksheetViewLeftSide */ /*----------------------------------------------------------------------------*/ macro WorksheetViewLeftSide() [Category="Worksheet Commands", Guid="{1F91F90D-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_orientation_left_side.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.SetSide(); a_oView.Orientation.X = 0.0; a_oView.Orientation.Y = 0.0; a_oView.Orientation.Z = 180.0; } /*----------------------------------------------------------------------------*/ /* WorksheetListCameras */ /*----------------------------------------------------------------------------*/ macro WorksheetListCameras() [ Category="Worksheet Commands", Guid="{1F91FB09-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\blank.bmp" ] { EnumerateView a_oView = (EnumerateView)Application.GetEditor( "{1F922100-F612-46D4-A453-4B81096121A9}" ); a_oView.SetRoot( Model.GetSelectedNode( 0 ).GetNode() ); a_oView.Activate(); } /*----------------------------------------------------------------------------*/ /* WorksheetCameraAlignWithGroup */ /*----------------------------------------------------------------------------*/ macro WorksheetCameraAlignWithGroup() [ Category="Worksheet Commands", Guid="{1F91FB08-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_camera_align_with_group.bmp" ] { for( int i = 0; i < Model.GetSelectCount(); ++i ) { Node node = Model.GetSelectedNode( i ).GetNode(); if( node.IsDerived( Group ) ) { // Copy the group bounding box parameters into a matrix. Group group = (Group)node; Matrix gTransform = group.GetTransform(); // Modify the worksheet projection, clip planes, zoom, and camera position. ModelView a_oView = Model.ActiveView; a_oView.Position.X = gTransform.Position[0]; a_oView.Position.Y = gTransform.Position[1]; a_oView.Position.Z = gTransform.Position[2]; a_oView.Orientation.X = gTransform.Orientation[0]; a_oView.Orientation.Y = gTransform.Orientation[1]; a_oView.Orientation.Z = gTransform.Orientation[2]; } } } /*----------------------------------------------------------------------------*/ /* WorksheetCameraPositionAtCenter */ /*----------------------------------------------------------------------------*/ macro WorksheetCameraPositionAtCenter() [ Category="Worksheet Commands", Guid="{1F91FA58-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\change_camera_position.bmp" ] { for( int i = 0; i < Model.GetSelectCount(); ++i ) { Node node = Model.GetSelectedNode( i ).GetNode(); if( node.IsDerived( Group ) ) { // Copy the group bounding box parameters into a matrix. Group group = (Group)node; Matrix gTransform = group.GetTransform(); // Calculate the centroid of the group bounding box in WCS. double range_along_x = ( group.BoundMin[0] / 2 ) + ( group.BoundMax[0] / 2 ); double range_along_y = ( group.BoundMin[1] / 2 ) + ( group.BoundMax[1] / 2 ); double range_along_z = ( group.BoundMin[2] / 2 ) + ( group.BoundMax[2] / 2 ); // Modify the worksheet projection, clip planes, zoom, and camera position. ModelView a_oView = Model.ActiveView; a_oView.Position.X = range_along_x; a_oView.Position.Y = range_along_y; a_oView.Position.Z = range_along_z; a_oView.Orientation.X = gTransform.Orientation[0]; a_oView.Orientation.Y = gTransform.Orientation[1]; a_oView.Orientation.Z = gTransform.Orientation[2]; } } } /*----------------------------------------------------------------------------*/ /* WorksheetCameraPositionAtLight */ /*----------------------------------------------------------------------------*/ macro WorksheetCameraPositionAtLight() [ Category="Worksheet Commands", Guid="{1F91FA6C-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\change_camera_position.bmp" ] { for( int i = 0; i < Model.GetSelectCount(); ++i ) { Node node = Model.GetSelectedNode( i ).GetNode(); if( node.IsDerived( Light ) ) { // Copy the light position parameters into a matrix. Light light = (Light)Model.EditNode( node ); Matrix editPosition = new Matrix; editPosition.Position[0] = light.Position.X; editPosition.Position[1] = light.Position.Y; editPosition.Position[2] = light.Position.Z; // Copy the light orientation parameters into a matrix. Matrix editOrientation = new Matrix; editOrientation.Orientation[0] = light.Direction.X; editOrientation.Orientation[1] = light.Direction.Y; editOrientation.Orientation[2] = light.Direction.Z; // Update the view ModelView a_oView = Model.ActiveView; a_oView.Position.X = editPosition.Position[0]; a_oView.Position.Y = editPosition.Position[1]; a_oView.Position.Z = editPosition.Position[2]; a_oView.Orientation.X = editOrientation.Orientation[0]; a_oView.Orientation.Y = editOrientation.Orientation[1]; a_oView.Orientation.Z = editOrientation.Orientation[2]; } } } /*----------------------------------------------------------------------------*/ /* WorksheetCameraFindTerrain */ /*----------------------------------------------------------------------------*/ macro WorksheetCameraFindTerrain() [ Category="Worksheet Commands", Guid="{1F91FB05-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\camera_find_terrain.bmp" ] { ModelView a_oDetermineViewProjection = Model.ActiveView; for( int i = 0; i < Model.GetSelectCount(); ++i ) { Node node = Model.GetSelectedNode( i ).GetNode(); if( node.IsDerived( Mesh ) ) { // Copy the group bounding box parameters into a matrix. Mesh group = (Mesh)node; Matrix gTransform = group.GetTransform(); // Calculate the centroid of the group bounding box in WCS. Vec min = new Vec; Vec max = new Vec; group.GetVertexMin( min ); group.GetVertexMax( max ); min.Blend( max, 0.5 ); double range_along_x = min.X; double range_along_y = min.Y; double range_along_z = min.Z; delete min; delete max; // Modify the worksheet projection, clip planes, zoom, and camera position. ModelView a_oView = Model.ActiveView; a_oView.Orientation.X = 0.0; a_oView.Orientation.Y = 0.0; a_oView.Orientation.Z = 0.0; if ( a_oDetermineViewProjection.NearClip < 0 ) { a_oView.SetTop(); a_oView.NearClip = -1000000.0; a_oView.FarClip = 1000000.0; a_oView.Zoom = 0.0005; } else { a_oView.SetPerspective(); a_oView.NearClip = 10.0; a_oView.FarClip = 250000.0; a_oView.Orientation.X = 45; a_oView.Zoom = 1; } a_oView.Position.X = range_along_x; a_oView.Position.Y = range_along_y; a_oView.Position.Z = range_along_z + ( 25000 ); // Pretend you're in an airplane. a_oView.Orientation.X = 45; a_oView.Orientation.Y = gTransform.Orientation[1]; a_oView.Orientation.Z = gTransform.Orientation[2]; } } } /*----------------------------------------------------------------------------*/ /* WorksheetManipulatorFlip */ /*----------------------------------------------------------------------------*/ // This command flips the manipulator by inverting its scale values. macro WorksheetManipulatorFlip() [ Category="Worksheet Commands", Guid="{1F91FA7D-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\manipulator_flip.bmp" ] { ModelView a_oView = Model.ActiveView; // Copy the manipulator parameters into a maxtrix. Matrix editTransform = Model.Grid.GetManipulatorTransform(); // Flip the manipulator by inverting the matrix X/Y if necessary. // If the manipulator has negative scale values, it has already been flipped. Reset. if ( editTransform.Scale[0] = 1 ) { editTransform.Scale[0] = -1; editTransform.Scale[1] = -1; editTransform.Scale[2] = 1; } else { editTransform.Scale[0] = 1; editTransform.Scale[1] = 1; editTransform.Scale[2] = 1; } // Update the model. Model.Grid.SetManipulatorTransform( editTransform ); } /*----------------------------------------------------------------------------*/ /* WorksheetManipulatorAlignWithGrid */ /*----------------------------------------------------------------------------*/ // This command aligns the manipulator with the position and orientation of the grid. macro WorksheetManipulatorAlignWithGrid() [ Category="Worksheet Commands", Guid="{1F91FA7E-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\manipulator_align_with_grid.bmp" ] { ModelView a_oView = Model.ActiveView; // Copy the grid position and orienation into a matrix. Matrix grid = Model.Grid.GetTransform(); // Initialize a matrix for the manipulator. Matrix editTransform = Model.Grid.GetManipulatorTransform(); // Copy the matrix values from the grid initialized matrix to the manipulator matrix. editTransform.Orientation[0] = grid.Orientation[0]; editTransform.Orientation[1] = grid.Orientation[1]; editTransform.Orientation[2] = grid.Orientation[2]; editTransform.Position[0] = grid.Position[0]; editTransform.Position[1] = grid.Position[1]; editTransform.Position[2] = grid.Position[2]; // Push the values onto the manipulator. Model.Grid.SetManipulatorTransform( editTransform ); } /*----------------------------------------------------------------------------*/ /* WorksheetManipulatorResetOrientation */ /*----------------------------------------------------------------------------*/ // This command resets the manipulator orientation to 0 degrees along X, Y, and Z. macro WorksheetManipulatorResetOrientation() [ Category="Worksheet Commands", Guid="{1F91FA66-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\normalize_manipulator.bmp" ] { ModelView a_oView = Model.ActiveView; // Initialize a matrix. Matrix editTransform = Model.Grid.GetManipulatorTransform(); // Zero the orientation parameters. editTransform.Orientation[0] = 0.0; editTransform.Orientation[1] = 0.0; editTransform.Orientation[2] = 0.0; // Push these values onto the manipulator. Model.Grid.SetManipulatorTransform( editTransform ); } /*----------------------------------------------------------------------------*/ /* WorksheetManipulatorResetScale */ /*----------------------------------------------------------------------------*/ // This command resets the manipulator scale to 1 unit along X, Y, and Z. macro WorksheetManipulatorResetScale() [ Category="Worksheet Commands", Guid="{1F91FA74-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\reset_manipulator_size.bmp" ] { ModelView a_oView = Model.ActiveView; // Initialize a matrix. Matrix editTransform = Model.Grid.GetManipulatorTransform(); // Reset the scale values. editTransform.Scale[0] = 1.0; editTransform.Scale[1] = 1.0; editTransform.Scale[2] = 1.0; // Push these values onto the manipulator. Model.Grid.SetManipulatorTransform( editTransform ); } /*----------------------------------------------------------------------------*/ /* WorksheetManipulatorAlignWithSelection */ /*----------------------------------------------------------------------------*/ // This command aligns the manipulator with the transformation of the selection. // The selection needs to be a group node, level-of-detail node, or mesh node. // The selection can also be a mesh select. macro WorksheetManipulatorAlignWithSelection() [ Category="Worksheet Commands", Guid="{2EABCDEF-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\manipulator_center_on_selection.bmp" ] { Node node = (Node)Model.GetSelectedNode( 0 ).GetNode(); if( node.IsDerived( Node ) ) { Vec aVec1 = new Vec; Vec aVec2 = new Vec; Matrix RootTransform = new Matrix; node.Parent().GetTransformToGroup( Model, RootTransform ); Model.GetSelectedNode( 0 ).GetSelectBounds( aVec1, aVec2 ); node.Parent().TransformPointToGroup( Model, aVec1); RootTransform.Position[0] = aVec1.X; RootTransform.Position[1] = aVec1.Y; RootTransform.Position[2] = aVec1.Z; Model.Grid.SetManipulatorTransform( RootTransform ); delete RootTransform; delete aVec1; delete aVec2; } } /*----------------------------------------------------------------------------*/ /* WorksheetManipulatorAlignWithBoundingBox */ /*----------------------------------------------------------------------------*/ // This script positions the manipulator at the center of group-derived nodes. macro WorksheetManipulatorAlignWithBoundingBox() [ Category="Worksheet Commands", Guid="{1F91FA5A-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\manipulator_align_with_bounding_box.bmp" ] { for( int i = 0; i < Model.GetSelectCount(); ++i ) { Node node = Model.GetSelectedNode( i ).GetNode(); if( node.IsDerived( Group ) ) { Group group = (Group)Model.EditNode( node ); Matrix editManipulator = new Matrix; Matrix getTransform = group.GetTransform(); editManipulator.Orientation[0] = getTransform.Orientation[0]; editManipulator.Orientation[1] = getTransform.Orientation[1]; editManipulator.Orientation[2] = getTransform.Orientation[2]; Model.Grid.SetManipulatorTransform( editManipulator ); } } } /*----------------------------------------------------------------------------*/ /* WorksheetManipulatorAlignWithCentroid */ /*----------------------------------------------------------------------------*/ // This command aligns the manipulator with the centroid of a group, level-of-detail, mesh, or face-edge-vertex selection. macro WorksheetManipulatorAlignWithCentroid() [ Category="Worksheet Commands", Guid="{1F91FA68-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\manipulator_align_with_centroid.bmp" ] { for( int i = 0; i < Model.GetSelectCount(); ++i ) { Node node = Model.GetSelectedNode( i ).GetNode(); if( node.IsDerived( Group ) ) { Group group = (Group)Model.EditNode( node ); Vec aVec1 = new Vec; Vec aVec2 = new Vec; Matrix editManipulator = Model.Grid.GetManipulatorTransform(); Model.GetSelectBounds( aVec1, aVec2 ); editManipulator.Position[0] = ( aVec1.X / 2 ) + ( aVec2.X / 2 ); editManipulator.Position[1] = ( aVec1.Y / 2 ) + ( aVec2.Y / 2 ); editManipulator.Position[2] = ( aVec1.Z / 2 ) + ( aVec2.Z / 2 ); Model.Grid.SetManipulatorTransform( editManipulator ); } } } /*----------------------------------------------------------------------------*/ /* WorksheetManipulatorCenterOnView */ /*----------------------------------------------------------------------------*/ // This command positions the manipulator near in the center of the view. function void GetViewportCenter( ModelView activeView, Vec center ) { Vec end = new Vec; activeView.GetViewRay( activeView.GetViewWidth() * 0.5, activeView.GetViewHeight() * 0.5, center, end ); center.Blend( end, 64.0f / ( center.GetDistance( end ) ) ); delete end; } macro WorksheetManipulatorCenterOnView() [ Category="Worksheet Commands", Guid="{1F91FA7F-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\manipulator_smart_position.bmp" ] { ModelView activeView = Model.ActiveView; Vec center = new Vec; GetViewportCenter( activeView, center ); Matrix editTransform = Model.Grid.GetManipulatorTransform(); editTransform.Position[0] = center.X; editTransform.Position[1] = center.Y; editTransform.Position[2] = center.Z; Model.Grid.SetManipulatorTransform( editTransform ); delete center; } /*----------------------------------------------------------------------------*/ /* WorksheetManipulatorEnlarge */ /*----------------------------------------------------------------------------*/ // This command aligns the manipulator with the transformation of the selection. // The selection needs to be a group node, level-of-detail node, or mesh node. macro WorksheetManipulatorEnlarge() [ Category="Worksheet Commands", Guid="{1F91FA69-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\manipulator_enlarge.bmp" ] { ModelView a_oView = Model.ActiveView; Matrix editTransform = Model.Grid.GetManipulatorTransform(); editTransform.Scale[0] += 0.01; editTransform.Scale[1] += 0.01; editTransform.Scale[2] += 0.01; Model.Grid.SetManipulatorTransform( editTransform ); } /*----------------------------------------------------------------------------*/ /* WorksheetManipulatorShrink */ /*----------------------------------------------------------------------------*/ // This command aligns the manipulator with the transformation of the selection. // The selection needs to be a group node, level-of-detail node, or mesh node. macro WorksheetManipulatorShrink() [ Category="Worksheet Commands", Guid="{1F91FA6A-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\manipulator_shrink.bmp" ] { ModelView a_oView = Model.ActiveView; Matrix editTransform = Model.Grid.GetManipulatorTransform(); if ( editTransform.Scale[0] && editTransform.Scale[1] && editTransform.Scale[2] > 0.1 ) { editTransform.Scale[0] -= 0.01; editTransform.Scale[1] -= 0.01; editTransform.Scale[2] -= 0.01; } else { editTransform.Scale[0] = 0.01; editTransform.Scale[1] = 0.01; editTransform.Scale[2] = 0.01; } Model.Grid.SetManipulatorTransform( editTransform ); } /*----------------------------------------------------------------------------*/ /* WorksheetManipulatorRotate */ /*----------------------------------------------------------------------------*/ // This command rotates the manipulator 90 degrees on Z. macro WorksheetManipulatorRotate() [ Category="Worksheet Commands", Guid="{1F91FA80-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\manipulator_rotate.bmp" ] { // Rotate the manipulator by ninety degrees on Z. ModelView a_oView = Model.ActiveView; Matrix editTransform = Model.Grid.GetManipulatorTransform(); editTransform.Orientation[2] += 90; Model.Grid.SetManipulatorTransform( editTransform ); } /*----------------------------------------------------------------------------*/ /* WorksheetConfigureForWideAreaScenery */ /*----------------------------------------------------------------------------*/ macro WorksheetConfigureForWideAreaScenery() [Category="Worksheet Commands", Guid="{1F91FAC3-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_wide_area_scenery.bmp"] { ModelView a_oView = Model.ActiveView; // Configure the near clipping plane with a large value. This prevents z-buffer precision under/over flow. // Configure the far clipping plane with a very, very large value. a_oView.NearClip = 10.0; a_oView.FarClip = 10000000.0; a_oView.Zoom = 1.0; a_oView.SetPerspective(); } /*----------------------------------------------------------------------------*/ /* WorksheetConfigureForSmallAreaScenery */ /*----------------------------------------------------------------------------*/ macro WorksheetConfigureForSmallAreaScenery() [Category="Worksheet Commands", Guid="{1F91FAC4-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\worksheet_small_area_scenery.bmp"] { ModelView a_oView = Model.ActiveView; // Configure the near clipping plane with a normal value of 1. // Configure the far clipping plane with a reasonably large value. a_oView.NearClip = 1.0; a_oView.FarClip = 10000.0; a_oView.Zoom = 1.0; a_oView.SetPerspective(); } /*----------------------------------------------------------------------------*/ /* WorksheetToggleGlobalVertexDisplay */ /*----------------------------------------------------------------------------*/ macro WorksheetToggleGlobalVertexDisplay() [Category="Worksheet Commands", Guid="{1F91FAE6-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\mesh_vertex_display.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.GlobalVertices = !a_oView.GlobalVertices; } /*----------------------------------------------------------------------------*/ /* WorksheetToggleGlobalVertexNormalDisplay */ /*----------------------------------------------------------------------------*/ macro WorksheetToggleGlobalVertexNormalDisplay() [Category="Worksheet Commands", Guid="{1F91FAE9-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\mesh_vertex_normal_display.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.GlobalVertexNormals = !a_oView.GlobalVertexNormals; } /*----------------------------------------------------------------------------*/ /* WorksheetToggleGlobalEdgeDisplay */ /*----------------------------------------------------------------------------*/ macro WorksheetToggleGlobalEdgeDisplay() [Category="Worksheet Commands", Guid="{1F91FADF-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\mesh_edge_display.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.GlobalEdges = !a_oView.GlobalEdges; } /*----------------------------------------------------------------------------*/ /* WorksheetToggleGlobalHiddenEdgeDisplay */ /*----------------------------------------------------------------------------*/ macro WorksheetToggleGlobalHiddenEdgeDisplay() [Category="Worksheet Commands", Guid="{1F91FAE7-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\mesh_hidden_edge_display.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.GlobalHiddenEdges = !a_oView.GlobalHiddenEdges; } /*----------------------------------------------------------------------------*/ /* WorksheetToggleGlobalFaceNormalDisplay */ /*----------------------------------------------------------------------------*/ macro WorksheetToggleGlobalFaceNormalDisplay() [Category="Worksheet Commands", Guid="{1F91FAE8-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\mesh_face_normal_display.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.GlobalFaceNormals = !a_oView.GlobalFaceNormals; } /*----------------------------------------------------------------------------*/ /* WorksheetToggleGlobalHandleDisplay */ /*----------------------------------------------------------------------------*/ macro WorksheetToggleGlobalHandleDisplay() [Category="Worksheet Commands", Guid="{1F91FAEA-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\elements_handles.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.Handles = !a_oView.Handles; } /*----------------------------------------------------------------------------*/ /* WorksheetToggleGlobalGridDisplay */ /*----------------------------------------------------------------------------*/ macro WorksheetToggleGlobalGridDisplay() [Category="Worksheet Commands", Guid="{1F91FAEB-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\guides_grid.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.Grid = !a_oView.Grid; } /*----------------------------------------------------------------------------*/ /* WorksheetToggleSnapToVertex */ /*----------------------------------------------------------------------------*/ macro WorksheetToggleSnapToVertex() [Category="Worksheet Commands", Guid="{1F91FAEC-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\snap_vertex.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.SnapToPoints = !a_oView.SnapToPoints; } /*----------------------------------------------------------------------------*/ /* WorksheetToggleSnapToEdge */ /*----------------------------------------------------------------------------*/ macro WorksheetToggleSnapToEdge() [Category="Worksheet Commands", Guid="{1F91FAED-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\snap_edge.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.SnapToEdges = !a_oView.SnapToEdges; } /*----------------------------------------------------------------------------*/ /* WorksheetToggleSnapToFace */ /*----------------------------------------------------------------------------*/ macro WorksheetToggleSnapToFace() [Category="Worksheet Commands", Guid="{1F91FAEE-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\snap_faces.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.SnapToFaces = !a_oView.SnapToFaces; } /*----------------------------------------------------------------------------*/ /* WorksheetToggleSnapToGrid */ /*----------------------------------------------------------------------------*/ macro WorksheetToggleSnapToGrid() [Category="Worksheet Commands", Guid="{1F91FAEF-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\snap_grid.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.SnapToGrid = !a_oView.SnapToGrid; } /*----------------------------------------------------------------------------*/ /* WorksheetToggleGlobalWorldOriginDisplay */ /*----------------------------------------------------------------------------*/ macro WorksheetToggleGlobalWorldOriginDisplay() [Category="Worksheet Commands", Guid="{1F91FAF0-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\guidesaxes.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.Axes = !a_oView.Axes; } /*----------------------------------------------------------------------------*/ /* WorksheetToggleGlobalPivotOriginDisplay */ /*----------------------------------------------------------------------------*/ macro WorksheetToggleGlobalPivotOriginDisplay() [Category="Worksheet Commands", Guid="{1F91FAF1-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\guides_pivots.bmp"] { ModelView a_oView = Model.ActiveView; a_oView.LocalAxes = !a_oView.LocalAxes; } /*----------------------------------------------------------------------------*/ /* WorksheetToggleGlobalGuideDisplay */ /*----------------------------------------------------------------------------*/ macro WorksheetToggleGlobalGuideDisplay() [Category="Worksheet Commands", Guid="{1F91FAE2-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\global_guides.bmp"] { // Get the active view. ModelView a_oView = Model.ActiveView; // If any of the guides are off, turn them all on. // Otherwise, turn all the guides off. if ( !a_oView.GlobalEdges || !a_oView.GlobalVertexNormals || !a_oView.GlobalFaceNormals || !a_oView.GlobalVertices || !a_oView.HiddenEdges ) { a_oView.GlobalEdges = 1; a_oView.HiddenEdges = 1; a_oView.GlobalVertexNormals = 1; a_oView.GlobalFaceNormals = 1; a_oView.GlobalVertices = 1; } else { a_oView.GlobalEdges = 0; a_oView.HiddenEdges = 0; a_oView.GlobalVertexNormals = 0; a_oView.GlobalFaceNormals = 0; a_oView.GlobalVertices = 0; } }