Ejemplo n.º 1
0
Archivo: Part.cs Proyecto: ovevans/STAN
        /// <summary>
        /// Clip this part - Set Mapper input to Clipper
        /// </summary>
        public void ClipPart(vtkPlane ClipPlane, bool clip)
        {
            if (clip == true)
            {
                Clipper = vtkTableBasedClipDataSet.New();
                Clipper.SetClipFunction(ClipPlane);
                Clipper.SetInputConnection(Grid.GetProducerPort());
                Clipper.Update();
                Mapper.SetInputConnection(Clipper.GetOutputPort());
                Mapper.Update();

                // Update Feature Filter -> will update Edges and Faces
                Filter.SetInput(Clipper.GetOutput());
                Filter.Update();



                // ------- Alternative without Clip Surface Extraction --------------

                //vtkPlaneCollection planes = vtkPlaneCollection.New();
                //planes.AddItem(ClipPlane);
                //Edges.GetMapper().SetClippingPlanes(planes);
                //Edges.GetMapper().Update();

                //vtkPlaneCollection Planes = vtkPlaneCollection.New();
                //Planes.AddItem(ClipPlane);
                //Mapper.SetClippingPlanes(Planes);
                //Mapper.Update();
            }
            else
            {
                Mapper.SetInput(Grid);
                Mapper.Update();

                // Update Feature Filter -> will update Edges and Faces
                Filter.SetInput(Grid);
                Filter.Update();


                // ------- Alternative without Clip Surface Extraction --------------
                // Edges
                //vtkPlaneCollection planes = vtkPlaneCollection.New();
                //Edges.GetMapper().SetClippingPlanes(planes);
                //Edges.GetMapper().Update();

                //vtkPlaneCollection Planes = vtkPlaneCollection.New();
                //Mapper.SetClippingPlanes(Planes);
                //Mapper.Update();
            }
        }
Ejemplo n.º 2
0
Archivo: Part.cs Proyecto: ovevans/STAN
        public void ExtractFeatures()
        {
            Filter = vtkDataSetSurfaceFilter.New();
            Filter.SetInput(Grid);
            Filter.Update();
            Faces = Filter.GetOutput();

            vtkFeatureEdges FeatureEdges = vtkFeatureEdges.New();

            FeatureEdges.SetInput(Filter.GetOutput());
            FeatureEdges.Update();

            FeatureEdges.BoundaryEdgesOn();
            FeatureEdges.FeatureEdgesOn();
            FeatureEdges.ManifoldEdgesOn();
            FeatureEdges.NonManifoldEdgesOn();

            // Change Edge color
            FeatureEdges.SetColoring(0);

            // Update
            FeatureEdges.Update();

            vtkPolyDataMapper EdgeMapper = vtkPolyDataMapper.New();

            EdgeMapper.SetInput(FeatureEdges.GetOutput());
            EdgeMapper.ScalarVisibilityOff();

            Edges.SetMapper(EdgeMapper);
            Edges.GetProperty().SetEdgeColor(0, 0, 0);
            Edges.GetProperty().SetColor(0.0, 0.0, 0.0);
            Edges.GetProperty().SetLineWidth((float)1.0);   // Set default edge thickness
            Edges.SetVisibility(0);
        }