Hi Thomas,

This is very cool. I am interested in OCC as a 'model builder' for use with an 
electromagnetic simulation package I am writing. An important stage in this is 
the meshing of the model - so you've already started doing my work :-)

Also thanks for the Python/C++ note - I'm beginning to understand why so many 
people get excited by Python, the syntax here seems very intuitive. PythonOCC 
is 
shaping into a very nice package indeed!

Arthur

Thomas Paviot wrote:
> Dear all,
> 
> Here is another pythonOCC sample: a simple mesher. To run this sample, 
> you need the latest python svn revision (at least 198), because it uses 
> the 'Standard_Integer & transformation function' I told you in my 
> previous mail. This introduces a *major* difference between OpenCascade 
> C++ programming and pythonOCC.
> 
> In C++, there is a method to pass parameters to a function named 'by 
> reference'. It means, for instance, that if you want to get the value of 
> 3 integers, you can do:
> int a=2;
> int b=3;
> in c=4;
> Get(a,b,c);
> 
> After the call of the function Get, the values of a, b and c have changed.
> 
> It's not possible in python. For instance, if you do:
> a = 1
> b = 2
> c = 3
> Get(a,b,c)
> print "a=%i"a
> print "b=%i"%b
> print "b=%i"%b
> 
> You will *always* have the following result:
> a=1
> b=2
> c=3
> 
> OpenCascade makes intensive use of this way to pass parameters to 
> functions. For instance, in the Poly_Triangle class, you have a method 
> Get that takes 3 integers by reference. As it's not possible to use 
> "as-is" in Python, this method requires a tranformation(done in SWIG): 
> it takes no parameters and returns the 3 integers.
> - In C++:
>     Standard_Integer index1;
>     Standard_Integer index2;
>     Standard_Integer index3;
>     myTriangle.Get(index1, index2, index3);
> - In Python:
>     index1  , index2, index3 = myTriangle.Get() #function transformed, 
> take no parameters, return 3 ints
> 
> Note: it's exatcly the same for the Coord() method of the class gp_Pnt:
> - In C++:
>     Standard_Real X;
>     Standard_Real Y;
>     Standard_Real Z;
>     myPoint.Coord(X,Y,Z);
> - In Python:
>     X, Y, Z = myPoint.Coord()
> 
> Sorry for this very technical point, but you could have been confused if 
> reading OpenCascade documentation and trying to use methods that take 
> Standard_Integer or Standard_Real parameters by reference.
> 
> Best Regards,
> 
> Thomas
> 
> 
> 
> 


_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to