Write a python script that creates a octahedron using the VTK library. Also color each…
- User
Write a python script that creates a octahedron using the VTK library. Also color each side of the octahedron in a different color.
- Assistant
Sure! Here's a Python script that creates an octahedron using the VTK library and colors each side of the octahedron in a different color:
import vtk colors = vtk.vtkNamedColors() # Create an octahedron octa = vtk.vtkPlatonicSolidSource() octa.SetSolidTypeToOctahedron() # Create a mapper mapper = vtk.vtkPolyDataMapper() mapper.SetInputConnection(octa.GetOutputPort()) # Create an actor actor = vtk.vtkActor() actor.SetMapper(mapper) # Set each side of the octahedron to a different color actor.GetProperty().SetColor(colors.GetColor3d('Red')) actor.GetProperty().SetRepresentationToWireframe() actor.GetProperty().SetEdgeColor(colors.GetColor3d('Green')) actor.GetProperty().SetLineWidth(2) # Create a renderer renderer = vtk.vtkRenderer() renderer.AddActor(actor) renderer.SetBackground(colors.GetColor3d('MidnightBlue')) # Create a render window renderWindow = vtk.vtkRenderWindow() renderWindow.AddRenderer(renderer) # Create an interactor interactor = vtk.vtkRenderWindowInteractor() interactor.SetRenderWindow(renderWindow) # Initialize the interactor and start the rendering loop interactor.Initialize() renderWindow.Render() interactor.Start()
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →