Hi,
I'm trying to build a minimal example for my problem. It's about "extruding"
the open ends of a closed surface normal to its ends. I cannot use the Prism
function however, because the ends of my closed surface do not lie in a plane.
The idea is to cycle through the edges of the surface, and use the
BRepOffsetAPI_MakeThickSolid function to "extrude" the open ends normal to its
spanned surface, which may be a curved surface.
For test purposes I use a cylinder, open at both ends (even though the ends of
the cylinder do lie in a plane in this test case).
I've tried to create this cylinder, and "extrude" it with the
BRepOffsetAPI_MakeThickSolid function. When using the PrismFace as an argument
to that function, it seems to work fine (see code below). However, I have to
cycle through the edges of my surface to create that face in the first place,
and when using the edgeFace created from the wire of the edge, it doesn't seem
to do anything (see commented line).
I've noticed that the two edges are equal (see print function), but the wires
made from them aren't! Is this the source of my problem? Any suggestions on how
to solve this? Thanks!
Regards,
Balint
import OCC.TopoDS
from OCC.Utils.Topology import Topo
from OCC.TopTools import *
import math
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 (the closed surface):
centerCircle = OCC.gp.gp_Pnt(hubRadius-epsilon, 0, 0.5)
myAX2 = OCC.gp.gp_Ax2(centerCircle,OCC.gp.gp_Dir(1, 0, 0))
circle = OCC.gp.gp_Circ(myAX2, radius)
Edge2 = OCC.BRepBuilderAPI.BRepBuilderAPI_MakeEdge(circle, 0,
2.0*math.pi).Edge()
ExistingWire = OCC.BRepBuilderAPI.BRepBuilderAPI_MakeWire(Edge2).Wire()
PrismFace = OCC.BRepBuilderAPI.BRepBuilderAPI_MakeFace(ExistingWire).Shape()
length = OCC.gp.gp_Vec(shroudRadius-hubRadius+2.0*epsilon, 0, 0)
bladeSurface = OCC.BRepPrimAPI.BRepPrimAPI_MakePrism(ExistingWire,
length).Shape()
display.DisplayShape(bladeSurface)
topoBlade = OCC.Utils.Topology.Topo(bladeSurface)
topoBlade.number_of_shells()
bladeFace = topoBlade.faces().next()
## Getting the desired edge from the closed surface:
edges = []
for edge in topoBlade.edges_from_face(bladeFace):
edge.Reverse()
edges.append(edge)
print Edge2.IsEqual(edges[1]) # These edges are equal!
## Creating wire and face
edgeWire = OCC.BRepBuilderAPI.BRepBuilderAPI_MakeWire(edges[1]).Wire()
# The wires made from the equal edges are not equal, not even same!
print edgeWire.IsSame(ExistingWire)
edgeFace = OCC.BRepBuilderAPI.BRepBuilderAPI_MakeFace(edgeWire).Shape()
shapes = TopTools_ListOfShape()
## Creating the "extruded surface" does work:
thick_solid = OCC.BRepOffsetAPI.BRepOffsetAPI_MakeThickSolid(PrismFace, shapes,
0.1, 0.01).Shape()
## Doesn't seem to do anything:
#thick_solid = OCC.BRepOffsetAPI.BRepOffsetAPI_MakeThickSolid(edgeFace, shapes,
0.1, 0.01).Shape()
display.DisplayShape(thick_solid)
start_display()
--
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
_______________________________________________
Pythonocc-users mailing list
[email protected]
https://mail.gna.org/listinfo/pythonocc-users