1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
from opencamlib import ocl, camvtk
if __name__ == "__main__":
p = ocl.Point()
p.x=7
p.y=8
p.z=-3
print(p)
q = ocl.Point(1,2,3)
r = p + q
t = ocl.Triangle(p,q,r)
print(t)
s= ocl.STLSurf()
print(s)
s.addTriangle(t)
s.addTriangle(t)
print(s)
print("end.")
myscreen = camvtk.VTKScreen()
print("screen created")
stl = camvtk.STLSurf("../../stl/sphere.stl")
print("STL surface read")
myscreen.addActor(stl)
b = stl.src.GetOutput()
print(b)
print("Verts:",b.GetNumberOfVerts())
print("Cells:",b.GetNumberOfCells())
print("Lines:",b.GetNumberOfLines())
print("Polys:",b.GetNumberOfPolys())
print("Strips:",b.GetNumberOfStrips())
c = b.GetCell(0)
print(c)
print("Points:",c.GetNumberOfPoints())
print("Edges:",c.GetNumberOfEdges())
print("Faces:",c.GetNumberOfFaces())
ps = c.GetPoints()
print(ps)
n=ps.GetNumberOfPoints()
print("Nr of Points:",n)
for id in range(0,n):
print(id,"=",)
print(ps.GetPoint(id))
myscreen.addActor( camvtk.Sphere(radius=0.5,center=ps.GetPoint(id)) )
myscreen.render()
myscreen.iren.Start()
#raw_input("Press Enter to terminate")
|