<commit_before>#! /usr/bin/env python
# -*- coding: latin-1; -*-

import vtk

reader = vtk.vtkSTLReader()
reader.SetFileName('patte.stl')
reader.Update()

mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(reader.GetOutputPort())

actor = vtk.vtkActor()
actor.SetMapper(mapper)


# display
ren = vtk.vtkRenderer()
win = vtk.vtkRenderWindow()
win.AddRenderer(ren)

intor = vtk.vtkRenderWindowInteractor()
intor.SetRenderWindow(win)

ren.AddActor(actor)

win.Render()
intor.Start()<commit_msg>calcul aire ok<commit_after>#! /usr/bin/env python
# -*- coding: latin-1; -*-

import vtk

reader = vtk.vtkSTLReader()
reader.SetFileName('patte.stl')
reader.Update()

plane=vtk.vtkPlane()
plane.SetOrigin(0,30,0)
plane.SetNormal(0,1,0)


cutter = vtk.vtkClipPolyData()
cutter.SetClipFunction(plane)
cutter.SetInputConnection(reader.GetOutputPort())
cutter.Update()
cutterMapper=vtk.vtkPolyDataMapper()
cutterMapper.SetInputConnection( cutter.GetOutputPort())

#create plane actor
planeActor=vtk.vtkActor()
planeActor.GetProperty().SetColor(1.0,1,0)
planeActor.GetProperty().SetLineWidth(2)
planeActor.SetMapper(cutterMapper)




mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(reader.GetOutputPort())

actor = vtk.vtkActor()
actor.SetMapper(mapper)
actor.GetProperty().SetColor(0.5,1,0.5)
actor.GetProperty().SetOpacity(0.1)

# display
ren = vtk.vtkRenderer()
win = vtk.vtkRenderWindow()
win.SetSize(800, 800)
win.AddRenderer(ren)

intor = vtk.vtkRenderWindowInteractor()
intor.SetRenderWindow(win)

ren.AddActor(actor)
ren.AddActor(planeActor)
ren.SetBackground(0,0,0)



cubeAxesActor = vtk.vtkCubeAxesActor()
cubeAxesActor.SetBounds(reader.GetOutput().GetBounds())
cubeAxesActor.SetCamera(ren.GetActiveCamera())

ren.AddActor(cubeAxesActor)
ren.GetActiveCamera().Azimuth(30)
ren.GetActiveCamera().Elevation(30)
ren.ResetCamera()


massProps = vtk.vtkMassProperties()
massProps.SetInputConnection(cutter.GetOutputPort())
massProps.Update()

print 'SurfaceArea =', massProps.GetSurfaceArea()
print 'Volume =', massProps.GetVolume()
#print 'NormalizedShapeIndex =', massProps.GetNormalizedShapeIndex()


win.Render()
intor.Start()
{'fraction_non_alphanumeric': 0.14766355140186915, 'fraction_numerical': 0.01588785046728972, 'mean_word_length': 7.2664092664092665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7456597', 'n_tokens_mistral': 818, 'n_tokens_neox': 792, 'n_words': 104}