public void UpdateControl(SceneViewSelectedRotationAxisType selectedRotationAxis) { this.SelectedObject = (STLModel3D)ObjectView.SelectedModel; if (SelectedObject != null) { if (this.SelectedObject.LinkedClones.Count > 1 && SceneView.CurrentViewMode == SceneView.ViewMode.ModelRotation) { this.Hidden = true; SceneControlToolbarManager.ShowRotationSelectedModelContainsLinkedClonesToolTip(); } else { this.Hidden = false; if (selectedRotationAxis != SceneViewSelectedRotationAxisType.Hidden) { this.SelectedRotationAxis = selectedRotationAxis; if (this.SelectedObject != null && !(this.SelectedObject is SupportCone)) { //diameter equals front bottom --> back top distance _modelDiameter = (new Vector3(this.SelectedObject.LeftPoint, this.SelectedObject.FrontPoint, 0) - (new Vector3(this.RightPoint, this.BackPoint, this.TopPoint))).Length; _selectedModelIndex = this.SelectedObject.Index; //initialize triangle array this.Triangles = new TriangleInfoList(); //create axis X var rotationAxisXColor = new Byte4Class(240, 255, 0, 0); if (this.SelectedRotationAxis == SceneViewSelectedRotationAxisType.X) { rotationAxisXColor = new Byte4Class(240, 255, 255, 255); } var rotationAxisX = new Torus(_modelDiameter, TORUSOUTSIDERINGDIAMETER, TORUSSEGMENTCOUNT, TORUSSEGMENTBANDCOUNT); foreach (var triangle in rotationAxisX.Triangles[0]) { triangle.Vectors[0].Color = triangle.Vectors[1].Color = triangle.Vectors[2].Color = rotationAxisXColor; } //add triangle to stl model rotationAxisX.Rotate(0, 45, 0, Events.RotationEventArgs.TypeAxis.Y, true, false); this.Triangles[0].AddRange(rotationAxisX.Triangles[0]); //create axis Y var rotationAxisY = new Torus(_modelDiameter, TORUSOUTSIDERINGDIAMETER, TORUSSEGMENTCOUNT, TORUSSEGMENTBANDCOUNT); var rotationAxisYColor = new Byte4Class(241, 0, 255, 0); if (this.SelectedRotationAxis == SceneViewSelectedRotationAxisType.Y) { rotationAxisYColor = new Byte4Class(241, 255, 255, 255); } foreach (var triangle in rotationAxisY.Triangles[0]) { triangle.Vectors[0].Color = triangle.Vectors[1].Color = triangle.Vectors[2].Color = rotationAxisYColor; } //add triangle to stl model rotationAxisY.Rotate(45, 0, 0, Events.RotationEventArgs.TypeAxis.X, true, false); this.Triangles[0].AddRange(rotationAxisY.Triangles[0]); //create z rotation axis var rotationAxisZ = new Torus(_modelDiameter, TORUSOUTSIDERINGDIAMETER, TORUSSEGMENTCOUNT, TORUSSEGMENTBANDCOUNT); var rotationAxisZColor = new Byte4Class(242, 0, 0, 255); if (this.SelectedRotationAxis == SceneViewSelectedRotationAxisType.Z) { rotationAxisZColor = new Byte4Class(242, 255, 255, 255); } foreach (var triangle in rotationAxisZ.Triangles[0]) { triangle.Vectors[0].Color = triangle.Vectors[1].Color = triangle.Vectors[2].Color = rotationAxisZColor; } this.Triangles[0].AddRange(rotationAxisZ.Triangles[0]); foreach (var triangle in this.Triangles[0]) { triangle.CalcNormal(); } //change all triangles center to center of model this.MoveTranslation = this.SelectedObject.MoveTranslation; this.MoveTranslation += new Vector3Class(0, 0, (this.SelectedObject.TopPoint - this.SelectedObject.BottomPoint) / 2); } } else { //reset bindings this.Triangles = new TriangleInfoList(); } if (this.SelectedRotationAxis == SceneViewSelectedRotationAxisType.None) { UpdateSelectedAngleOverlay(this.SelectedObject, RotationEventArgs.TypeAxis.None); } if (this.VBOIndexes == null) { this.BindModel(); } else { this.UpdateBinding(); } } this.PreviousSelectedObject = this.SelectedObject; } }