pystl

2016-08-16 Thread Poul Riis
Can someone deliver a minimal, fully working example with the pystl module,
https://pypi.python.org/pypi/pystl/

The only example code mentioned is the following:

with PySTL(‘stl_test.stl’) as stl:
stl.add_triangle( (0.0, 0.0, 0.5), (0.0, 1.0, 0.0), (1.0, 1.0, 0.5) )


but no matter what 'import'-statement I try I cannot make it work.



I have installed the module and a program containing only the following line

from pystl import PySTL

runs without any error message.


Poul Riis
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pystl

2016-08-17 Thread Poul Riis
I tried the following:

from pystl import PySTL
with PySTL('stl_test.stl') as stl:
stl.add_triangle((0,0,0),(1,0,0),(0,1,0))

I got the following error message:

Traceback (most recent call last):
  File 
"C:/Users/pr/AppData/Local/Programs/Python/Python35-32/Lib/idlelib/pystl_module_test_1.py",
 line 3, in 
with PySTL('stl_test.stl') as stl:
  File 
"c:\users\pr\appdata\local\continuum\anaconda3\lib\site-packages\pystl\pystl.py",
 line 62, in __enter__
self.write_stl_header()
  File 
"c:\users\pr\appdata\local\continuum\anaconda3\lib\site-packages\pystl\pystl.py",
 line 75, in write_stl_header
self.f.write(struct.pack("80s", header_str))
struct.error: argument for 's' must be a bytes object



Poul Riis





Den onsdag den 17. august 2016 kl. 08.49.29 UTC+2 skrev Steven D'Aprano:
> On Wednesday 17 August 2016 16:36, Poul Riis wrote:
> 
> > Can someone deliver a minimal, fully working example with the pystl module,
> > https://pypi.python.org/pypi/pystl/
> > 
> > The only example code mentioned is the following:
> > 
> > with PySTL(‘stl_test.stl’) as stl:
> > stl.add_triangle( (0.0, 0.0, 0.5), (0.0, 1.0, 0.0), (1.0, 1.0, 0.5) )
> > 
> > 
> > but no matter what 'import'-statement I try I cannot make it work.
> 
> Don't make us guess. What have you tried, and what happens when you do? Cut 
> and 
> paste the *actual* code you try, and the *actual* results.
> 
> http://mattgemmell.com/what-have-you-tried/
> 
> http://www.sscce.org/
> 
> 
> > I have installed the module and a program containing only the following line
> > 
> > from pystl import PySTL
> > 
> > runs without any error message.
> 
> Great. Then try this:
> 
> from pystl import PySTL
> with PySTL(‘stl_test.stl’) as stl:
> stl.add_triangle( (0.0, 0.0, 0.5), (0.0, 1.0, 0.0), (1.0, 1.0, 0.5) )
> 
> 
> 
> If it doesn't work, what does it do?
> 
> 
> 
> -- 
> Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Making stl files with python for 3d printing

2016-11-13 Thread Poul Riis
Below you can find my python code to make a vase for 3D-printing.
The vase looks nice on my screen so the vertices and the faces seem to be 
perfect.
However, when sending the .stl file produced to a 3D-printer the vase comes out 
as a filled solid - no room for water and flowers!
I have tried to slice the vase the the program "Cura". It seems that the slices 
are full disks, not rings as intended, at some values of z but far from all.
I don't expect anybody to read the full program (I'm a very poor programmer) 
but my hope is that someone can give a hint as to how I can improve the writing 
of the .stl file.

Poul Riis

#!/usr/bin/env python
#coding:utf-8
# Purpose: Export 3D objects, build of faces with 3 or 4 vertices, as ASCII or 
Binary STL file.
# License: MIT License

import struct
from tvtk.api import tvtk
from mayavi import mlab
from math import *
from sympy import *



ASCII_FACET = """facet normal 0 0 0
outer loop
vertex {face[0][0]:.4f} {face[0][1]:.4f} {face[0][2]:.4f}
vertex {face[1][0]:.4f} {face[1][1]:.4f} {face[1][2]:.4f}
vertex {face[2][0]:.4f} {face[2][1]:.4f} {face[2][2]:.4f}
endloop
endfacet
"""

BINARY_HEADER ="80sI"
BINARY_FACET = "12fH"

class ASCII_STL_Writer:
""" Export 3D objects build of 3 or 4 vertices as ASCII STL file.
"""
def __init__(self, stream):
self.fp = stream
self._write_header()

def _write_header(self):
self.fp.write("solid python\n")

def close(self):
self.fp.write("endsolid python\n")

def _write(self, face):
self.fp.write(ASCII_FACET.format(face=face))

def _split(self, face):
p1, p2, p3, p4 = face
return (p1, p2, p3), (p3, p4, p1)

def add_face(self, face):
""" Add one face with 3 or 4 vertices. """
if len(face) == 4:
face1, face2 = self._split(face)
self._write(face1)
self._write(face2)
elif len(face) == 3:
self._write(face)
else:
raise ValueError('only 3 or 4 vertices for each face')

def add_faces(self, faces):
""" Add many faces. """
for face in faces:
self.add_face(face)

class Binary_STL_Writer(ASCII_STL_Writer):
""" Export 3D objects build of 3 or 4 vertices as binary STL file.
"""
def __init__(self, stream):
self.counter = 0
super(Binary_STL_Writer, self).__init__(stream)

def close(self):
self._write_header()

def _write_header(self):
self.fp.seek(0)
self.fp.write(struct.pack(BINARY_HEADER, b'Python Binary STL Writer', 
self.counter))

def _write(self, face):
self.counter += 1
data = [
0., 0., 0.,
face[0][0], face[0][1], face[0][2],
face[1][0], face[1][1], face[1][2],
face[2][0], face[2][1], face[2][2],
0
]
self.fp.write(struct.pack(BINARY_FACET, *data))


def example(fn):
def get_cube():
p=[]
nxy=24
nz=21#Must be odd
unit=10
h=2*unit
dh=h/nz
zbottom=-2*dh
thickness=0.3*unit

z=Symbol('z')
f=1*(1+sin((z/h)**2*1*pi)/8)*exp(z/h/2)*unit#1*
#f=(1+z/h)*unit
flambdified = lambdify(z, f)
fdiff=f.diff(z)
fdifflambdified = lambdify(z, fdiff)

rinner0=10
rinner=rinner0
router0=rinner0+thickness
router=router0
deltar=1
deltaphi=2*pi/nxy
deltaphih=deltaphi/2
nxyz=nxy*nz
npts=0

#Inner:
for j in range(0,nz+1):
zact=j*dh
ract=flambdified(zact)
phiact=j%2*(-deltaphih)
for i in range(0,nxy):
p.append((ract*cos(phiact),ract*sin(phiact),zact))
phiact=phiact+deltaphi
npts=npts+1
npts1=npts


#Middle of upper rim:
phiact=0
ract=flambdified(zact)
a=fdifflambdified(zact)
b=sqrt(1+a*a)
k=thickness/b/2
for i in range(0,nxy):
cosphi=cos(phiact)
sinphi=sin(phiact)
dx=k*cosphi
dy=k*sinphi
dz=-k*a
p.append((ract*cosphi+dx,ract*sinphi+dy,zact+dz))
phiact=phiact+deltaphi
npts1=npts1+1

#Outer:
for j in range(-1,nz+2):
zact=(nz-j-1)*dh
ract=flambdified(zact)
a=fdifflambdified(zact)
b=sqrt(1+a*a)
k=thickness/b
phiact=(j-0)%2*(-deltaphih)
for i in range(0,nxy):
cosphi=cos(phiact)
sinphi=sin(phiact)
dx=k*cosphi
   

Re: Making stl files with python for 3d printing

2016-11-15 Thread Poul Riis
Den mandag den 14. november 2016 kl. 05.55.20 UTC+1 skrev Gregory Ewing:
> Poul Riis wrote:
> > However, when sending the .stl file produced to a 3D-printer the vase comes
> > out as a filled solid - no room for water and flowers!
> 
> My guess is that you have a problem with the orientation
> of your faces. The inner surface needs to have its triangles
> oriented so that their "outside" direction is towards the
> centre of the vase.
> 
> If you generate the inner surface using the same code as
> the outer surface and just change the radius, you will
> end up with both surfaces oriented outwards, which would
> produce the effect you describe.
> 
> -- 
> Greg

You are right - thank you so much!

Poul Riis
-- 
https://mail.python.org/mailman/listinfo/python-list


Partitioning a list

2018-08-21 Thread Poul Riis
I would like to list all possible ways to put N students in groups of k 
students (suppose that k divides N) with the restriction that no two students 
should ever meet each other in more than one group. 
I think this is a classical problem and I think there must be a python solution 
out there but I cannot find it. For instance, numpy's array_split only lists 
one (trivial) split.
I would be happy if someone could refer me to a general python algorithm 
solving the problem.

Poul Riis 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Partitioning a list

2018-08-23 Thread Poul Riis
I find it surprisingly difficult to find information on this issue on the 
internet. Until now I've only found this preview of an article:
https://www.jstor.org/stable/3615434?seq=1#page_scan_tab_contents

Still, I can hardly believe that nobody has made some efforts to make a python 
algorithm to solve this classical problem so I'm still hoping
-- 
https://mail.python.org/mailman/listinfo/python-list


sympy

2016-03-30 Thread Poul Riis
Is it possible to transfer results from sympy to 'normal' python.

In the case below I think my intention is clear enough but it does not work as 
intended. How can it be done?

Poul Riis




from sympy import *
x=Symbol('x')
ftext=diff(1/(x**2+1),x)

def f(t):
return ftext.subs(x,'t')

print(f(3))
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sympy

2016-03-30 Thread Poul Riis
What I intend to do is to let sympy find the derivative of some welldefined 
function and next define the foundation derivative as a normal function so that 
I can calculate numerical values or even make a graph.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sympy

2016-03-30 Thread Poul Riis
Den torsdag den 31. marts 2016 kl. 06.49.34 UTC+2 skrev Gregory Ewing:
> Steven D'Aprano wrote:
> > On Thu, 31 Mar 2016 02:23 am, Poul Riis wrote:
> > 
> >>What I intend to do is to let sympy find the derivative of some
> >>welldefined function and next define the foundation derivative as a normal
> >>function
> > 
> > py> ftext.evalf(subs={x:3})
> > -0.0600
> 
> Given all that, it looks like you want
> 
> def f(t):
>    return ftext.evalf(subs={x:t})
> 
> -- 
> Greg

Oh, yes, that works! Thank you!

Poul Riis
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sympy

2016-03-31 Thread Poul Riis
Den onsdag den 30. marts 2016 kl. 17.59.49 UTC+2 skrev Steven D'Aprano:
> On Thu, 31 Mar 2016 02:23 am, Poul Riis wrote:
> 
> > What I intend to do is to let sympy find the derivative of some
> > welldefined function and next define the foundation derivative as a normal
> > function so that I can calculate numerical values or even make a graph.
> 
> 
> I'm glad you explained what you *actually* wanted, because I was going to
> guess that you wanted to evaluate the derivative at x = 3:
> 
> 
> py> ftext.evalf(subs={x:3})
> -0.0600
> 
> 
> 
> -- 
> Steven

... However, the sympy way seems to be about 70 times slower than using the 
derivative calculated 'by hand' (try the example below).
Can it be done in a more efficient way?

Poul Riis



from sympy import *
from time import *
x=Symbol('x')
ftext=diff(sin(x),x)

def fmsympy(t): 
   return ftext.evalf(subs={x:t})

def fm(t):
return cos(t)

nloop=1
tstart=time()
# nloop evaluations with sympy
for i in range(0,nloop):
a=fmsympy(1)
dt1=time()-tstart

# nloop evaluations without sympy
tstart=time()
for i in range(0,nloop):
a=fm(1)
dt2=time()-tstart

print(nloop,' evaluations with sympy   : dt1 =',dt1)
print(nloop,' evaluations without sympy: dt2 =',dt2)


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sympy

2016-03-31 Thread Poul Riis
Den onsdag den 30. marts 2016 kl. 13.17.33 UTC+2 skrev Poul Riis:
> Is it possible to transfer results from sympy to 'normal' python.
> 
> In the case below I think my intention is clear enough but it does not work 
> as intended. How can it be done?
> 
> Poul Riis
> 
> 
> 
> 
> from sympy import *
> x=Symbol('x')
> ftext=diff(1/(x**2+1),x)
> 
> def f(t):
> return ftext.subs(x,'t')
> 
> print(f(3))

Well, cos(1) should have been cos(1.0) (which forces numerical evaluation, try 
example below).
I am just trying to implement one little thing that all CAS tools can do in a 
few lines, namely finding the derivative of a given function followed by 
evalution of numerical values, something like:
define(fm(x),diff(f(x),x))
fm(1.0)

Sympy can find the derivative, and once that has been completed I would expect 
that there is some way to find numerical values just as fast as if the 
derivative had been given 'by hand'. But how exactly?


Poul Riis


from sympy import *
from time import *
x=Symbol('x')
ftext=diff(sin(x),x)

def fmsympy(t): 
   return ftext.evalf(subs={x:t})

def fm(t):
return cos(t)

nloop=1
tstart=time()
for i in range(0,nloop):
a=fmsympy(1)
dt1=time()-tstart
print(a)
tstart=time()
for i in range(0,nloop):
a=fm(1.0)
dt2=time()-tstart
print(a)

print(nloop,' evaluations with sympy   : dt1 =',dt1)
print(nloop,' evaluations without sympy: dt2 =',dt2)
-- 
https://mail.python.org/mailman/listinfo/python-list


Animations with mayavi and moviepy

2016-05-10 Thread Poul Riis
The animation example below (taken from 
http://zulko.github.io/blog/2014/11/29/data-animations-with-python-and-moviepy/)
stops after producing and displaying the 41 frames. In stead, after producing 
the 41 frames I want to make it loop continuously. I have googled and googled 
and googled and still not found out how to do it. I guess that it is very 
simple but how?

The program prints out some rather uninteresting information - how can I 
suppress that?


Poul Riis




import numpy as np
import mayavi.mlab as mlab
import  moviepy.editor as mpy

duration= 2 # duration of the animation in seconds (it will loop)

# MAKE A FIGURE WITH MAYAVI

fig_myv = mlab.figure(size=(220,220), bgcolor=(1,1,1))
X, Y = np.linspace(-2,2,200), np.linspace(-2,2,200)
XX, YY = np.meshgrid(X,Y)
ZZ = lambda d: np.sinc(XX**2+YY**2)+np.sin(XX+d)

# ANIMATE THE FIGURE WITH MOVIEPY, WRITE AN ANIMATED GIF

def make_frame(t):
mlab.clf() # clear the figure (to reset the colors)
mlab.mesh(YY,XX,ZZ(2*np.pi*t/duration), figure=fig_myv)
return mlab.screenshot(antialiased=True)

animation = mpy.VideoClip(make_frame, duration=duration)
animation.write_gif("sinc.gif", fps=20)



-- 
https://mail.python.org/mailman/listinfo/python-list


Cairo module

2015-02-03 Thread Poul Riis
I just tried the Cairo Python module.
I ran the test file below.
It works perfectly but instead of saving the resulting image as a file I want 
to see it displayed directly on the screen.
How can I do that?

Poul Riis




import math
import cairo

WIDTH, HEIGHT = 256, 256

surface = cairo.ImageSurface (cairo.FORMAT_ARGB32, WIDTH, HEIGHT)
ctx = cairo.Context (surface)

ctx.scale (WIDTH, HEIGHT) # Normalizing the canvas

pat = cairo.LinearGradient (0.0, 0.0, 0.0, 1.0)
pat.add_color_stop_rgba (1, 0.7, 0, 0, 0.5) # First stop, 50% opacity
pat.add_color_stop_rgba (0, 0.9, 0.7, 0.2, 1) # Last stop, 100% opacity

ctx.rectangle (0, 0, 1, 1) # Rectangle(x0, y0, x1, y1)
ctx.set_source (pat)
ctx.fill ()

ctx.translate (0.1, 0.1) # Changing the current transformation matrix

ctx.move_to (0, 0)
ctx.arc (0.2, 0.1, 0.1, -math.pi/2, 0) # Arc(cx, cy, radius, start_angle, 
stop_angle)
ctx.line_to (0.5, 0.1) # Line to (x,y)
ctx.curve_to (0.5, 0.2, 0.5, 0.4, 0.2, 0.8) # Curve(x1, y1, x2, y2, x3, y3)
ctx.close_path ()

ctx.set_source_rgb (0.3, 0.2, 0.5) # Solid color
ctx.set_line_width (0.02)
ctx.stroke ()

surface.write_to_png ("example.png") # Output to PNG 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cairo module

2015-02-04 Thread Poul Riis
Could you be a little more specific (giving, for instance, a full working 
example)?
I tried to interchange
 surface = cairo.ImageSurface (cairo.FORMAT_ARGB32, WIDTH, HEIGHT) 
with
 surface = cairo.Win32Surface (cairo.FORMAT_ARGB32, WIDTH, HEIGHT) 
but that didn't seem to work.

Could matplotlib be used to show the image?

Poul Riis
-- 
https://mail.python.org/mailman/listinfo/python-list


pyqtgraph window position

2015-02-13 Thread Poul Riis
I can control the size of my pyqtgraph window below with 'resize'.
But how can I control the position on the screen?

Poul Riis


import pyqtgraph as pg

w = pg.GraphicsWindow()
w.resize(250,400)

for i in range(4):
w.addPlot(0, i)

def onClick(event):
but=event.button()
print("but: ",but)

w.scene().sigMouseClicked.connect(onClick)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pyqtgraph window position

2015-02-14 Thread Poul Riis
Den lørdag den 14. februar 2015 kl. 06.59.20 UTC+1 skrev Cousin Stanley:
> > I can control the size of my pyqtgraph window below with 'resize'.
> >
> > But how can I control the position on the screen?
> > 
> 
>   Also, try  
> 
>   w.setGeometry( x_pos , y_pos , width , height )
> 
> 
> -- 
> Stanley C. Kitching
> Human Being
> Phoenix, Arizona

Thanks a lot.
And how can I control the position of the secondary window in the example below?
And how can I make a keyboard interrupt?

Poul Riis



import pyqtgraph as pg
from math import *
from time import *
import numpy as np

win = pg.GraphicsWindow(title="Basic plotting examples")
#win.resize(1000,600)
win.setGeometry(0,100, 1000,600 ) 


xx=[]
yy=[]

datanp = np.random.normal(size=(10,20))
ptr=0

for i in range(0,25):
xx.append(i)
yy.append(i*i/25.0)

xarray=np.array(xx)
pw=pg.plot(xx,yy,pen='r')

p1 = win.addPlot(title="Extra window")
p1.plot(xx,yy,pen='b')

j=0
while True:
j=j+1
yyy=[]
for ii in range(0,len(yy)):
yyy.append(sin(pi*(j-ii)/25)*yy[ii])
yarray=np.array(yyy)
pw.plot(xarray, yarray, clear=True)
pg.QtGui.QApplication.processEvents()

-- 
https://mail.python.org/mailman/listinfo/python-list


guiqwt

2015-05-21 Thread Poul Riis
How can I control the size of the window in the example below?

Poul Riis



import numpy as np
from guiqwt import pyplot as plt_

x = np.arange(0,20,0.1)
y = np.cos(x)
plt_.figure(1)
plt_.plot(x,y,'r-')
plt_.show()
-- 
https://mail.python.org/mailman/listinfo/python-list


repeat until keypressed

2017-05-29 Thread Poul Riis
In good old pascal there was this one-liner command:
repeat until keypressed

Apparently there is no built-in analogue for that in python. I have explored 
several different possibilities (pyglet, keyboard, curses, ginput (from 
matplotlib) and others) but not managed to find anything that works the way I 
want.

In the following example I just want to replace 'waitforbuttonpress' with 
something like 'continueuntilbuttonpress' if such a command exists. It could be 
 a mouseclick or a keystroke from the terminal, for instance 'shift', 'space' 
or some character.

Poul Riis






import warnings
warnings.filterwarnings("ignore",".*GUI is implemented.*")
from pylab import *
ion()
plot1=subplot(2,1,1)
plot2=subplot(2,1,2)

for i in range(20):
plot1.plot([20*(sin(i/10)+1)],[cos(i/10)],'bo')

### The following two lines should be replaced by
### something like "Go on until some key is pressed - then break"
if plt.waitforbuttonpress():
break


pause(0.1)
draw()
for i in range(20):
plot2.plot([20*(sin(i/10)+1)],[-cos(i/10)],'ro')
pause(0.1)
draw()
ioff()

-- 
https://mail.python.org/mailman/listinfo/python-list


numpy not working any more

2017-08-14 Thread Poul Riis
For some time I have been using python 3.6.0 on a windows computer.
Suddenly, my numpy does not work any more.
This one-liner program:
import numpy as np
results in the long error message below.
In an effort to solve the problem I tried to install python 3.6.2 followed by 
all the modules I need. Here, there was no problem with numpy but then another 
problem appeared: Installing mayavi apparently needs vtk but pip couldn't find 
an acceptable vtk version.

What is the easiest way to make things work again?


Poul Riis





Traceback (most recent call last):
  File 
"C:\Users\pr\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\__init__.py",
 line 16, in 
from . import multiarray
ImportError: DLL load failed: Den angivne procedure blev ikke fundet.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/pr/python/numpy_test.py", line 1, in 
import numpy as np
  File 
"C:\Users\pr\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\__init__.py",
 line 142, in 
from . import add_newdocs
  File 
"C:\Users\pr\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\add_newdocs.py",
 line 13, in 
from numpy.lib import add_newdoc
  File 
"C:\Users\pr\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\lib\__init__.py",
 line 8, in 
from .type_check import *
  File 
"C:\Users\pr\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\lib\type_check.py",
 line 11, in 
import numpy.core.numeric as _nx
  File 
"C:\Users\pr\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\__init__.py",
 line 26, in 
raise ImportError(msg)
ImportError: 
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.

Original error was: DLL load failed: Den angivne procedure blev ikke fundet.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: numpy not working any more

2017-08-15 Thread Poul Riis
Den tirsdag den 15. august 2017 kl. 07.29.05 UTC+2 skrev dieter:
> Poul Riis  writes:
> > ...
> > For some time I have been using python 3.6.0 on a windows computer.
> > Suddenly, my numpy does not work any more.
> > This one-liner program:
> > import numpy as np
> > results in the long error message below.
> > ...
> > Traceback (most recent call last):
> >   File 
> > "C:\Users\pr\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\__init__.py",
> >  line 16, in 
> > from . import multiarray
> > ImportError: DLL load failed: Den angivne procedure blev ikke fundet.
> 
> Apparently, the module "multiarry" is implemented in a separate
> DLL (= "Dynamically Loaded Library") and loading this DLL failed.
> 
> There can be several reasons for such a failure, among others:
> 
>  * the DLL is missing
> 
>  * the DLL is corrupted
> 
>  * the DLL depends on something which is missing or corrupted
> 
>  * there is a version mismatch (e.g. between the DLL and the Python
>trying to load it)
> 
> 
> An initial step could be to try to reinstall "numpy" and
> see whether the problem goes away.

I have reinstalled numpy several times - doesn't help.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: numpy not working any more

2017-08-15 Thread Poul Riis
Den tirsdag den 15. august 2017 kl. 19.19.15 UTC+2 skrev bream...@gmail.com:
> On Tuesday, August 15, 2017 at 5:23:29 PM UTC+1, Poul Riis wrote:
> > Den tirsdag den 15. august 2017 kl. 07.29.05 UTC+2 skrev dieter:
> > > Poul Riis writes:
> > > > ...
> > > > For some time I have been using python 3.6.0 on a windows computer.
> > > > Suddenly, my numpy does not work any more.
> > > > This one-liner program:
> > > > import numpy as np
> > > > results in the long error message below.
> > > > ...
> > > > Traceback (most recent call last):
> > > >   File 
> > > > "C:\Users\pr\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\__init__.py",
> > > >  line 16, in 
> > > > from . import multiarray
> > > > ImportError: DLL load failed: Den angivne procedure blev ikke fundet.
> > > 
> > > Apparently, the module "multiarry" is implemented in a separate
> > > DLL (= "Dynamically Loaded Library") and loading this DLL failed.
> > > 
> > > There can be several reasons for such a failure, among others:
> > > 
> > >  * the DLL is missing
> > > 
> > >  * the DLL is corrupted
> > > 
> > >  * the DLL depends on something which is missing or corrupted
> > > 
> > >  * there is a version mismatch (e.g. between the DLL and the Python
> > >trying to load it)
> > > 
> > > 
> > > An initial step could be to try to reinstall "numpy" and
> > > see whether the problem goes away.
> > 
> > I have reinstalled numpy several times - doesn't help.
> 
> The short answer is you need to upgrade Python, not numpy.
> 
> For the long answer please see 
> https://stackoverflow.com/questions/44537131/numpy-library-importerror-dll-load-failed-the-specified-procedure-could-not-be
>  which in turn refers to https://bugs.python.org/issue29943.
> 
> Kindest regards.
> 
> Mark Lawrence.

I mentioned in my original question that I have tried Python 3.6.2 and that it 
indeed had no problems with numpy but that it on the other hand gave rize to 
another problem, namely failing installation of vtk (pip says 'Couldn't find a 
version that satisfies the requirement vtk'.

Poul Riis
-- 
https://mail.python.org/mailman/listinfo/python-list


Near and far clip plane in glowscript

2023-08-20 Thread Poul Riis via Python-list
Yes, I know that this is not the right forum to present my problem but I have 
tried the glowscript forum without succes.

A different programming language, PyWeb3D, has this simple command to control 
the distances from the camera to the near and far planes:
camera=PerspectiveCamera( 45, width / height, 1, 1000 )
where 1 is the distance to the near plane and 1000 is the distance to the far 
plane. 
- see
https://threejs.org/docs/index.html?q=perspec#api/en/cameras/PerspectiveCamera

I am convinced that there must be a similar way to control these parameters 
from glowscript because it is obvious that they are set to some default values 
because I see objects disappear in some cases. But I have no idea how!?!? 
I suspect it has to to with WebGL and how to reach WebGL commands from 
glowscript.
What I hope is that someone at this forum can give a little hint as to get 
closer to a solution. It would make me very, very happy!

Poul Riis
Denmark
-- 
https://mail.python.org/mailman/listinfo/python-list