private void MainForm_Load(object sender, EventArgs e) { renderView.ShowWorkingGrid(false); renderView.ExecuteCommand("ShadeWithEdgeMode"); renderView.ShowCoordinateAxis(false); ColorValue clr = new ColorValue(33f / 255f, 40f / 255f, 48f / 255f, 1); renderView.SetBackgroundColor(clr, clr, clr); Renderer renderer = renderView.Renderer; // Customize the Axis ScreenWidget coodinateNode = new ScreenWidget(); AxesWidget axesNode = new AxesWidget(); axesNode.SetArrowText((int)EnumAxesDirection.Axes_Z, ""); coodinateNode.SetNode(axesNode); coodinateNode.SetWidgetPosition(2); renderer.SetCoordinateWidget(coodinateNode); // Set the fixed Top View renderer.SetStandardView(EnumStandardView.SV_Top); renderer.SetViewType(EnumStandardView.SV_Top); this.renderView.RequestDraw(); }
private void ModelView3d_Load(object sender, EventArgs e) { { AxesWidget xwh = new AxesWidget(); xwh.EnableLeftHandCS(); xwh.SetArrowText((int)EnumAxesDirection.Axes_Y, "w"); xwh.SetArrowText((int)EnumAxesDirection.Axes_Z, "h"); xwh.SetArrowText((int)EnumAxesDirection.Axes_X, "x"); ScreenWidget coordWidget = new ScreenWidget(); coordWidget.SetNode(xwh); coordWidget.SetId(axisWidgetId); coordWidget.SetWidgetPosition((int)EnumWidgetPosition.WP_BottomLeft); m_RenderView.Renderer.AddWidgetNode(coordWidget); } { AxesWidget yz = new AxesWidget(); yz.ShowArrow((int)EnumAxesDirection.Axes_X, false); ScreenWidget coordWidget = new ScreenWidget(); coordWidget.SetNode(yz); coordWidget.SetId(axisWidgetId2); coordWidget.SetWidgetPosition((int)EnumWidgetPosition.WP_BottomRight); m_RenderView.Renderer.AddWidgetNode(coordWidget); } m_RenderView.ShowWorkingGrid(false); m_RenderView.ShowCoordinateAxis(false); }
private void customGridToolStripMenuItem_Click(object sender, EventArgs e) { WorkingPlane wp = renderView.Renderer.GetWorkingPlane(); GridNode gridNode = new GridNode(); Vector3 modelSize = renderView.SceneManager.GetBBox().Size(); Vector2 cellSize = gridNode.GetCellSize(); int nCountX = (int)(modelSize.X / cellSize.X + 0.5f) + 1; int nCountY = (int)(modelSize.Y / cellSize.Y + 0.5f) + 1; if (nCountX < 2) nCountX = 2; if (nCountY < 2) nCountY = 2; gridNode.SetCellCount(nCountX, nCountY); LineStyle lineStyle = new LineStyle(); lineStyle.SetColor(new ColorValue(1.0f, 1.0f, 1.0f)); lineStyle.SetPatternStyle((int)EnumLinePattern.LP_DotLine); { //Z LineNode lineNode = new LineNode(); lineNode.Set(new Vector3(0, 0, -1000), new Vector3(0, 0, 1000)); lineNode.SetLineStyle(lineStyle); gridNode.AddNode(lineNode); } { //X LineNode lineNode = new LineNode(); lineNode.Set(new Vector3(-1000, 0, 0), new Vector3(1000, 0, 0)); lineNode.SetLineStyle(lineStyle); gridNode.AddNode(lineNode); } { //Y LineNode lineNode = new LineNode(); lineNode.Set(new Vector3(0, -1000, 0), new Vector3(0, 1000, 0)); lineNode.SetLineStyle(lineStyle); gridNode.AddNode(lineNode); } lineStyle = new LineStyle(); lineStyle.SetColor(new ColorValue(0.9f, 0.9f, 0.9f)); gridNode.SetLineStyle(lineStyle); for (int ii = -1; ii <= nCountX; ++ii) { if (ii == 0) continue; LineNode lineNode = new LineNode(); lineNode.Set(new Vector3(ii * cellSize.X, cellSize.Y, 0), new Vector3(ii * cellSize.X, -nCountY * cellSize.Y, 0)); gridNode.AddNode(lineNode); } for (int ii = -1; ii <= nCountY; ++ii) { if (ii == 0) continue; LineNode lineNode = new LineNode(); lineNode.Set(new Vector3(-cellSize.X, -ii * cellSize.Y, 0), new Vector3(nCountX * cellSize.X, -ii * cellSize.Y, 0)); gridNode.AddNode(lineNode); } gridNode.Update(); wp.SetGridNode(gridNode); { AxesWidget xwh = new AxesWidget(); xwh.EnableLeftHandCS(); xwh.SetArrowText((int)EnumAxesDirection.Axes_Y, "w"); xwh.SetArrowText((int)EnumAxesDirection.Axes_Z, "h"); ScreenWidget coordWidget = new ScreenWidget(); coordWidget.SetNode(xwh); coordWidget.SetWidgetPosition((int)EnumWidgetPosition.WP_BottomLeft); renderView.Renderer.AddWidgetNode(coordWidget); } { AxesWidget yz = new AxesWidget(); yz.ShowArrow((int)EnumAxesDirection.Axes_X, false); ScreenWidget coordWidget = new ScreenWidget(); coordWidget.SetNode(yz); coordWidget.SetWidgetPosition((int)EnumWidgetPosition.WP_BottomRight); renderView.Renderer.AddWidgetNode(coordWidget); } renderView.ShowCoordinateAxis(false); renderView.RequestDraw(); }