ben lipkowitz a écrit :
> let's see if my mail makes it to the list this time..
Well, it seems that you are blacklisted. Did you report this to gna team?
>
> I have successfully built and installed pythonOCC on debian, yay! Now
> I'm testing to see if it works. The minimal example cylinder.py
> appears to have bit-rotted. I had to make these changes to get it to
> work:
>
> am I doing it right?
Yes, you're absolutely right. You have many solutions to import OCC modules.
1st possibility:
from OCC import *
i = IGESControl_Controller()
2nd possibility:
from OCC.IGESControl import *
i = IGESControl_Controller()
3rd possibility:
import OGG.IGESControl
i = OCC.IGESControl.IGESControl_Controller()
4th:
from OCC import IGESControl
i = IGESControl.IGESControl_Controller()
My preference goes to the 2nd solution. Avoid the first (*all* modules
are loaded). Third is too long. The 4th introduces a kind of redundancy
in the expression. Something more pythonic would be (see my previous mail):
from OCC import IGESControl
i = IGESControl.Controller()
Best regards,
Thomas
>
> --- cylinder.py.old 2009-03-27 00:11:04.000000000 -0500
> +++ cylinder.py 2009-03-27 00:09:12.000000000 -0500
> @@ -35,7 +35,9 @@
>
> import os
> import math
> +from OCC import gp
> from OCC import BRepPrimAPI
> +from OCC import IGESControl
> #
> # Make the 1st cylinder
> #
> @@ -44,14 +46,14 @@
> #
> # Make the 2nd cylinder
> #
> -cyl2 =
> BRepPrimAPI.BRepPrimAPI_MakeCylinder(OCC.gp_Ax2(OCC.gp_Pnt(200,200,0),OCC.gp_Dir(0,0,1)),40,110,210*math.pi/180)
>
>
> +cyl2 =
> BRepPrimAPI.BRepPrimAPI_MakeCylinder(gp.gp_Ax2(gp.gp_Pnt(200,200,0),gp.gp_Dir(0,0,1)),40,110,210*math.pi/180)
>
>
> cyl2_shape = cyl2.Shape()
> #
> # Export result to IGES file
> #
> -i = OCC.IGESControl_Controller()
> +i = IGESControl.IGESControl_Controller()
> i.Init()
> -iges_writer = OCC.IGESControl_Writer()
> +iges_writer = IGESControl.IGESControl_Writer()
> iges_writer.AddShape(cyl1_shape)
> iges_writer.AddShape(cyl2_shape)
> iges_writer.Write("./cylinder.iges")
>
>
_______________________________________________
Pythonocc-users mailing list
[email protected]
https://mail.gna.org/listinfo/pythonocc-users