Пример #1
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVEnSightOfficeBin(String [] argv)
    {
        //Prefix Content is: ""

        ren1   = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer((vtkRenderer)ren1);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        // read data[]
        //[]
        reader = new vtkGenericEnSightReader();
        // Make sure all algorithms use the composite data pipeline[]
        cdp = new vtkCompositeDataPipeline();
        vtkGenericEnSightReader.SetDefaultExecutivePrototype((vtkExecutive)cdp);
        reader.SetCaseFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/EnSight/office_bin.case");
        reader.Update();
        // to add coverage for vtkOnePieceExtentTranslator[]
        translator = new vtkOnePieceExtentTranslator();
        vtkStreamingDemandDrivenPipeline.SetExtentTranslator(reader.GetOutputInformation(0), (vtkExtentTranslator)translator);
        outline = new vtkStructuredGridOutlineFilter();
        //    outline SetInputConnection [reader GetOutputPort][]
        outline.SetInputData((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
        mapOutline = vtkPolyDataMapper.New();
        mapOutline.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
        outlineActor = new vtkActor();
        outlineActor.SetMapper((vtkMapper)mapOutline);
        outlineActor.GetProperty().SetColor((double)0, (double)0, (double)0);
        // Create source for streamtubes[]
        streamer = new vtkStreamPoints();
        //    streamer SetInputConnection [reader GetOutputPort][]
        streamer.SetInputData((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
        streamer.SetStartPosition((double)0.1, (double)2.1, (double)0.5);
        streamer.SetMaximumPropagationTime((double)500);
        streamer.SetTimeIncrement((double)0.5);
        streamer.SetIntegrationDirectionToForward();
        cone = new vtkConeSource();
        cone.SetResolution((int)8);
        cones = new vtkGlyph3D();
        cones.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
        cones.SetSourceConnection(cone.GetOutputPort());
        cones.SetScaleFactor((double)0.9);
        cones.SetScaleModeToScaleByVector();
        mapCones = vtkPolyDataMapper.New();
        mapCones.SetInputConnection((vtkAlgorithmOutput)cones.GetOutputPort());
        //    eval mapCones SetScalarRange [[reader GetOutput] GetScalarRange][]
        mapCones.SetScalarRange((double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetScalarRange()[0],
                                (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetScalarRange()[1]);
        conesActor = new vtkActor();
        conesActor.SetMapper((vtkMapper)mapCones);
        ren1.AddActor((vtkProp)outlineActor);
        ren1.AddActor((vtkProp)conesActor);
        ren1.SetBackground((double)0.4, (double)0.4, (double)0.5);
        renWin.SetSize((int)300, (int)300);
        iren.Initialize();
        // interact with data[]
        vtkGenericEnSightReader.SetDefaultExecutivePrototype(null);

//deleteAllVTKObjects();
    }
Пример #2
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVEnSightOfficeBin(String [] argv)
    {
        //Prefix Content is: ""

          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren1);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          // read data[]
          //[]
          reader = new vtkGenericEnSightReader();
          // Make sure all algorithms use the composite data pipeline[]
          cdp = new vtkCompositeDataPipeline();
          vtkGenericEnSightReader.SetDefaultExecutivePrototype((vtkExecutive)cdp);
          reader.SetCaseFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/EnSight/office_bin.case");
          reader.Update();
          // to add coverage for vtkOnePieceExtentTranslator[]
          translator = new vtkOnePieceExtentTranslator();
          vtkStreamingDemandDrivenPipeline.SetExtentTranslator(reader.GetOutputInformation(0), (vtkExtentTranslator)translator);
          outline = new vtkStructuredGridOutlineFilter();
          //    outline SetInputConnection [reader GetOutputPort][]
          outline.SetInputData((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
          mapOutline = vtkPolyDataMapper.New();
          mapOutline.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
          outlineActor = new vtkActor();
          outlineActor.SetMapper((vtkMapper)mapOutline);
          outlineActor.GetProperty().SetColor((double)0,(double)0,(double)0);
          // Create source for streamtubes[]
          streamer = new vtkStreamPoints();
          //    streamer SetInputConnection [reader GetOutputPort][]
          streamer.SetInputData((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
          streamer.SetStartPosition((double)0.1,(double)2.1,(double)0.5);
          streamer.SetMaximumPropagationTime((double)500);
          streamer.SetTimeIncrement((double)0.5);
          streamer.SetIntegrationDirectionToForward();
          cone = new vtkConeSource();
          cone.SetResolution((int)8);
          cones = new vtkGlyph3D();
          cones.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
          cones.SetSourceConnection(cone.GetOutputPort());
          cones.SetScaleFactor((double)0.9);
          cones.SetScaleModeToScaleByVector();
          mapCones = vtkPolyDataMapper.New();
          mapCones.SetInputConnection((vtkAlgorithmOutput)cones.GetOutputPort());
          //    eval mapCones SetScalarRange [[reader GetOutput] GetScalarRange][]
          mapCones.SetScalarRange((double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetScalarRange()[0],
          (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetScalarRange()[1]);
          conesActor = new vtkActor();
          conesActor.SetMapper((vtkMapper)mapCones);
          ren1.AddActor((vtkProp)outlineActor);
          ren1.AddActor((vtkProp)conesActor);
          ren1.SetBackground((double)0.4,(double)0.4,(double)0.5);
          renWin.SetSize((int)300,(int)300);
          iren.Initialize();
          // interact with data[]
          vtkGenericEnSightReader.SetDefaultExecutivePrototype(null);

        //deleteAllVTKObjects();
    }
Пример #3
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void Setcdp(vtkCompositeDataPipeline toSet)
 {
     cdp = toSet;
 }
Пример #4
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void Setcdp(vtkCompositeDataPipeline toSet)
 {
     cdp = toSet;
 }
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVEnSightRectGridASCII(String [] argv)
    {
        //Prefix Content is: ""

          VTK_VARY_RADIUS_BY_VECTOR = 2;
          // create pipeline[]
          //[]
          reader = new vtkGenericEnSightReader();
          // Make sure all algorithms use the composite data pipeline[]
          cdp = new vtkCompositeDataPipeline();
          vtkGenericEnSightReader.SetDefaultExecutivePrototype((vtkExecutive)cdp);
          reader.SetCaseFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/EnSight/RectGrid_ascii.case");
          reader.Update();
          toRectilinearGrid = new vtkCastToConcrete();
          //    toRectilinearGrid SetInputConnection [reader GetOutputPort] []
          toRectilinearGrid.SetInput((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
          plane = new vtkRectilinearGridGeometryFilter();
          plane.SetInput((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
          plane.SetExtent((int)0,(int)100,(int)0,(int)100,(int)15,(int)15);
          tri = new vtkTriangleFilter();
          tri.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
          warper = new vtkWarpVector();
          warper.SetInputConnection((vtkAlgorithmOutput)tri.GetOutputPort());
          warper.SetScaleFactor((double)0.05);
          planeMapper = new vtkDataSetMapper();
          planeMapper.SetInputConnection((vtkAlgorithmOutput)warper.GetOutputPort());
          planeMapper.SetScalarRange((double)0.197813,(double)0.710419);
          planeActor = new vtkActor();
          planeActor.SetMapper((vtkMapper)planeMapper);
          cutPlane = new vtkPlane();
          //    eval cutPlane SetOrigin [[reader GetOutput] GetCenter][]
          cutPlane.SetOrigin((double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetCenter()[0], (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetCenter()[1], (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetCenter()[2]);
          cutPlane.SetNormal((double)1,(double)0,(double)0);
          planeCut = new vtkCutter();
          planeCut.SetInput((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
          planeCut.SetCutFunction((vtkImplicitFunction)cutPlane);
          cutMapper = new vtkDataSetMapper();
          cutMapper.SetInputConnection((vtkAlgorithmOutput)planeCut.GetOutputPort());
          cutMapper.SetScalarRange((double)((vtkDataSet)((vtkMultiBlockDataSet)reader.GetOutput()).GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[0], (double)((vtkDataSet)((vtkMultiBlockDataSet)reader.GetOutput()).GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[1]);
          cutActor = new vtkActor();
          cutActor.SetMapper((vtkMapper)cutMapper);
          iso = new vtkContourFilter();
          iso.SetInput((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
          iso.SetValue((int)0,(double)0.7);
          normals = new vtkPolyDataNormals();
          normals.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
          normals.SetFeatureAngle((double)45);
          isoMapper = vtkPolyDataMapper.New();
          isoMapper.SetInputConnection((vtkAlgorithmOutput)normals.GetOutputPort());
          isoMapper.ScalarVisibilityOff();
          isoActor = new vtkActor();
          isoActor.SetMapper((vtkMapper)isoMapper);
          isoActor.GetProperty().SetColor((double) 1.0000, 0.8941, 0.7686 );
          isoActor.GetProperty().SetRepresentationToWireframe();
          streamer = new vtkStreamLine();
          //    streamer SetInputConnection [reader GetOutputPort][]
          streamer.SetInput((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
          streamer.SetStartPosition((double)-1.2,(double)-0.1,(double)1.3);
          streamer.SetMaximumPropagationTime((double)500);
          streamer.SetStepLength((double)0.05);
          streamer.SetIntegrationStepLength((double)0.05);
          streamer.SetIntegrationDirectionToIntegrateBothDirections();
          streamTube = new vtkTubeFilter();
          streamTube.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
          streamTube.SetRadius((double)0.025);
          streamTube.SetNumberOfSides((int)6);
          streamTube.SetVaryRadius((int)VTK_VARY_RADIUS_BY_VECTOR);
          mapStreamTube = vtkPolyDataMapper.New();
          mapStreamTube.SetInputConnection((vtkAlgorithmOutput)streamTube.GetOutputPort());
          mapStreamTube.SetScalarRange((double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[0], (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[1]);
          //       [[[[reader GetOutput] GetPointData] GetScalars] GetRange][]
          streamTubeActor = new vtkActor();
          streamTubeActor.SetMapper((vtkMapper)mapStreamTube);
          streamTubeActor.GetProperty().BackfaceCullingOn();
          outline = new vtkOutlineFilter();
          outline.SetInput((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
          outlineMapper = vtkPolyDataMapper.New();
          outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
          outlineActor = new vtkActor();
          outlineActor.SetMapper((vtkMapper)outlineMapper);
          outlineActor.GetProperty().SetColor((double) 0.0000, 0.0000, 0.0000 );
          // Graphics stuff[]
          // Create the RenderWindow, Renderer and both Actors[]
          //[]
          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren1);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          // Add the actors to the renderer, set the background and size[]
          //[]
          ren1.AddActor((vtkProp)outlineActor);
          ren1.AddActor((vtkProp)planeActor);
          ren1.AddActor((vtkProp)cutActor);
          ren1.AddActor((vtkProp)isoActor);
          ren1.AddActor((vtkProp)streamTubeActor);
          ren1.SetBackground((double)1,(double)1,(double)1);
          renWin.SetSize((int)400,(int)400);
          cam1 = ren1.GetActiveCamera();
          cam1.SetClippingRange((double)3.76213,(double)10.712);
          cam1.SetFocalPoint((double)-0.0842503,(double)-0.136905,(double)0.610234);
          cam1.SetPosition((double)2.53813,(double)2.2678,(double)-5.22172);
          cam1.SetViewUp((double)-0.241047,(double)0.930635,(double)0.275343);
          iren.Initialize();
          // render the image[]
          //[]
          // prevent the tk window from showing up then start the event loop[]
          vtkGenericEnSightReader.SetDefaultExecutivePrototype(null);

        //deleteAllVTKObjects();
    }
 ///<summary> A Set Method for Static Variables </summary>
 public static void Setpip(vtkCompositeDataPipeline toSet)
 {
     pip = toSet;
 }
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestMultiBlockStreamer(String [] argv)
    {
        //Prefix Content is: ""

        // we need to use composite data pipeline with multiblock datasets[]
        alg = new vtkAlgorithm();
        pip = new vtkCompositeDataPipeline();
        vtkAlgorithm.SetDefaultExecutivePrototype((vtkExecutive)pip);
        //skipping Delete pip
        Ren1 = vtkRenderer.New();
        Ren1.SetBackground((double)0.33, (double)0.35, (double)0.43);

        renWin = vtkRenderWindow.New();
        renWin.AddRenderer((vtkRenderer)Ren1);

        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);

        Plot3D0 = new vtkMultiBlockPLOT3DReader();
        Plot3D0.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin");
        Plot3D0.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin");
        Plot3D0.SetBinaryFile((int)1);
        Plot3D0.SetMultiGrid((int)0);
        Plot3D0.SetHasByteCount((int)0);
        Plot3D0.SetIBlanking((int)0);
        Plot3D0.SetTwoDimensionalGeometry((int)0);
        Plot3D0.SetForceRead((int)0);
        Plot3D0.SetByteOrder((int)0);
        Plot3D0.Update();

        Geometry5 = new vtkStructuredGridOutlineFilter();
        Geometry5.SetInputData((vtkDataSet)Plot3D0.GetOutput().GetBlock(0));

        Mapper5 = vtkPolyDataMapper.New();
        Mapper5.SetInputConnection((vtkAlgorithmOutput)Geometry5.GetOutputPort());
        Mapper5.SetImmediateModeRendering((int)1);
        Mapper5.UseLookupTableScalarRangeOn();
        Mapper5.SetScalarVisibility((int)0);
        Mapper5.SetScalarModeToDefault();

        Actor5 = new vtkActor();
        Actor5.SetMapper((vtkMapper)Mapper5);
        Actor5.GetProperty().SetRepresentationToSurface();
        Actor5.GetProperty().SetInterpolationToGouraud();
        Actor5.GetProperty().SetAmbient((double)0.15);
        Actor5.GetProperty().SetDiffuse((double)0.85);
        Actor5.GetProperty().SetSpecular((double)0.1);
        Actor5.GetProperty().SetSpecularPower((double)100);
        Actor5.GetProperty().SetSpecularColor((double)1, (double)1, (double)1);

        Actor5.GetProperty().SetColor((double)1, (double)1, (double)1);
        Ren1.AddActor((vtkProp)Actor5);

        ExtractGrid[0] = new vtkExtractGrid();
        ExtractGrid[0].SetInputData((vtkDataSet)Plot3D0.GetOutput().GetBlock(0));
        ExtractGrid[0].SetVOI((int)0, (int)14, (int)0, (int)32, (int)0, (int)24);
        ExtractGrid[0].SetSampleRate((int)1, (int)1, (int)1);
        ExtractGrid[0].SetIncludeBoundary((int)0);

        ExtractGrid[1] = new vtkExtractGrid();
        ExtractGrid[1].SetInputData((vtkDataSet)Plot3D0.GetOutput().GetBlock(0));
        ExtractGrid[1].SetVOI((int)14, (int)29, (int)0, (int)32, (int)0, (int)24);
        ExtractGrid[1].SetSampleRate((int)1, (int)1, (int)1);
        ExtractGrid[1].SetIncludeBoundary((int)0);

        ExtractGrid[2] = new vtkExtractGrid();
        ExtractGrid[2].SetInputData((vtkDataSet)Plot3D0.GetOutput().GetBlock(0));
        ExtractGrid[2].SetVOI((int)29, (int)56, (int)0, (int)32, (int)0, (int)24);
        ExtractGrid[2].SetSampleRate((int)1, (int)1, (int)1);
        ExtractGrid[2].SetIncludeBoundary((int)0);

        LineSourceWidget0 = new vtkLineSource();
        LineSourceWidget0.SetPoint1((double)3.05638, (double)-3.00497, (double)28.2211);
        LineSourceWidget0.SetPoint2((double)3.05638, (double)3.95916, (double)28.2211);
        LineSourceWidget0.SetResolution((int)20);

        mbds = new vtkMultiBlockDataSet();
        mbds.SetNumberOfBlocks((uint)3);
        i = 0;
        while ((i) < 3)
        {
            ExtractGrid[i].Update();
            sg[i] = vtkStructuredGrid.New();
            sg[i].ShallowCopy(ExtractGrid[i].GetOutput());
            mbds.SetBlock((uint)i, sg[i]);
            //skipping Delete sg[i]
            i = i + 1;
        }

        Stream0 = new vtkStreamTracer();
        Stream0.SetInputData((vtkDataObject)mbds);
        Stream0.SetSourceConnection(LineSourceWidget0.GetOutputPort());
        Stream0.SetIntegrationStepUnit(2);
        Stream0.SetMaximumPropagation((double)20);
        Stream0.SetInitialIntegrationStep((double)0.5);
        Stream0.SetIntegrationDirection((int)0);
        Stream0.SetIntegratorType((int)0);
        Stream0.SetMaximumNumberOfSteps((int)2000);
        Stream0.SetTerminalSpeed((double)1e-12);

        //skipping Delete mbds

        aa = new vtkAssignAttribute();
        aa.SetInputConnection((vtkAlgorithmOutput)Stream0.GetOutputPort());
        aa.Assign((string)"Normals", (string)"NORMALS", (string)"POINT_DATA");

        Ribbon0 = new vtkRibbonFilter();
        Ribbon0.SetInputConnection((vtkAlgorithmOutput)aa.GetOutputPort());
        Ribbon0.SetWidth((double)0.1);
        Ribbon0.SetAngle((double)0);
        Ribbon0.SetDefaultNormal((double)0, (double)0, (double)1);
        Ribbon0.SetVaryWidth((int)0);

        LookupTable1 = new vtkLookupTable();
        LookupTable1.SetNumberOfTableValues((int)256);
        LookupTable1.SetHueRange((double)0, (double)0.66667);
        LookupTable1.SetSaturationRange((double)1, (double)1);
        LookupTable1.SetValueRange((double)1, (double)1);
        LookupTable1.SetTableRange((double)0.197813, (double)0.710419);
        LookupTable1.SetVectorComponent((int)0);
        LookupTable1.Build();

        Mapper10 = vtkPolyDataMapper.New();
        Mapper10.SetInputConnection((vtkAlgorithmOutput)Ribbon0.GetOutputPort());
        Mapper10.SetImmediateModeRendering((int)1);
        Mapper10.UseLookupTableScalarRangeOn();
        Mapper10.SetScalarVisibility((int)1);
        Mapper10.SetScalarModeToUsePointFieldData();
        Mapper10.SelectColorArray((string)"Density");
        Mapper10.SetLookupTable((vtkScalarsToColors)LookupTable1);

        Actor10 = new vtkActor();
        Actor10.SetMapper((vtkMapper)Mapper10);
        Actor10.GetProperty().SetRepresentationToSurface();
        Actor10.GetProperty().SetInterpolationToGouraud();
        Actor10.GetProperty().SetAmbient((double)0.15);
        Actor10.GetProperty().SetDiffuse((double)0.85);
        Actor10.GetProperty().SetSpecular((double)0);
        Actor10.GetProperty().SetSpecularPower((double)1);
        Actor10.GetProperty().SetSpecularColor((double)1, (double)1, (double)1);
        Ren1.AddActor((vtkProp)Actor10);

        // enable user interface interactor[]
        iren.Initialize();
        // prevent the tk window from showing up then start the event loop[]
        vtkAlgorithm.SetDefaultExecutivePrototype(null);
        //skipping Delete alg

//deleteAllVTKObjects();
    }
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestMultiBlockStreamer(String [] argv)
    {
        //Prefix Content is: ""

          // we need to use composite data pipeline with multiblock datasets[]
          alg = new vtkAlgorithm();
          pip = new vtkCompositeDataPipeline();
          vtkAlgorithm.SetDefaultExecutivePrototype((vtkExecutive)pip);
          //skipping Delete pip
          Ren1 = vtkRenderer.New();
          Ren1.SetBackground((double)0.33,(double)0.35,(double)0.43);

          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)Ren1);

          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);

          Plot3D0 = new vtkPLOT3DReader();
          Plot3D0.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin");
          Plot3D0.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin");
          Plot3D0.SetBinaryFile((int)1);
          Plot3D0.SetMultiGrid((int)0);
          Plot3D0.SetHasByteCount((int)0);
          Plot3D0.SetIBlanking((int)0);
          Plot3D0.SetTwoDimensionalGeometry((int)0);
          Plot3D0.SetForceRead((int)0);
          Plot3D0.SetByteOrder((int)0);

          Geometry5 = new vtkStructuredGridOutlineFilter();
          Geometry5.SetInputConnection((vtkAlgorithmOutput)Plot3D0.GetOutputPort());

          Mapper5 = vtkPolyDataMapper.New();
          Mapper5.SetInputConnection((vtkAlgorithmOutput)Geometry5.GetOutputPort());
          Mapper5.SetImmediateModeRendering((int)1);
          Mapper5.UseLookupTableScalarRangeOn();
          Mapper5.SetScalarVisibility((int)0);
          Mapper5.SetScalarModeToDefault();

          Actor5 = new vtkActor();
          Actor5.SetMapper((vtkMapper)Mapper5);
          Actor5.GetProperty().SetRepresentationToSurface();
          Actor5.GetProperty().SetInterpolationToGouraud();
          Actor5.GetProperty().SetAmbient((double)0.15);
          Actor5.GetProperty().SetDiffuse((double)0.85);
          Actor5.GetProperty().SetSpecular((double)0.1);
          Actor5.GetProperty().SetSpecularPower((double)100);
          Actor5.GetProperty().SetSpecularColor((double)1,(double)1,(double)1);

          Actor5.GetProperty().SetColor((double)1,(double)1,(double)1);
          Ren1.AddActor((vtkProp)Actor5);

          ExtractGrid[0] = new vtkExtractGrid();
          ExtractGrid[0].SetInputConnection((vtkAlgorithmOutput)Plot3D0.GetOutputPort());
          ExtractGrid[0].SetVOI((int)0,(int)14,(int)0,(int)32,(int)0,(int)24);
          ExtractGrid[0].SetSampleRate((int)1,(int)1,(int)1);
          ExtractGrid[0].SetIncludeBoundary((int)0);

          ExtractGrid[1] = new vtkExtractGrid();
          ExtractGrid[1].SetInputConnection((vtkAlgorithmOutput)Plot3D0.GetOutputPort());
          ExtractGrid[1].SetVOI((int)14,(int)29,(int)0,(int)32,(int)0,(int)24);
          ExtractGrid[1].SetSampleRate((int)1,(int)1,(int)1);
          ExtractGrid[1].SetIncludeBoundary((int)0);

          ExtractGrid[2] = new vtkExtractGrid();
          ExtractGrid[2].SetInputConnection((vtkAlgorithmOutput)Plot3D0.GetOutputPort());
          ExtractGrid[2].SetVOI((int)29,(int)56,(int)0,(int)32,(int)0,(int)24);
          ExtractGrid[2].SetSampleRate((int)1,(int)1,(int)1);
          ExtractGrid[2].SetIncludeBoundary((int)0);

          LineSourceWidget0 = new vtkLineSource();
          LineSourceWidget0.SetPoint1((double)3.05638,(double)-3.00497,(double)28.2211);
          LineSourceWidget0.SetPoint2((double)3.05638,(double)3.95916,(double)28.2211);
          LineSourceWidget0.SetResolution((int)20);

          mbds = new vtkMultiBlockDataSet();
          mbds.SetNumberOfBlocks((uint)3);
          i = 0;
          while((i) < 3)
        {
          ExtractGrid[i].Update();
          sg[i] = vtkStructuredGrid.New();
          sg[i].ShallowCopy(ExtractGrid[i].GetOutput());
          mbds.SetBlock((uint)i, sg[i]);
          //skipping Delete sg[i]
          i = i + 1;
        }

          Stream0 = new vtkStreamTracer();
          Stream0.SetInput((vtkDataObject)mbds);
          Stream0.SetSource((vtkDataSet)LineSourceWidget0.GetOutput());
          Stream0.SetIntegrationStepUnit(2);
          Stream0.SetMaximumPropagation((double)20);
          Stream0.SetInitialIntegrationStep((double)0.5);
          Stream0.SetIntegrationDirection((int)0);
          Stream0.SetIntegratorType((int)0);
          Stream0.SetMaximumNumberOfSteps((int)2000);
          Stream0.SetTerminalSpeed((double)1e-12);

          //skipping Delete mbds

          aa = new vtkAssignAttribute();
          aa.SetInputConnection((vtkAlgorithmOutput)Stream0.GetOutputPort());
          aa.Assign((string)"Normals",(string)"NORMALS",(string)"POINT_DATA");

          Ribbon0 = new vtkRibbonFilter();
          Ribbon0.SetInputConnection((vtkAlgorithmOutput)aa.GetOutputPort());
          Ribbon0.SetWidth((double)0.1);
          Ribbon0.SetAngle((double)0);
          Ribbon0.SetDefaultNormal((double)0,(double)0,(double)1);
          Ribbon0.SetVaryWidth((int)0);

          LookupTable1 = new vtkLookupTable();
          LookupTable1.SetNumberOfTableValues((int)256);
          LookupTable1.SetHueRange((double)0,(double)0.66667);
          LookupTable1.SetSaturationRange((double)1,(double)1);
          LookupTable1.SetValueRange((double)1,(double)1);
          LookupTable1.SetTableRange((double)0.197813,(double)0.710419);
          LookupTable1.SetVectorComponent((int)0);
          LookupTable1.Build();

          Mapper10 = vtkPolyDataMapper.New();
          Mapper10.SetInputConnection((vtkAlgorithmOutput)Ribbon0.GetOutputPort());
          Mapper10.SetImmediateModeRendering((int)1);
          Mapper10.UseLookupTableScalarRangeOn();
          Mapper10.SetScalarVisibility((int)1);
          Mapper10.SetScalarModeToUsePointFieldData();
          Mapper10.SelectColorArray((string)"Density");
          Mapper10.SetLookupTable((vtkScalarsToColors)LookupTable1);

          Actor10 = new vtkActor();
          Actor10.SetMapper((vtkMapper)Mapper10);
          Actor10.GetProperty().SetRepresentationToSurface();
          Actor10.GetProperty().SetInterpolationToGouraud();
          Actor10.GetProperty().SetAmbient((double)0.15);
          Actor10.GetProperty().SetDiffuse((double)0.85);
          Actor10.GetProperty().SetSpecular((double)0);
          Actor10.GetProperty().SetSpecularPower((double)1);
          Actor10.GetProperty().SetSpecularColor((double)1,(double)1,(double)1);
          Ren1.AddActor((vtkProp)Actor10);

          // enable user interface interactor[]
          iren.Initialize();
          // prevent the tk window from showing up then start the event loop[]
          vtkAlgorithm.SetDefaultExecutivePrototype(null);
          //skipping Delete alg

        //deleteAllVTKObjects();
    }
 ///<summary> A Set Method for Static Variables </summary>
 public static void Setpip(vtkCompositeDataPipeline toSet)
 {
     pip = toSet;
 }
Пример #10
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVEnSightRectGridBin(String [] argv)
    {
        //Prefix Content is: ""

        VTK_VARY_RADIUS_BY_VECTOR = 2;
        // create pipeline[]
        //[]
        reader = new vtkGenericEnSightReader();
        // Make sure all algorithms use the composite data pipeline[]
        cdp = new vtkCompositeDataPipeline();
        vtkGenericEnSightReader.SetDefaultExecutivePrototype((vtkExecutive)cdp);
        reader.SetCaseFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/EnSight/RectGrid_bin.case");
        reader.Update();
        toRectilinearGrid = new vtkCastToConcrete();
        //    toRectilinearGrid SetInputConnection [reader GetOutputPort] []
        toRectilinearGrid.SetInputData((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
        toRectilinearGrid.Update();
        plane = new vtkRectilinearGridGeometryFilter();
        plane.SetInputData((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
        plane.SetExtent((int)0, (int)100, (int)0, (int)100, (int)15, (int)15);
        tri = new vtkTriangleFilter();
        tri.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
        warper = new vtkWarpVector();
        warper.SetInputConnection((vtkAlgorithmOutput)tri.GetOutputPort());
        warper.SetScaleFactor((double)0.05);
        planeMapper = new vtkDataSetMapper();
        planeMapper.SetInputConnection((vtkAlgorithmOutput)warper.GetOutputPort());
        planeMapper.SetScalarRange((double)0.197813, (double)0.710419);
        planeActor = new vtkActor();
        planeActor.SetMapper((vtkMapper)planeMapper);

        cutPlane = new vtkPlane();
        //    eval cutPlane SetOrigin [[reader GetOutput] GetCenter][]
        cutPlane.SetOrigin(
            (double)((vtkDataSet)((vtkMultiBlockDataSet)reader.GetOutput()).GetBlock((uint)0)).GetCenter()[0],
            (double)((vtkDataSet)((vtkMultiBlockDataSet)reader.GetOutput()).GetBlock((uint)0)).GetCenter()[1],
            (double)((vtkDataSet)((vtkMultiBlockDataSet)reader.GetOutput()).GetBlock((uint)0)).GetCenter()[2]);
        cutPlane.SetNormal((double)1, (double)0, (double)0);
        planeCut = new vtkCutter();
        planeCut.SetInputData((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
        planeCut.SetCutFunction((vtkImplicitFunction)cutPlane);
        cutMapper = new vtkDataSetMapper();
        cutMapper.SetInputConnection((vtkAlgorithmOutput)planeCut.GetOutputPort());
        cutMapper.SetScalarRange(
            (double)((vtkDataSet)((vtkMultiBlockDataSet)reader.GetOutput()).GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[0],
            (double)((vtkDataSet)((vtkMultiBlockDataSet)reader.GetOutput()).GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[1]);
        cutActor = new vtkActor();
        cutActor.SetMapper((vtkMapper)cutMapper);

        iso = new vtkContourFilter();
        iso.SetInputData((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
        iso.SetValue((int)0, (double)0.7);
        normals = new vtkPolyDataNormals();
        normals.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
        normals.SetFeatureAngle((double)45);
        isoMapper = vtkPolyDataMapper.New();
        isoMapper.SetInputConnection((vtkAlgorithmOutput)normals.GetOutputPort());
        isoMapper.ScalarVisibilityOff();
        isoActor = new vtkActor();
        isoActor.SetMapper((vtkMapper)isoMapper);
        isoActor.GetProperty().SetColor((double)1.0000, 0.8941, 0.7686);
        isoActor.GetProperty().SetRepresentationToWireframe();

        streamer = new vtkStreamLine();
        //    streamer SetInputConnection [reader GetOutputPort][]
        streamer.SetInputData((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
        streamer.SetStartPosition((double)-1.2, (double)-0.1, (double)1.3);
        streamer.SetMaximumPropagationTime((double)500);
        streamer.SetStepLength((double)0.05);
        streamer.SetIntegrationStepLength((double)0.05);
        streamer.SetIntegrationDirectionToIntegrateBothDirections();

        streamTube = new vtkTubeFilter();
        streamTube.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
        streamTube.SetRadius((double)0.025);
        streamTube.SetNumberOfSides((int)6);
        streamTube.SetVaryRadius((int)VTK_VARY_RADIUS_BY_VECTOR);
        mapStreamTube = vtkPolyDataMapper.New();
        mapStreamTube.SetInputConnection((vtkAlgorithmOutput)streamTube.GetOutputPort());
        mapStreamTube.SetScalarRange(
            (double)((vtkDataSet)((vtkMultiBlockDataSet)reader.GetOutput()).GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[0],
            (double)((vtkDataSet)((vtkMultiBlockDataSet)reader.GetOutput()).GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[1]);
        //       [[[[reader GetOutput] GetPointData] GetScalars] GetRange][]
        streamTubeActor = new vtkActor();
        streamTubeActor.SetMapper((vtkMapper)mapStreamTube);
        streamTubeActor.GetProperty().BackfaceCullingOn();

        outline = new vtkOutlineFilter();
        outline.SetInputData((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
        outlineMapper = vtkPolyDataMapper.New();
        outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
        outlineActor = new vtkActor();
        outlineActor.SetMapper((vtkMapper)outlineMapper);
        outlineActor.GetProperty().SetColor((double)0.0000, 0.0000, 0.0000);

        // Graphics stuff[]
        // Create the RenderWindow, Renderer and both Actors[]
        //[]
        ren1   = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.SetMultiSamples(0);
        renWin.AddRenderer((vtkRenderer)ren1);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);

        // Add the actors to the renderer, set the background and size[]
        //[]
        ren1.AddActor((vtkProp)outlineActor);
        ren1.AddActor((vtkProp)planeActor);
        ren1.AddActor((vtkProp)cutActor);
        ren1.AddActor((vtkProp)isoActor);
        ren1.AddActor((vtkProp)streamTubeActor);

        ren1.SetBackground((double)1, (double)1, (double)1);
        renWin.SetSize((int)400, (int)400);

        cam1 = ren1.GetActiveCamera();
        cam1.SetClippingRange((double)3.76213, (double)10.712);
        cam1.SetFocalPoint((double)-0.0842503, (double)-0.136905, (double)0.610234);
        cam1.SetPosition((double)2.53813, (double)2.2678, (double)-5.22172);
        cam1.SetViewUp((double)-0.241047, (double)0.930635, (double)0.275343);

        iren.Initialize();
        // render the image[]
        //[]
        // prevent the tk window from showing up then start the event loop[]
        vtkGenericEnSightReader.SetDefaultExecutivePrototype(null);
//deleteAllVTKObjects();
    }
Пример #11
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestExtractCTHPart(String [] argv)
    {
        //Prefix Content is: ""

          // we need to use composite data pipeline with multiblock datasets[]
          alg = new vtkAlgorithm();
          pip = new vtkCompositeDataPipeline();
          vtkAlgorithm.SetDefaultExecutivePrototype((vtkExecutive)pip);
          //skipping Delete pip
          // Create the RenderWindow, Renderer and both Actors[]
          //[]
          Ren1 = vtkRenderer.New();
          Ren1.SetBackground((double)0.33,(double)0.35,(double)0.43);
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)Ren1);
          renWin.SetSize((int)300,(int)300);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          pvTemp59 = new vtkXMLRectilinearGridReader();
          pvTemp59.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/cth.vtr");
          pvTemp59.UpdateInformation();
          pvTemp59.SetCellArrayStatus((string)"X Velocity",(int)0);
          pvTemp59.SetCellArrayStatus((string)"Y Velocity",(int)0);
          pvTemp59.SetCellArrayStatus((string)"Z Velocity",(int)0);
          pvTemp59.SetCellArrayStatus((string)"Mass for Armor Plate",(int)0);
          pvTemp59.SetCellArrayStatus((string)"Mass for Body, Nose",(int)0);
          pvTemp79 = new vtkExtractCTHPart();
          pvTemp79.SetInputConnection((vtkAlgorithmOutput)pvTemp59.GetOutputPort());
          pvTemp79.AddVolumeArrayName((string)"Volume Fraction for Armor Plate");
          pvTemp79.AddVolumeArrayName((string)"Volume Fraction for Body, Nose");
          pvTemp79.SetClipPlane(null);
          pvTemp104 = new vtkLookupTable();
          pvTemp104.SetNumberOfTableValues((int)256);
          pvTemp104.SetHueRange((double)0.6667,(double)0);
          pvTemp104.SetSaturationRange((double)1,(double)1);
          pvTemp104.SetValueRange((double)1,(double)1);
          pvTemp104.SetTableRange((double)0,(double)1);
          pvTemp104.SetVectorComponent((int)0);
          pvTemp104.Build();
          pvTemp87 = new vtkCompositePolyDataMapper();
          pvTemp87.SetInputConnection((vtkAlgorithmOutput)pvTemp79.GetOutputPort());
          pvTemp87.SetImmediateModeRendering((int)1);
          pvTemp87.SetScalarRange((double)0,(double)1);
          pvTemp87.UseLookupTableScalarRangeOn();
          pvTemp87.SetScalarVisibility((int)1);
          pvTemp87.SetScalarModeToUsePointFieldData();
          pvTemp87.SelectColorArray((string)"Part Index");
          pvTemp87.SetLookupTable((vtkScalarsToColors)pvTemp104);
          pvTemp88 = new vtkActor();
          pvTemp88.SetMapper((vtkMapper)pvTemp87);
          pvTemp88.GetProperty().SetRepresentationToSurface();
          pvTemp88.GetProperty().SetInterpolationToGouraud();
          pvTemp88.GetProperty().SetAmbient((double)0);
          pvTemp88.GetProperty().SetDiffuse((double)1);
          pvTemp88.GetProperty().SetSpecular((double)0);
          pvTemp88.GetProperty().SetSpecularPower((double)1);
          pvTemp88.GetProperty().SetSpecularColor((double)1,(double)1,(double)1);
          Ren1.AddActor((vtkProp)pvTemp88);
          renWin.Render();
          vtkAlgorithm.SetDefaultExecutivePrototype(null);

        //deleteAllVTKObjects();
    }
Пример #12
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestExtractCTHPart(String [] argv)
    {
        //Prefix Content is: ""

        // we need to use composite data pipeline with multiblock datasets[]
        alg = new vtkAlgorithm();
        pip = new vtkCompositeDataPipeline();
        vtkAlgorithm.SetDefaultExecutivePrototype((vtkExecutive)pip);
        //skipping Delete pip
        // Create the RenderWindow, Renderer and both Actors[]
        //[]
        Ren1 = vtkRenderer.New();
        Ren1.SetBackground((double)0.33, (double)0.35, (double)0.43);
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer((vtkRenderer)Ren1);
        renWin.SetSize((int)300, (int)300);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        pvTemp59 = new vtkXMLRectilinearGridReader();
        pvTemp59.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/cth.vtr");
        pvTemp59.UpdateInformation();
        pvTemp59.SetCellArrayStatus((string)"X Velocity", (int)0);
        pvTemp59.SetCellArrayStatus((string)"Y Velocity", (int)0);
        pvTemp59.SetCellArrayStatus((string)"Z Velocity", (int)0);
        pvTemp59.SetCellArrayStatus((string)"Mass for Armor Plate", (int)0);
        pvTemp59.SetCellArrayStatus((string)"Mass for Body, Nose", (int)0);
        pvTemp79 = new vtkExtractCTHPart();
        pvTemp79.SetInputConnection((vtkAlgorithmOutput)pvTemp59.GetOutputPort());
        pvTemp79.AddVolumeArrayName((string)"Volume Fraction for Armor Plate");
        pvTemp79.AddVolumeArrayName((string)"Volume Fraction for Body, Nose");
        pvTemp79.SetClipPlane(null);
        pvTemp104 = new vtkLookupTable();
        pvTemp104.SetNumberOfTableValues((int)256);
        pvTemp104.SetHueRange((double)0.6667, (double)0);
        pvTemp104.SetSaturationRange((double)1, (double)1);
        pvTemp104.SetValueRange((double)1, (double)1);
        pvTemp104.SetTableRange((double)0, (double)1);
        pvTemp104.SetVectorComponent((int)0);
        pvTemp104.Build();
        pvTemp87 = new vtkCompositePolyDataMapper();
        pvTemp87.SetInputConnection((vtkAlgorithmOutput)pvTemp79.GetOutputPort());
        pvTemp87.SetImmediateModeRendering((int)1);
        pvTemp87.SetScalarRange((double)0, (double)1);
        pvTemp87.UseLookupTableScalarRangeOn();
        pvTemp87.SetScalarVisibility((int)1);
        pvTemp87.SetScalarModeToUsePointFieldData();
        pvTemp87.SelectColorArray((string)"Part Index");
        pvTemp87.SetLookupTable((vtkScalarsToColors)pvTemp104);
        pvTemp88 = new vtkActor();
        pvTemp88.SetMapper((vtkMapper)pvTemp87);
        pvTemp88.GetProperty().SetRepresentationToSurface();
        pvTemp88.GetProperty().SetInterpolationToGouraud();
        pvTemp88.GetProperty().SetAmbient((double)0);
        pvTemp88.GetProperty().SetDiffuse((double)1);
        pvTemp88.GetProperty().SetSpecular((double)0);
        pvTemp88.GetProperty().SetSpecularPower((double)1);
        pvTemp88.GetProperty().SetSpecularColor((double)1, (double)1, (double)1);
        Ren1.AddActor((vtkProp)pvTemp88);
        renWin.Render();
        vtkAlgorithm.SetDefaultExecutivePrototype(null);

//deleteAllVTKObjects();
    }