private void ImportToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "STEP (*.stp;*.step)|*.stp;*.step|STL (*.stl)|*.stl|IGES (*.igs;*.iges)|*.igs;*.iges|BREP (*.brep)|*.brep|All Files(*.*)|*.*"; if (DialogResult.OK != dlg.ShowDialog()) { return; } TopoShape shape = GlobalInstance.BrepTools.LoadFile(new AnyCAD.Platform.Path(dlg.FileName)); topoShape = shape; #region Render Shape renderView.RenderTimer.Enabled = false; if (shape != null) { renderView.ShowGeometry(shape, shapeId); } renderView.RenderTimer.Enabled = true; renderView.FitAll(); renderView.RequestDraw(EnumRenderHint.RH_LoadScene); #endregion }
private void OnRenderWindow_MouseClick(object sender, MouseEventArgs e) { if (!m_PickPoint) { return; } //PickHelper pickHelper = renderViewDraw.PickShape(e.X, e.Y); //if (pickHelper != null) //{ // // add a ball // Platform.TopoShape shape = GlobalInstance.BrepTools.MakeSphere(pickHelper.GetPointOnShape(), 2); // renderView.ShowGeometry(shape, 100); //} //// Try the grid Vector3 pt = renderViewDraw.HitPointOnGrid(e.X, e.Y); if (pt != null) { if (Vecs.Count() == 0) { Vecs.Add(pt); TopoShape shape = GlobalInstance.BrepTools.MakeSphere(pt, 1); renderViewDraw.ShowGeometry(shape, 100); } else { var c = from m in Vecs where m.Distance(pt) <= 1 select m; if (c.Count() == 0) { var pt0 = Vecs.Last(); Vecs.Add(pt); TopoShape shape = GlobalInstance.BrepTools.MakeSphere(pt, 1); TopoShape edge = GlobalInstance.BrepTools.MakeLine(pt0, pt); EdgeG.Add(edge); renderViewDraw.ShowGeometry(shape, 100); renderViewDraw.ShowGeometry(edge, 100); } else if (Vecs.First().Equals(c.Last())) { TopoShape edge = GlobalInstance.BrepTools.MakeLine(Vecs.Last(), Vecs.First()); EdgeG.Add(edge); renderViewDraw.ShowGeometry(edge, 100); m_PickPoint = !m_PickPoint; } } } }
private void SectionBtn_Click(object sender, EventArgs e) { //SelectedShapeQuery context = new SelectedShapeQuery(); //renderView.QuerySelection(context); //var shape = context.GetGeometry(); TopoShape shapeXZ = new TopoShape(); TopoShape shapeYZ = new TopoShape(); if (topoShape != null) { shapeXZ = Section(topoShape, new Vector3(0, 1, 0)); shapeYZ = Section(topoShape, new Vector3(1, 0, 0)); } #region Render if (topoShape != null) { renderViewXZ.ClearScene(); renderViewXZ.ShowGeometry(shapeXZ, shapeId); renderViewYZ.ClearScene(); renderViewYZ.ShowGeometry(shapeYZ, shapeId); } renderViewXZ.FitAll(); renderViewYZ.FitAll(); renderViewXZ.RequestDraw(EnumRenderHint.RH_LoadScene); renderViewYZ.RequestDraw(EnumRenderHint.RH_LoadScene); #endregion }
private void sphereToolStripMenuItem_Click(object sender, EventArgs e) { TopoShape sphere = renderView.ShapeMaker.MakeSphere(new Vector3(0, 0, 0), 40); renderView.ShowGeometry(sphere, ++shapeId); }