protected override void OnContentRendered(EventArgs e) { ////// // adds a custom mesh to the CoordinateSystemIcon ////// model1.GetCoordinateSystemIcon().Entities.Clear(); // reads the mesh obj (eyeshot file) from the Assets directory devDept.Eyeshot.Translators.ReadFile rf = new devDept.Eyeshot.Translators.ReadFile("../../../../../../dataset/Assets/figure_Object011.eye"); rf.DoWork(); Mesh torso = (Mesh)rf.Entities[0]; torso.Scale(0.5, 0.5, 0.5); torso.NormalAveragingMode = Mesh.normalAveragingType.Averaged; torso.Regen(0.1); // orients the mesh Point3D midPoint = (torso.BoxMin + torso.BoxMax) / 2; torso.Translate(-midPoint.X, -midPoint.Y, -midPoint.Z); torso.Rotate(Math.PI / 2, Vector3D.AxisX); // sets the color torso.Color = System.Drawing.Color.Pink; // sets the model on the CoordinateSystemIcon entities and remove the labels CoordinateSystemIcon csi = model1.GetCoordinateSystemIcon(); csi.Entities.Add(torso); csi.LabelAxisX = ""; csi.LabelAxisY = ""; csi.LabelAxisZ = ""; csi.Lighting = true; model1.CompileUserInterfaceElements(); // sets my event handler to the ToolBarButton.Click event // Previous view model1.GetToolBar().Buttons[0].Click += PreviousViewClickEventHandler; // Next view model1.GetToolBar().Buttons[1].Click += NextViewClickEventHandler; // MyPushButton model1.GetToolBar().Buttons[6].Click += MyPushButtonClickEventHandler; // MyToggleButton model1.GetToolBar().Buttons[7].Click += MyToggleButtonClickEventHandler; // sets trimetric view model1.SetView(viewType.Trimetric); // fits the model in the viewport model1.ZoomFit(); //refresh the viewport model1.Invalidate(); base.OnContentRendered(e); }
public MyViewModel() { // Initializes the Coordinate System Icon for the data binding. MyCoordinateSystemIcon = new CoordinateSystemIcon(); // Initializes the Origin Symbol for the data binding. MyOriginSymbol = OriginSymbol.GetDefaultOriginSymbol(); OsStyleType = originSymbolStyleType.Ball; // Initializes the Grids collection for the data binding. Grid grid = new Grid() { Step = 10, MajorLinesEvery = 4 }; MyGrids = new ObservableCollection <Grid> { grid }; // Initializes the ToolBar for the data binding. MyToolBars = new ObservableCollection <ToolBar>(new List <ToolBar>() { ToolBar.GetDefaultToolBar() }); MyToolBar.Position = ToolBar.positionType.HorizontalTopCenter; // Uses toolbar buttons count info to enable/disable the Add/Remove buttons _buttonsCount = MyToolBar.Buttons.Count; // Creates the command for the the Add/Remove buttons CreateAddToolbarButtonCommand(); CreateRemoveToolbarButtonCommand(); // Initializes the BackgroundSettings for the the data binding. MyBackgroundSettings = new BackgroundSettings(backgroundStyleType.Solid, Helper.ConvertColor("#FF434752"), System.Drawing.Color.White, Helper.ConvertColor("#FFEDEDED"), .75, null); // Sets the ViewModel's BackgroundStyle: in this way the "Background" comboboxes will be updated too. BackgroundStyle = MyBackgroundSettings.StyleMode; // Initializes the Background images. MyBackgroundSettings.Image = Image1 = RenderContextUtility.ConvertImage(new Bitmap(Pictures + "background1.jpg")); Image2 = RenderContextUtility.ConvertImage(new Bitmap(Pictures + "background2.jpg")); Image3 = RenderContextUtility.ConvertImage(new Bitmap(Pictures + "background3.jpg")); // Initializes the Images for the ViewCube buttons. VcResetImages = ViewCubeIcon.GetDefaultViewCubeIcon().FrontImage; VcImage1 = RenderContextUtility.ConvertImage(new Bitmap(Pictures + "Spongebob_Front.jpg")); VcImage2 = RenderContextUtility.ConvertImage(new Bitmap(Pictures + "Noel_Front.jpg")); // Initializes the EntitiList collection for the the data binding. _entityList = new MyEntityList(); }