/// <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(); }
/// <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(); }
static void Main(string[] args) { // create a sphere source, mapper, and actor vtkSphereSource sphere = new vtkSphereSource(); vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper(); sphereMapper.SetInputConnection(sphere.GetOutputPort()); vtkPolyDataMapper.GlobalImmediateModeRenderingOn(); vtkLODActor sphereActor = new vtkLODActor(); sphereActor.SetMapper(sphereMapper); // create the spikes by glyphing the sphere with a cone. Create the // mapper and actor for the glyphs. vtkConeSource cone = new vtkConeSource(); vtkGlyph3D glyph = new vtkGlyph3D(); glyph.SetInputConnection(sphere.GetOutputPort()); glyph.SetSource(cone.GetOutput()); glyph.SetVectorModeToUseNormal(); glyph.SetScaleModeToScaleByVector(); glyph.SetScaleFactor(0.25); vtkPolyDataMapper spikeMapper = new vtkPolyDataMapper(); spikeMapper.SetInputConnection(glyph.GetOutputPort()); vtkLODActor spikeActor = new vtkLODActor(); spikeActor.SetMapper(spikeMapper); // Create a text mapper and actor to display the results of picking. vtkTextMapper textMapper = new vtkTextMapper(); vtkTextProperty tprop = textMapper.GetTextProperty(); tprop.SetFontFamilyToArial(); tprop.SetFontSize(10); tprop.BoldOn(); tprop.ShadowOn(); tprop.SetColor(1, 0, 0); vtkActor2D textActor = new vtkActor2D(); textActor.VisibilityOff(); textActor.SetMapper(textMapper); // Create a cell picker. vtkCellPicker picker = new vtkCellPicker(); PickData pd = new PickData(); pd.textActor = textActor; pd.textMapper = textMapper; vtkDotNetCallback cb = new vtkDotNetCallback(pd.annotatePickCallback); // Now at the end of the pick event call the above function. picker.AddObserver((uint) EventIds.EndPickEvent, cb); // Create the Renderer, RenderWindow, etc. and set the Picker. vtkRenderer ren = new vtkRenderer(); vtkRenderWindow renWin = new vtkRenderWindow(); renWin.AddRenderer(ren); vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow(renWin); iren.SetPicker(picker); // Add the actors to the renderer, set the background and size ren.AddActor2D(textActor); ren.AddActor(sphereActor); ren.AddActor(spikeActor); ren.SetBackground(1, 1, 1); renWin.SetSize(300, 300); // Get the camera and zoom in closer to the image. ren.ResetCamera(); vtkCamera cam1 = ren.GetActiveCamera(); cam1.Zoom(1.4); iren.Initialize(); // Initially pick the cell at this location. picker.Pick(85, 126, 0, ren); renWin.Render(); iren.Start(); vtkWin32OpenGLRenderWindow win32win = vtkWin32OpenGLRenderWindow.SafeDownCast(renWin); if (null != win32win) win32win.Clean(); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVofficeStreamPoints(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 vtkStructuredGridReader(); reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/office.binary.vtk"); reader.Update(); //force a read to occur[] // to add coverage for vtkOnePieceExtentTranslator[] translator = new vtkOnePieceExtentTranslator(); vtkStreamingDemandDrivenPipeline.SetExtentTranslator(reader.GetOutputInformation(0), (vtkExtentTranslator)translator); length = reader.GetOutput().GetLength(); maxVelocity = reader.GetOutput().GetPointData().GetVectors().GetMaxNorm(); maxTime = 35.0*length/maxVelocity; table1 = new vtkStructuredGridGeometryFilter(); table1.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); table1.SetExtent((int)11,(int)15,(int)7,(int)9,(int)8,(int)8); mapTable1 = vtkPolyDataMapper.New(); mapTable1.SetInputConnection((vtkAlgorithmOutput)table1.GetOutputPort()); mapTable1.ScalarVisibilityOff(); table1Actor = new vtkActor(); table1Actor.SetMapper((vtkMapper)mapTable1); table1Actor.GetProperty().SetColor((double).59,(double).427,(double).392); table2 = new vtkStructuredGridGeometryFilter(); table2.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); table2.SetExtent((int)11,(int)15,(int)10,(int)12,(int)8,(int)8); mapTable2 = vtkPolyDataMapper.New(); mapTable2.SetInputConnection((vtkAlgorithmOutput)table2.GetOutputPort()); mapTable2.ScalarVisibilityOff(); table2Actor = new vtkActor(); table2Actor.SetMapper((vtkMapper)mapTable2); table2Actor.GetProperty().SetColor((double).59,(double).427,(double).392); FilingCabinet1 = new vtkStructuredGridGeometryFilter(); FilingCabinet1.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); FilingCabinet1.SetExtent((int)15,(int)15,(int)7,(int)9,(int)0,(int)8); mapFilingCabinet1 = vtkPolyDataMapper.New(); mapFilingCabinet1.SetInputConnection((vtkAlgorithmOutput)FilingCabinet1.GetOutputPort()); mapFilingCabinet1.ScalarVisibilityOff(); FilingCabinet1Actor = new vtkActor(); FilingCabinet1Actor.SetMapper((vtkMapper)mapFilingCabinet1); FilingCabinet1Actor.GetProperty().SetColor((double).8,(double).8,(double).6); FilingCabinet2 = new vtkStructuredGridGeometryFilter(); FilingCabinet2.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); FilingCabinet2.SetExtent((int)15,(int)15,(int)10,(int)12,(int)0,(int)8); mapFilingCabinet2 = vtkPolyDataMapper.New(); mapFilingCabinet2.SetInputConnection((vtkAlgorithmOutput)FilingCabinet2.GetOutputPort()); mapFilingCabinet2.ScalarVisibilityOff(); FilingCabinet2Actor = new vtkActor(); FilingCabinet2Actor.SetMapper((vtkMapper)mapFilingCabinet2); FilingCabinet2Actor.GetProperty().SetColor((double).8,(double).8,(double).6); bookshelf1Top = new vtkStructuredGridGeometryFilter(); bookshelf1Top.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); bookshelf1Top.SetExtent((int)13,(int)13,(int)0,(int)4,(int)0,(int)11); mapBookshelf1Top = vtkPolyDataMapper.New(); mapBookshelf1Top.SetInputConnection((vtkAlgorithmOutput)bookshelf1Top.GetOutputPort()); mapBookshelf1Top.ScalarVisibilityOff(); bookshelf1TopActor = new vtkActor(); bookshelf1TopActor.SetMapper((vtkMapper)mapBookshelf1Top); bookshelf1TopActor.GetProperty().SetColor((double).8,(double).8,(double).6); bookshelf1Bottom = new vtkStructuredGridGeometryFilter(); bookshelf1Bottom.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); bookshelf1Bottom.SetExtent((int)20,(int)20,(int)0,(int)4,(int)0,(int)11); mapBookshelf1Bottom = vtkPolyDataMapper.New(); mapBookshelf1Bottom.SetInputConnection((vtkAlgorithmOutput)bookshelf1Bottom.GetOutputPort()); mapBookshelf1Bottom.ScalarVisibilityOff(); bookshelf1BottomActor = new vtkActor(); bookshelf1BottomActor.SetMapper((vtkMapper)mapBookshelf1Bottom); bookshelf1BottomActor.GetProperty().SetColor((double).8,(double).8,(double).6); bookshelf1Front = new vtkStructuredGridGeometryFilter(); bookshelf1Front.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); bookshelf1Front.SetExtent((int)13,(int)20,(int)0,(int)0,(int)0,(int)11); mapBookshelf1Front = vtkPolyDataMapper.New(); mapBookshelf1Front.SetInputConnection((vtkAlgorithmOutput)bookshelf1Front.GetOutputPort()); mapBookshelf1Front.ScalarVisibilityOff(); bookshelf1FrontActor = new vtkActor(); bookshelf1FrontActor.SetMapper((vtkMapper)mapBookshelf1Front); bookshelf1FrontActor.GetProperty().SetColor((double).8,(double).8,(double).6); bookshelf1Back = new vtkStructuredGridGeometryFilter(); bookshelf1Back.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); bookshelf1Back.SetExtent((int)13,(int)20,(int)4,(int)4,(int)0,(int)11); mapBookshelf1Back = vtkPolyDataMapper.New(); mapBookshelf1Back.SetInputConnection((vtkAlgorithmOutput)bookshelf1Back.GetOutputPort()); mapBookshelf1Back.ScalarVisibilityOff(); bookshelf1BackActor = new vtkActor(); bookshelf1BackActor.SetMapper((vtkMapper)mapBookshelf1Back); bookshelf1BackActor.GetProperty().SetColor((double).8,(double).8,(double).6); bookshelf1LHS = new vtkStructuredGridGeometryFilter(); bookshelf1LHS.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); bookshelf1LHS.SetExtent((int)13,(int)20,(int)0,(int)4,(int)0,(int)0); mapBookshelf1LHS = vtkPolyDataMapper.New(); mapBookshelf1LHS.SetInputConnection((vtkAlgorithmOutput)bookshelf1LHS.GetOutputPort()); mapBookshelf1LHS.ScalarVisibilityOff(); bookshelf1LHSActor = new vtkActor(); bookshelf1LHSActor.SetMapper((vtkMapper)mapBookshelf1LHS); bookshelf1LHSActor.GetProperty().SetColor((double).8,(double).8,(double).6); bookshelf1RHS = new vtkStructuredGridGeometryFilter(); bookshelf1RHS.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); bookshelf1RHS.SetExtent((int)13,(int)20,(int)0,(int)4,(int)11,(int)11); mapBookshelf1RHS = vtkPolyDataMapper.New(); mapBookshelf1RHS.SetInputConnection((vtkAlgorithmOutput)bookshelf1RHS.GetOutputPort()); mapBookshelf1RHS.ScalarVisibilityOff(); bookshelf1RHSActor = new vtkActor(); bookshelf1RHSActor.SetMapper((vtkMapper)mapBookshelf1RHS); bookshelf1RHSActor.GetProperty().SetColor((double).8,(double).8,(double).6); bookshelf2Top = new vtkStructuredGridGeometryFilter(); bookshelf2Top.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); bookshelf2Top.SetExtent((int)13,(int)13,(int)15,(int)19,(int)0,(int)11); mapBookshelf2Top = vtkPolyDataMapper.New(); mapBookshelf2Top.SetInputConnection((vtkAlgorithmOutput)bookshelf2Top.GetOutputPort()); mapBookshelf2Top.ScalarVisibilityOff(); bookshelf2TopActor = new vtkActor(); bookshelf2TopActor.SetMapper((vtkMapper)mapBookshelf2Top); bookshelf2TopActor.GetProperty().SetColor((double).8,(double).8,(double).6); bookshelf2Bottom = new vtkStructuredGridGeometryFilter(); bookshelf2Bottom.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); bookshelf2Bottom.SetExtent((int)20,(int)20,(int)15,(int)19,(int)0,(int)11); mapBookshelf2Bottom = vtkPolyDataMapper.New(); mapBookshelf2Bottom.SetInputConnection((vtkAlgorithmOutput)bookshelf2Bottom.GetOutputPort()); mapBookshelf2Bottom.ScalarVisibilityOff(); bookshelf2BottomActor = new vtkActor(); bookshelf2BottomActor.SetMapper((vtkMapper)mapBookshelf2Bottom); bookshelf2BottomActor.GetProperty().SetColor((double).8,(double).8,(double).6); bookshelf2Front = new vtkStructuredGridGeometryFilter(); bookshelf2Front.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); bookshelf2Front.SetExtent((int)13,(int)20,(int)15,(int)15,(int)0,(int)11); mapBookshelf2Front = vtkPolyDataMapper.New(); mapBookshelf2Front.SetInputConnection((vtkAlgorithmOutput)bookshelf2Front.GetOutputPort()); mapBookshelf2Front.ScalarVisibilityOff(); bookshelf2FrontActor = new vtkActor(); bookshelf2FrontActor.SetMapper((vtkMapper)mapBookshelf2Front); bookshelf2FrontActor.GetProperty().SetColor((double).8,(double).8,(double).6); bookshelf2Back = new vtkStructuredGridGeometryFilter(); bookshelf2Back.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); bookshelf2Back.SetExtent((int)13,(int)20,(int)19,(int)19,(int)0,(int)11); mapBookshelf2Back = vtkPolyDataMapper.New(); mapBookshelf2Back.SetInputConnection((vtkAlgorithmOutput)bookshelf2Back.GetOutputPort()); mapBookshelf2Back.ScalarVisibilityOff(); bookshelf2BackActor = new vtkActor(); bookshelf2BackActor.SetMapper((vtkMapper)mapBookshelf2Back); bookshelf2BackActor.GetProperty().SetColor((double).8,(double).8,(double).6); bookshelf2LHS = new vtkStructuredGridGeometryFilter(); bookshelf2LHS.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); bookshelf2LHS.SetExtent((int)13,(int)20,(int)15,(int)19,(int)0,(int)0); mapBookshelf2LHS = vtkPolyDataMapper.New(); mapBookshelf2LHS.SetInputConnection((vtkAlgorithmOutput)bookshelf2LHS.GetOutputPort()); mapBookshelf2LHS.ScalarVisibilityOff(); bookshelf2LHSActor = new vtkActor(); bookshelf2LHSActor.SetMapper((vtkMapper)mapBookshelf2LHS); bookshelf2LHSActor.GetProperty().SetColor((double).8,(double).8,(double).6); bookshelf2RHS = new vtkStructuredGridGeometryFilter(); bookshelf2RHS.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); bookshelf2RHS.SetExtent((int)13,(int)20,(int)15,(int)19,(int)11,(int)11); mapBookshelf2RHS = vtkPolyDataMapper.New(); mapBookshelf2RHS.SetInputConnection((vtkAlgorithmOutput)bookshelf2RHS.GetOutputPort()); mapBookshelf2RHS.ScalarVisibilityOff(); bookshelf2RHSActor = new vtkActor(); bookshelf2RHSActor.SetMapper((vtkMapper)mapBookshelf2RHS); bookshelf2RHSActor.GetProperty().SetColor((double).8,(double).8,(double).6); window = new vtkStructuredGridGeometryFilter(); window.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); window.SetExtent((int)20,(int)20,(int)6,(int)13,(int)10,(int)13); mapWindow = vtkPolyDataMapper.New(); mapWindow.SetInputConnection((vtkAlgorithmOutput)window.GetOutputPort()); mapWindow.ScalarVisibilityOff(); windowActor = new vtkActor(); windowActor.SetMapper((vtkMapper)mapWindow); windowActor.GetProperty().SetColor((double).3,(double).3,(double).5); outlet = new vtkStructuredGridGeometryFilter(); outlet.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); outlet.SetExtent((int)0,(int)0,(int)9,(int)10,(int)14,(int)16); mapOutlet = vtkPolyDataMapper.New(); mapOutlet.SetInputConnection((vtkAlgorithmOutput)outlet.GetOutputPort()); mapOutlet.ScalarVisibilityOff(); outletActor = new vtkActor(); outletActor.SetMapper((vtkMapper)mapOutlet); outletActor.GetProperty().SetColor((double)0,(double)0,(double)0); inlet = new vtkStructuredGridGeometryFilter(); inlet.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); inlet.SetExtent((int)0,(int)0,(int)9,(int)10,(int)0,(int)6); mapInlet = vtkPolyDataMapper.New(); mapInlet.SetInputConnection((vtkAlgorithmOutput)inlet.GetOutputPort()); mapInlet.ScalarVisibilityOff(); inletActor = new vtkActor(); inletActor.SetMapper((vtkMapper)mapInlet); inletActor.GetProperty().SetColor((double)0,(double)0,(double)0); outline = new vtkStructuredGridOutlineFilter(); outline.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); 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((vtkAlgorithmOutput)reader.GetOutputPort()); 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.5); cones.SetScaleModeToScaleByVector(); mapCones = vtkPolyDataMapper.New(); mapCones.SetInputConnection((vtkAlgorithmOutput)cones.GetOutputPort()); mapCones.SetScalarRange((double)((vtkDataSet)reader.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)reader.GetOutput()).GetScalarRange()[1]); conesActor = new vtkActor(); conesActor.SetMapper((vtkMapper)mapCones); ren1.AddActor((vtkProp)table1Actor); ren1.AddActor((vtkProp)table2Actor); ren1.AddActor((vtkProp)FilingCabinet1Actor); ren1.AddActor((vtkProp)FilingCabinet2Actor); ren1.AddActor((vtkProp)bookshelf1TopActor); ren1.AddActor((vtkProp)bookshelf1BottomActor); ren1.AddActor((vtkProp)bookshelf1FrontActor); ren1.AddActor((vtkProp)bookshelf1BackActor); ren1.AddActor((vtkProp)bookshelf1LHSActor); ren1.AddActor((vtkProp)bookshelf1RHSActor); ren1.AddActor((vtkProp)bookshelf2TopActor); ren1.AddActor((vtkProp)bookshelf2BottomActor); ren1.AddActor((vtkProp)bookshelf2FrontActor); ren1.AddActor((vtkProp)bookshelf2BackActor); ren1.AddActor((vtkProp)bookshelf2LHSActor); ren1.AddActor((vtkProp)bookshelf2RHSActor); ren1.AddActor((vtkProp)windowActor); ren1.AddActor((vtkProp)outletActor); ren1.AddActor((vtkProp)inletActor); ren1.AddActor((vtkProp)outlineActor); ren1.AddActor((vtkProp)conesActor); ren1.SetBackground((double)0.4,(double)0.4,(double)0.5); aCamera = new vtkCamera(); aCamera.SetClippingRange((double)0.7724,(double)39); aCamera.SetFocalPoint((double)1.14798,(double)3.08416,(double)2.47187); aCamera.SetPosition((double)-2.64683,(double)-3.55525,(double)3.55848); aCamera.SetViewUp((double)0.0511273,(double)0.132773,(double)0.989827); aCamera.SetViewAngle((double)15.5033); ren1.SetActiveCamera((vtkCamera)aCamera); renWin.SetSize((int)500,(int)300); iren.Initialize(); // interact with data[] //deleteAllVTKObjects(); }
private void ReadPDB() { // Path to vtk data must be set as an environment variable // VTK_DATA_ROOT = "C:\VTK\vtkdata-5.8.0" vtkTesting test = vtkTesting.New(); string root = test.GetDataRoot(); string filePath = System.IO.Path.Combine(root, @"Data\caffeine.pdb"); vtkPDBReader pdb = vtkPDBReader.New(); pdb.SetFileName(filePath); pdb.SetHBScale(1.0); pdb.SetBScale(1.0); pdb.Update(); Debug.WriteLine("# of atoms is: " + pdb.GetNumberOfAtoms()); // if molecule contains a lot of atoms, reduce the resolution of the sphere (represents an atom) for faster rendering int resolution = (int)Math.Floor(Math.Sqrt(300000.0 / pdb.GetNumberOfAtoms())); // 300000.0 is an empriric value if (resolution > 20) { resolution = 20; } else if (resolution < 4) { resolution = 4; } Debug.WriteLine("Resolution is: " + resolution); vtkSphereSource sphere = vtkSphereSource.New(); sphere.SetCenter(0, 0, 0); sphere.SetRadius(1); sphere.SetThetaResolution(resolution); sphere.SetPhiResolution(resolution); vtkGlyph3D glyph = vtkGlyph3D.New(); glyph.SetInputConnection(pdb.GetOutputPort()); glyph.SetOrient(1); glyph.SetColorMode(1); // glyph.ScalingOn(); glyph.SetScaleMode(2); glyph.SetScaleFactor(.25); glyph.SetSourceConnection(sphere.GetOutputPort()); vtkPolyDataMapper atomMapper = vtkPolyDataMapper.New(); atomMapper.SetInputConnection(glyph.GetOutputPort()); atomMapper.UseLookupTableScalarRangeOff(); atomMapper.ScalarVisibilityOn(); atomMapper.SetScalarModeToDefault(); vtkLODActor atom = vtkLODActor.New(); atom.SetMapper(atomMapper); atom.GetProperty().SetRepresentationToSurface(); atom.GetProperty().SetInterpolationToGouraud(); atom.GetProperty().SetAmbient(0.15); atom.GetProperty().SetDiffuse(0.85); atom.GetProperty().SetSpecular(0.1); atom.GetProperty().SetSpecularPower(30); atom.GetProperty().SetSpecularColor(1, 1, 1); atom.SetNumberOfCloudPoints(30000); vtkTubeFilter tube = vtkTubeFilter.New(); tube.SetInputConnection(pdb.GetOutputPort()); tube.SetNumberOfSides(resolution); tube.CappingOff(); tube.SetRadius(0.2); // turn off variation of tube radius with scalar values tube.SetVaryRadius(0); tube.SetRadiusFactor(10); vtkPolyDataMapper bondMapper = vtkPolyDataMapper.New(); bondMapper.SetInputConnection(tube.GetOutputPort()); bondMapper.UseLookupTableScalarRangeOff(); bondMapper.ScalarVisibilityOff(); bondMapper.SetScalarModeToDefault(); vtkLODActor bond = vtkLODActor.New(); bond.SetMapper(bondMapper); bond.GetProperty().SetRepresentationToSurface(); bond.GetProperty().SetInterpolationToGouraud(); bond.GetProperty().SetAmbient(0.15); bond.GetProperty().SetDiffuse(0.85); bond.GetProperty().SetSpecular(0.1); bond.GetProperty().SetSpecularPower(30); bond.GetProperty().SetSpecularColor(1, 1, 1); bond.GetProperty().SetDiffuseColor(1.0000, 0.8941, 0.70981); // get a reference to the renderwindow of our renderWindowControl1 vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow; // renderer vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer(); // set background color renderer.SetBackground(0.2, 0.3, 0.4); // add our actor to the renderer renderer.AddActor(atom); renderer.AddActor(bond); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVgaussian(String [] argv) { //Prefix Content is: "" ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); renWin.SetSize((int)300,(int)300); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); camera = new vtkCamera(); camera.ParallelProjectionOn(); camera.SetViewUp((double)0,(double)1,(double)0); camera.SetFocalPoint((double)12,(double)10.5,(double)15); camera.SetPosition((double)-70,(double)15,(double)34); camera.ComputeViewPlaneNormal(); ren1.SetActiveCamera((vtkCamera)camera); // Create the reader for the data[] //vtkStructuredPointsReader reader[] reader = new vtkGaussianCubeReader(); reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/m4_TotalDensity.cube"); reader.SetHBScale((double)1.1); reader.SetBScale((double)10); reader.Update(); range = reader.GetGridOutput().GetPointData().GetScalars().GetRange(); min = (double)(lindex(range,0)); max = (double)(lindex(range,1)); readerSS = new vtkImageShiftScale(); readerSS.SetInput((vtkDataObject)reader.GetGridOutput()); readerSS.SetShift((double)min*-1); readerSS.SetScale((double)255/(max-min)); readerSS.SetOutputScalarTypeToUnsignedChar(); bounds = new vtkOutlineFilter(); bounds.SetInput((vtkDataObject)reader.GetGridOutput()); boundsMapper = vtkPolyDataMapper.New(); boundsMapper.SetInputConnection((vtkAlgorithmOutput)bounds.GetOutputPort()); boundsActor = new vtkActor(); boundsActor.SetMapper((vtkMapper)boundsMapper); boundsActor.GetProperty().SetColor((double)0,(double)0,(double)0); contour = new vtkContourFilter(); contour.SetInput((vtkDataObject)reader.GetGridOutput()); contour.GenerateValues((int)5,(double)0,(double).05); contourMapper = vtkPolyDataMapper.New(); contourMapper.SetInputConnection((vtkAlgorithmOutput)contour.GetOutputPort()); contourMapper.SetScalarRange((double)0,(double).1); ((vtkLookupTable)contourMapper.GetLookupTable()).SetHueRange(0.32,0); contourActor = new vtkActor(); contourActor.SetMapper((vtkMapper)contourMapper); contourActor.GetProperty().SetOpacity((double).5); // Create transfer mapping scalar value to opacity[] opacityTransferFunction = new vtkPiecewiseFunction(); opacityTransferFunction.AddPoint((double)0,(double)0.01); opacityTransferFunction.AddPoint((double)255,(double)0.35); opacityTransferFunction.ClampingOn(); // Create transfer mapping scalar value to color[] colorTransferFunction = new vtkColorTransferFunction(); colorTransferFunction.AddHSVPoint((double)0.0,(double)0.66,(double)1.0,(double)1.0); colorTransferFunction.AddHSVPoint((double)50.0,(double)0.33,(double)1.0,(double)1.0); colorTransferFunction.AddHSVPoint((double)100.0,(double)0.00,(double)1.0,(double)1.0); // The property describes how the data will look[] volumeProperty = new vtkVolumeProperty(); volumeProperty.SetColor((vtkColorTransferFunction)colorTransferFunction); volumeProperty.SetScalarOpacity((vtkPiecewiseFunction)opacityTransferFunction); volumeProperty.SetInterpolationTypeToLinear(); // The mapper / ray cast function know how to render the data[] compositeFunction = new vtkVolumeRayCastCompositeFunction(); volumeMapper = new vtkVolumeRayCastMapper(); //vtkVolumeTextureMapper2D volumeMapper[] volumeMapper.SetVolumeRayCastFunction((vtkVolumeRayCastFunction)compositeFunction); volumeMapper.SetInputConnection((vtkAlgorithmOutput)readerSS.GetOutputPort()); // The volume holds the mapper and the property and[] // can be used to position/orient the volume[] volume = new vtkVolume(); volume.SetMapper((vtkAbstractVolumeMapper)volumeMapper); volume.SetProperty((vtkVolumeProperty)volumeProperty); ren1.AddVolume((vtkProp)volume); //ren1 AddActor contourActor[] ren1.AddActor((vtkProp)boundsActor); //#####################################################################[] Sphere = new vtkSphereSource(); Sphere.SetCenter((double)0,(double)0,(double)0); Sphere.SetRadius((double)1); Sphere.SetThetaResolution((int)16); Sphere.SetStartTheta((double)0); Sphere.SetEndTheta((double)360); Sphere.SetPhiResolution((int)16); Sphere.SetStartPhi((double)0); Sphere.SetEndPhi((double)180); Glyph = new vtkGlyph3D(); Glyph.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); Glyph.SetOrient((int)1); Glyph.SetColorMode((int)1); //Glyph ScalingOn[] Glyph.SetScaleMode((int)2); Glyph.SetScaleFactor((double).6); Glyph.SetSource((vtkPolyData)Sphere.GetOutput()); AtomsMapper = vtkPolyDataMapper.New(); AtomsMapper.SetInputConnection((vtkAlgorithmOutput)Glyph.GetOutputPort()); AtomsMapper.SetImmediateModeRendering((int)1); AtomsMapper.UseLookupTableScalarRangeOff(); AtomsMapper.SetScalarVisibility((int)1); AtomsMapper.SetScalarModeToDefault(); Atoms = new vtkActor(); Atoms.SetMapper((vtkMapper)AtomsMapper); Atoms.GetProperty().SetRepresentationToSurface(); Atoms.GetProperty().SetInterpolationToGouraud(); Atoms.GetProperty().SetAmbient((double)0.15); Atoms.GetProperty().SetDiffuse((double)0.85); Atoms.GetProperty().SetSpecular((double)0.1); Atoms.GetProperty().SetSpecularPower((double)100); Atoms.GetProperty().SetSpecularColor((double)1,(double)1,(double)1); Atoms.GetProperty().SetColor((double)1,(double)1,(double)1); Tube = new vtkTubeFilter(); Tube.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); Tube.SetNumberOfSides((int)16); Tube.SetCapping((int)0); Tube.SetRadius((double)0.2); Tube.SetVaryRadius((int)0); Tube.SetRadiusFactor((double)10); BondsMapper = vtkPolyDataMapper.New(); BondsMapper.SetInputConnection((vtkAlgorithmOutput)Tube.GetOutputPort()); BondsMapper.SetImmediateModeRendering((int)1); BondsMapper.UseLookupTableScalarRangeOff(); BondsMapper.SetScalarVisibility((int)1); BondsMapper.SetScalarModeToDefault(); Bonds = new vtkActor(); Bonds.SetMapper((vtkMapper)BondsMapper); Bonds.GetProperty().SetRepresentationToSurface(); Bonds.GetProperty().SetInterpolationToGouraud(); Bonds.GetProperty().SetAmbient((double)0.15); Bonds.GetProperty().SetDiffuse((double)0.85); Bonds.GetProperty().SetSpecular((double)0.1); Bonds.GetProperty().SetSpecularPower((double)100); Bonds.GetProperty().SetSpecularColor((double)1,(double)1,(double)1); Bonds.GetProperty().SetColor((double)1,(double)1,(double)1); ren1.AddActor((vtkProp)Bonds); ren1.AddActor((vtkProp)Atoms); //###################################################[] ren1.SetBackground((double)1,(double)1,(double)1); ren1.ResetCamera(); renWin.Render(); //method moved renWin.AbortCheckEvt += new Kitware.VTK.vtkObject.vtkObjectEventHandler(TkCheckAbort_Command.Execute); iren.Initialize(); //deleteAllVTKObjects(); }
/// <summary> /// A console application that creates a /// vtkRenderWindow without a Windows Form /// </summary> /// <param name="argv"></param> public static void Main(String[] argv) { // Demonstrate how to use the vtkBoxWidget 3D widget, // This script uses a 3D box widget to define a "clipping box" to clip some // simple geometry (a mace). Make sure that you hit the "W" key to activate the widget. // Create a mace out of filters. sphere = vtkSphereSource.New(); cone = vtkConeSource.New(); glyph = vtkGlyph3D.New(); glyph.SetInputConnection(sphere.GetOutputPort()); glyph.SetSource(cone.GetOutput()); glyph.SetVectorModeToUseNormal(); glyph.SetScaleModeToScaleByVector(); glyph.SetScaleFactor(0.25); // The sphere and spikes are appended into a single polydata. This just makes things // simpler to manage. apd = vtkAppendPolyData.New(); apd.AddInput(glyph.GetOutput()); apd.AddInput(sphere.GetOutput()); maceMapper = vtkPolyDataMapper.New(); maceMapper.SetInputConnection(apd.GetOutputPort()); maceActor = vtkLODActor.New(); maceActor.SetMapper(maceMapper); maceActor.VisibilityOn(); // This portion of the code clips the mace with the vtkPlanes implicit function. // The clipped region is colored green. planes = vtkPlanes.New(); clipper = vtkClipPolyData.New(); clipper.SetInputConnection(apd.GetOutputPort()); clipper.SetClipFunction(planes); clipper.InsideOutOn(); selectMapper = vtkPolyDataMapper.New(); selectMapper.SetInputConnection(clipper.GetOutputPort()); selectActor = vtkLODActor.New(); selectActor.SetMapper(selectMapper); selectActor.GetProperty().SetColor(0, 1, 0); selectActor.VisibilityOff(); selectActor.SetScale(1.01, 1.01, 1.01); // Create the RenderWindow, Renderer and both Actors ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer(ren1); iren = vtkRenderWindowInteractor.New(); iren.SetRenderWindow(renWin); // The SetInteractor method is how 3D widgets are associated with the render // window interactor. Internally, SetInteractor sets up a bunch of callbacks // using the Command/Observer mechanism (AddObserver()). boxWidget = vtkBoxWidget.New(); boxWidget.SetInteractor(iren); boxWidget.SetPlaceFactor(1.25); ren1.AddActor(maceActor); ren1.AddActor(selectActor); // Add the actors to the renderer, set the background and size ren1.SetBackground(0.1, 0.2, 0.4); renWin.SetSize(300, 300); // Place the interactor initially. The input to a 3D widget is used to // initially position and scale the widget. The EndInteractionEvent is // observed which invokes the SelectPolygons callback. boxWidget.SetInput(glyph.GetOutput()); boxWidget.PlaceWidget(); boxWidget.EndInteractionEvt += new vtkObject.vtkObjectEventHandler(SelectPolygons); // render the image iren.Initialize(); iren.Start(); //Clean up deleteAllVTKObjects(); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVgaussian(String [] argv) { //Prefix Content is: "" ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.SetMultiSamples(0); renWin.AddRenderer((vtkRenderer)ren1); renWin.SetSize((int)300, (int)300); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); camera = new vtkCamera(); camera.ParallelProjectionOn(); camera.SetViewUp((double)0, (double)1, (double)0); camera.SetFocalPoint((double)12, (double)10.5, (double)15); camera.SetPosition((double)-70, (double)15, (double)34); camera.ComputeViewPlaneNormal(); ren1.SetActiveCamera((vtkCamera)camera); // Create the reader for the data[] //vtkStructuredPointsReader reader[] reader = new vtkGaussianCubeReader(); reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/m4_TotalDensity.cube"); reader.SetHBScale((double)1.1); reader.SetBScale((double)10); reader.Update(); range = reader.GetGridOutput().GetPointData().GetScalars().GetRange(); min = (double)(lindex(range, 0)); max = (double)(lindex(range, 1)); readerSS = new vtkImageShiftScale(); readerSS.SetInputData((vtkDataObject)reader.GetGridOutput()); readerSS.SetShift((double)min * -1); readerSS.SetScale((double)255 / (max - min)); readerSS.SetOutputScalarTypeToUnsignedChar(); bounds = new vtkOutlineFilter(); bounds.SetInputData((vtkDataObject)reader.GetGridOutput()); boundsMapper = vtkPolyDataMapper.New(); boundsMapper.SetInputConnection((vtkAlgorithmOutput)bounds.GetOutputPort()); boundsActor = new vtkActor(); boundsActor.SetMapper((vtkMapper)boundsMapper); boundsActor.GetProperty().SetColor((double)0, (double)0, (double)0); contour = new vtkContourFilter(); contour.SetInputData((vtkDataObject)reader.GetGridOutput()); contour.GenerateValues((int)5, (double)0, (double).05); contourMapper = vtkPolyDataMapper.New(); contourMapper.SetInputConnection((vtkAlgorithmOutput)contour.GetOutputPort()); contourMapper.SetScalarRange((double)0, (double).1); ((vtkLookupTable)contourMapper.GetLookupTable()).SetHueRange(0.32, 0); contourActor = new vtkActor(); contourActor.SetMapper((vtkMapper)contourMapper); contourActor.GetProperty().SetOpacity((double).5); // Create transfer mapping scalar value to opacity[] opacityTransferFunction = new vtkPiecewiseFunction(); opacityTransferFunction.AddPoint((double)0, (double)0.01); opacityTransferFunction.AddPoint((double)255, (double)0.35); opacityTransferFunction.ClampingOn(); // Create transfer mapping scalar value to color[] colorTransferFunction = new vtkColorTransferFunction(); colorTransferFunction.AddHSVPoint((double)0.0, (double)0.66, (double)1.0, (double)1.0); colorTransferFunction.AddHSVPoint((double)50.0, (double)0.33, (double)1.0, (double)1.0); colorTransferFunction.AddHSVPoint((double)100.0, (double)0.00, (double)1.0, (double)1.0); // The property describes how the data will look[] volumeProperty = new vtkVolumeProperty(); volumeProperty.SetColor((vtkColorTransferFunction)colorTransferFunction); volumeProperty.SetScalarOpacity((vtkPiecewiseFunction)opacityTransferFunction); volumeProperty.SetInterpolationTypeToLinear(); // The mapper / ray cast function know how to render the data[] compositeFunction = new vtkVolumeRayCastCompositeFunction(); volumeMapper = new vtkVolumeRayCastMapper(); //vtkVolumeTextureMapper2D volumeMapper[] volumeMapper.SetVolumeRayCastFunction((vtkVolumeRayCastFunction)compositeFunction); volumeMapper.SetInputConnection((vtkAlgorithmOutput)readerSS.GetOutputPort()); // The volume holds the mapper and the property and[] // can be used to position/orient the volume[] volume = new vtkVolume(); volume.SetMapper((vtkAbstractVolumeMapper)volumeMapper); volume.SetProperty((vtkVolumeProperty)volumeProperty); ren1.AddVolume((vtkProp)volume); //ren1 AddActor contourActor[] ren1.AddActor((vtkProp)boundsActor); //#####################################################################[] Sphere = new vtkSphereSource(); Sphere.SetCenter((double)0, (double)0, (double)0); Sphere.SetRadius((double)1); Sphere.SetThetaResolution((int)16); Sphere.SetStartTheta((double)0); Sphere.SetEndTheta((double)360); Sphere.SetPhiResolution((int)16); Sphere.SetStartPhi((double)0); Sphere.SetEndPhi((double)180); Glyph = new vtkGlyph3D(); Glyph.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); Glyph.SetOrient((int)1); Glyph.SetColorMode((int)1); //Glyph ScalingOn[] Glyph.SetScaleMode((int)2); Glyph.SetScaleFactor((double).6); Glyph.SetSourceConnection(Sphere.GetOutputPort()); AtomsMapper = vtkPolyDataMapper.New(); AtomsMapper.SetInputConnection((vtkAlgorithmOutput)Glyph.GetOutputPort()); AtomsMapper.SetImmediateModeRendering((int)1); AtomsMapper.UseLookupTableScalarRangeOff(); AtomsMapper.SetScalarVisibility((int)1); AtomsMapper.SetScalarModeToDefault(); Atoms = new vtkActor(); Atoms.SetMapper((vtkMapper)AtomsMapper); Atoms.GetProperty().SetRepresentationToSurface(); Atoms.GetProperty().SetInterpolationToGouraud(); Atoms.GetProperty().SetAmbient((double)0.15); Atoms.GetProperty().SetDiffuse((double)0.85); Atoms.GetProperty().SetSpecular((double)0.1); Atoms.GetProperty().SetSpecularPower((double)100); Atoms.GetProperty().SetSpecularColor((double)1, (double)1, (double)1); Atoms.GetProperty().SetColor((double)1, (double)1, (double)1); Tube = new vtkTubeFilter(); Tube.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); Tube.SetNumberOfSides((int)16); Tube.SetCapping((int)0); Tube.SetRadius((double)0.2); Tube.SetVaryRadius((int)0); Tube.SetRadiusFactor((double)10); BondsMapper = vtkPolyDataMapper.New(); BondsMapper.SetInputConnection((vtkAlgorithmOutput)Tube.GetOutputPort()); BondsMapper.SetImmediateModeRendering((int)1); BondsMapper.UseLookupTableScalarRangeOff(); BondsMapper.SetScalarVisibility((int)1); BondsMapper.SetScalarModeToDefault(); Bonds = new vtkActor(); Bonds.SetMapper((vtkMapper)BondsMapper); Bonds.GetProperty().SetRepresentationToSurface(); Bonds.GetProperty().SetInterpolationToGouraud(); Bonds.GetProperty().SetAmbient((double)0.15); Bonds.GetProperty().SetDiffuse((double)0.85); Bonds.GetProperty().SetSpecular((double)0.1); Bonds.GetProperty().SetSpecularPower((double)100); Bonds.GetProperty().SetSpecularColor((double)1, (double)1, (double)1); Bonds.GetProperty().SetColor((double)1, (double)1, (double)1); ren1.AddActor((vtkProp)Bonds); ren1.AddActor((vtkProp)Atoms); //###################################################[] ren1.SetBackground((double)1, (double)1, (double)1); ren1.ResetCamera(); renWin.Render(); //method moved renWin.AbortCheckEvt += new Kitware.VTK.vtkObject.vtkObjectEventHandler(TkCheckAbort_Command.Execute); iren.Initialize(); //deleteAllVTKObjects(); }