adaptation patch OCC 6.8.0 et probleme prolongation wire

This commit is contained in:
Paul RASCLE 2014-12-10 16:37:01 +01:00
parent 41f1b7bad2
commit 2475437e5d
4 changed files with 33 additions and 6 deletions

View File

@ -60,7 +60,7 @@ class faceGauche_2(fissureGenerique):
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2FissCoupe.brep"), "BREP") shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2FissCoupe.brep"), "BREP")
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [14, 7]) geompy.UnionIDs(fondFiss, [14, 9])
geompy.addToStudy( shellFiss, 'shellFiss' ) geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )

View File

@ -2,6 +2,7 @@
import logging import logging
from geomsmesh import geompy from geomsmesh import geompy
from orderEdgesFromWire import orderEdgesFromWire
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# --- prolongation d'un wire par deux segments tangents # --- prolongation d'un wire par deux segments tangents
@ -12,8 +13,11 @@ def prolongeWire(aWire, extrem, norms, long):
logging.info("start") logging.info("start")
if geompy.NumberOfEdges(aWire) > 1: if geompy.NumberOfEdges(aWire) > 1:
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"]) edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"])
uneSeuleEdge = False
else: else:
edges = [aWire] edges = [aWire]
uneSeuleEdge = True
edgesBout = []
for i, v1 in enumerate(extrem): for i, v1 in enumerate(extrem):
exts = [geompy.MakeTranslationVectorDistance(v1, norms[i], l) for l in (-long, long)] exts = [geompy.MakeTranslationVectorDistance(v1, norms[i], l) for l in (-long, long)]
dists = [(geompy.MinDistance(v, aWire), i , v) for i, v in enumerate(exts)] dists = [(geompy.MinDistance(v, aWire), i , v) for i, v in enumerate(exts)]
@ -22,8 +26,31 @@ def prolongeWire(aWire, extrem, norms, long):
#v2 = geompy.MakeTranslationVectorDistance(v1, norms[i], long) #v2 = geompy.MakeTranslationVectorDistance(v1, norms[i], long)
edge = geompy.MakeEdge(v1, v2) edge = geompy.MakeEdge(v1, v2)
edges.append(edge) edges.append(edge)
edgesBout.append(edge)
name = "extrem%d"%i name = "extrem%d"%i
#geompy.addToStudy(edge,name) geompy.addToStudy(edge,name)
wireProlonge = geompy.MakeWire(edges) try:
geompy.addToStudy(wireProlonge, "wireProlonge") wireProlonge = geompy.MakeWire(edges)
geompy.addToStudy(wireProlonge, "wireProlonge")
except:
logging.warning("probleme MakeWire, approche pas a pas")
if uneSeuleEdge:
edgelist = [aWire]
accessList = [0]
else:
edgelist, accessList = orderEdgesFromWire(aWire)
edge1 = edgelist[accessList[0]]
if geompy.MinDistance(edgesBout[0], edge1) < 1.e-4 :
i0 = 0
i1 = 1
else:
i0 = 1
i1 = 0
wireProlonge = edgesBout[i0]
for i in range(len(edgelist)):
wireProlonge = geompy.MakeWire([wireProlonge, edgelist[accessList[i]]])
geompy.addToStudy(wireProlonge, "wireProlonge_%d"%i)
wireProlonge = geompy.MakeWire([wireProlonge,edgesBout[i1]])
geompy.addToStudy(wireProlonge, "wireNonProlonge")
logging.warning("prolongation wire pas a pas OK")
return wireProlonge return wireProlonge

View File

@ -43,7 +43,7 @@ geomObj_3 = geompy.MakeCylinderRH(1450, 8000)
Cylinder_3 = geompy.MakeRotation(geomObj_3, OZ, 180*math.pi/180.0) Cylinder_3 = geompy.MakeRotation(geomObj_3, OZ, 180*math.pi/180.0)
Cut_1 = geompy.MakeCut(Partition_1, Cylinder_3) Cut_1 = geompy.MakeCut(Partition_1, Cylinder_3)
geompy.addToStudy( Cut_1, 'Cut_1' ) geompy.addToStudy( Cut_1, 'Cut_1' )
[faceFiss1] = geompy.SubShapes(Cut_1, [63]) [faceFiss1] = geompy.SubShapes(Cut_1, [61])
geompy.addToStudyInFather( Cut_1, faceFiss1, 'faceFiss1' ) geompy.addToStudyInFather( Cut_1, faceFiss1, 'faceFiss1' )
[Vertex_3,geomObj_4] = geompy.SubShapes(faceFiss1, [4, 5]) [Vertex_3,geomObj_4] = geompy.SubShapes(faceFiss1, [4, 5])
Cylinder_4 = geompy.MakeCylinderRH(2000, 4000) Cylinder_4 = geompy.MakeCylinderRH(2000, 4000)

View File

@ -43,7 +43,7 @@ objetSain = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
Rotation_1 = geompy.MakeRotation(Extrusion_1, OX, 180*math.pi/180.0) Rotation_1 = geompy.MakeRotation(Extrusion_1, OX, 180*math.pi/180.0)
Partition_2 = geompy.MakePartition([Rotation_1], [Extrusion_2], [], [], geompy.ShapeType["FACE"], 0, [], 0) Partition_2 = geompy.MakePartition([Rotation_1], [Extrusion_2], [], [], geompy.ShapeType["FACE"], 0, [], 0)
geompy.addToStudy( Partition_2, 'Partition_2' ) geompy.addToStudy( Partition_2, 'Partition_2' )
[FaceFissExtSimple] = geompy.SubShapes(Partition_2, [17]) [FaceFissExtSimple] = geompy.SubShapes(Partition_2, [13])
geompy.addToStudyInFather( Partition_2, FaceFissExtSimple, 'FaceFissExtSimple' ) geompy.addToStudyInFather( Partition_2, FaceFissExtSimple, 'FaceFissExtSimple' )
Plane_1 = geompy.MakePlaneLCS(None, 2000, 3) Plane_1 = geompy.MakePlaneLCS(None, 2000, 3)
FaceFissExtCoupe = geompy.MakePartition([FaceFissExtSimple], [Plane_1], [], [], geompy.ShapeType["FACE"], 0, [], 0) FaceFissExtCoupe = geompy.MakePartition([FaceFissExtSimple], [Plane_1], [], [], geompy.ShapeType["FACE"], 0, [], 0)