Hello Balint,
happy to hear you're into pythonocc.
i think you're heading for RSI if you type so much!
pythonocc is more pythonic than you think ;)
here's a cleaned up version;

import math
from OCC.Utils.Construct import *
from OCC.Display.SimpleGui import *
display, start_display, add_menu, add_function_to_menu = init_display()

shroudRadius = 3.0
hubRadius = 1.0
radius = 0.2
epsilon = 1.0e-1

## Creating circle and making cylinder:
centerCircle = gp_Pnt(hubRadius-epsilon, 0, 0.5)
myAX2 = gp_Ax2(centerCircle,gp_Dir(1, 0, 0))
circle = gp_Circ(myAX2, radius)

Edge2 = make_edge(circle, 0, 2.0*math.pi)
ExistingWire = make_wire(Edge2)
PrismFace = make_face(ExistingWire)

length = gp_Vec(shroudRadius-hubRadius+2.0*epsilon, 0, 0)

bladeSurface = make_prism(PrismFace, length)
bladeSurface = make_prism(ExistingWire, length)
#display.DisplayShape(bladeSurface)
topoBlade = Topo(bladeSurface)
topoBlade.number_of_shells()
bladeFace = topoBlade.faces().next()

## Getting the desired edge:
edges = []
for edge in topoBlade.edges_from_face(bladeFace):
       edge.Reverse()
       edges.append(edge)

## Creating wire and face
edgeWire = make_wire(edges[1])
edgeFace = make_face(find_plane_from_shape(edgeWire).Pln(), # gp_Pln
on which the wire lies
                     edgeWire)

display.DisplayShape(edgeFace)

# debuggin' heaven; the GUI is active but you can still use ipython
# to inspect the program!
# import ipdb;ipdb.set_trace()
start_display()

But in all fairness, what is there not to like about this succinct version?

from OCC.Utils.Construct import *
from OCC.Display.SimpleGui import *
display, start_display, add_menu, add_function_to_menu = init_display()

from OCC.BRepPrimAPI import *
cyl = BRepPrimAPI_MakeCylinder(10,1).Shape() # length, height
faces = Topo(cyl).faces()
faces.next()
f = faces.next()
display.DisplayShape(f)
start_display()

Take care,

-jelle

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

Reply via email to