Hi Jelle,

You're right, it's a pythonOCC issue. I noticed it a couple of weeks ago. Here 
is the problem: the occ.GeomLProp_SurfaceTool().Bounds method takes 4 
Standard_Real passed by reference. This means under C++ you do:

Standard_Real a, b, c, d;
GeomLProp_SurfaceTool.Bounds(hsrf,a,b,c,d);

and you can access the new values of a, b, c, d.

In Python, it's impossible (no pointers in Python)! For instance, if you have:
a = b = c = d = 0.0
occ.GeomLProp_SurfaceTool.Bounds(hsrf,a,b,c,d)

then a still equals 0.0, and so b, c and d. So the Python wrapper needs to 
transform this function so that is returns 4 Standard_Real.

The good solution would be (under Python):
a, b, c, d = occ.GeomLProp_SurfaceTool.Bounds(hsrf)

SWIG can handle function transformation in a very simple way, but I did not 
have time to do that for the moment. I know a few other methods are affected by 
this issue (for example the BndLib.GetBoudingBox or something like that (not 
sure about the function name)).

Thanks for the feedback,

Thomas

> -----Message d'origine-----
> De : [EMAIL PROTECTED] [mailto:minerva-pythonocc-
> [EMAIL PROTECTED] De la part de Jelle Feringa
> Envoyé : vendredi 28 novembre 2008 14:18
> À : minerva-pythonocc@gna.org
> Objet : [Minerva-pythonocc] Standard_Real error, when sending floats
> 
> 
> Hi,
> 
> I'm working on a curvature issue, and am having problems sending floats.
> I think this might be an issue API wide, so perhaps its important.
> 
> .Bounds expects 4 Standard_Real's, neither of the two methods below
> work.
> Any ideas how I can fix this?
> 
> Much appreciated,
> 
> -jelle
> 
> a,b,c,d = [.1]*4
> occ.GeomLProp_SurfaceTool().Bounds(h_srf, 0., 0. ,0. ,0. )
> occ.GeomLProp_SurfaceTool().Bounds(h_srf, a,b,c,d)
> 
> 
> occ.GeomLProp_SurfaceTool().Bounds(h_srf, a,b,c,d)
> Traceback (most recent call last):
>    File "<console>", line 1, in ?
>    File "C:\Python24\Lib\site-packages\OCC.py", line 192525, in Bounds
>      return _OCC.GeomLProp_SurfaceTool_Bounds(*args)
> TypeError: in method 'GeomLProp_SurfaceTool_Bounds', argument 3 of
> type 'Standard_Real &'
> 
> 
> _______________________________________________
> Minerva-pythonocc mailing list
> Minerva-pythonocc@gna.org
> https://mail.gna.org/listinfo/minerva-pythonocc

_______________________________________________
Minerva-pythonocc mailing list
Minerva-pythonocc@gna.org
https://mail.gna.org/listinfo/minerva-pythonocc

Reply via email to