Fix FirstVertexOnCurve(edge): use MakeVertexOnCurve() instead of

KindOfShape() to find the EDGE beginning
This commit is contained in:
eap 2013-03-12 11:28:32 +00:00
parent 1303d07964
commit dbd3054f4f

View File

@ -276,15 +276,15 @@ def AssureGeomPublished(mesh, geom, name=''):
## Return the first vertex of a geomertical edge by ignoring orienation ## Return the first vertex of a geomertical edge by ignoring orienation
def FirstVertexOnCurve(edge): def FirstVertexOnCurve(edge):
from geompy import SubShapeAll, ShapeType, KindOfShape, PointCoordinates from geompy import SubShapeAll, ShapeType, MakeVertexOnCurve, PointCoordinates
vv = SubShapeAll( edge, ShapeType["VERTEX"]) vv = SubShapeAll( edge, ShapeType["VERTEX"])
if not vv: if not vv:
raise TypeError, "Given object has no vertices" raise TypeError, "Given object has no vertices"
if len( vv ) == 1: return vv[0] if len( vv ) == 1: return vv[0]
info = KindOfShape(edge) v0 = MakeVertexOnCurve(edge,0.)
xyz = info[1:4] # coords of the first vertex xyz = PointCoordinates( v0 ) # coords of the first vertex
xyz1 = PointCoordinates( vv[0] ) xyz1 = PointCoordinates( vv[0] )
xyz2 = PointCoordinates( vv[1] ) xyz2 = PointCoordinates( vv[1] )
dist1, dist2 = 0,0 dist1, dist2 = 0,0
for i in range(3): for i in range(3):
dist1 += abs( xyz[i] - xyz1[i] ) dist1 += abs( xyz[i] - xyz1[i] )