示例#1
0
        public void Initialize()
        {
            // Initialize Actors
            GlyphX  = vtkGlyph3D.New();
            MapperX = vtkDataSetMapper.New();
            MapperX.SetInputConnection(GlyphX.GetOutputPort());
            ActorX = vtkActor.New();
            ActorX.SetMapper(MapperX);
            ClipperX = vtkTableBasedClipDataSet.New();

            GlyphY  = vtkGlyph3D.New();
            MapperY = vtkDataSetMapper.New();
            MapperY.SetInputConnection(GlyphY.GetOutputPort());
            ActorY = vtkActor.New();
            ActorY.SetMapper(MapperY);
            ClipperY = vtkTableBasedClipDataSet.New();

            GlyphZ  = vtkGlyph3D.New();
            MapperZ = vtkDataSetMapper.New();
            MapperZ.SetInputConnection(GlyphZ.GetOutputPort());
            ActorZ = vtkActor.New();
            ActorZ.SetMapper(MapperZ);
            ClipperZ = vtkTableBasedClipDataSet.New();

            // Enable wireframe display mode
            ActorX.GetProperty().EdgeVisibilityOn();
            ActorY.GetProperty().EdgeVisibilityOn();
            ActorZ.GetProperty().EdgeVisibilityOn();

            // Hide Actors
            ActorX.VisibilityOff();
            ActorY.VisibilityOff();
            ActorZ.VisibilityOff();
        }
示例#2
0
文件: Part.cs 项目: 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();
            }
        }
示例#3
0
        public void ClipBC(vtkPlane ClipPlane, bool clip)
        {
            if (clip == true)
            {
                ClipperX = vtkTableBasedClipDataSet.New();
                ClipperX.SetClipFunction(ClipPlane);
                ClipperX.SetInputConnection(GlyphX.GetOutputPort());
                ClipperX.Update();
                MapperX.SetInputConnection(ClipperX.GetOutputPort());
                MapperX.Update();

                ClipperY = vtkTableBasedClipDataSet.New();
                ClipperY.SetClipFunction(ClipPlane);
                ClipperY.SetInputConnection(GlyphY.GetOutputPort());
                ClipperY.Update();
                MapperY.SetInputConnection(ClipperY.GetOutputPort());
                MapperY.Update();

                ClipperZ = vtkTableBasedClipDataSet.New();
                ClipperZ.SetClipFunction(ClipPlane);
                ClipperZ.SetInputConnection(GlyphZ.GetOutputPort());
                ClipperZ.Update();
                MapperZ.SetInputConnection(ClipperZ.GetOutputPort());
                MapperZ.Update();
            }
            else
            {
                // Add Glyphs to Mapper
                MapperX.SetInputConnection(GlyphX.GetOutputPort());
                MapperY.SetInputConnection(GlyphY.GetOutputPort());
                MapperZ.SetInputConnection(GlyphZ.GetOutputPort());
                MapperX.Update();
                MapperY.Update();
                MapperZ.Update();
            }
        }