# About Distance between a plant and a line

hi everyone £¬
i want to compute the distance between a plant and a line

/////////////////////////
gp_Ax1 axis = GetAxis(aface1);
gp_Lin line1=gp_Lin(axis);
TopLoc_Location loc;
Handle(Geom_Surface) theSurf2 = BRep_Tool::Surface(aface2, loc);
Standard_Real distance = thePln2.Distance(line1);
return distance;
/////////////////////////////

the proble is £¬the distance always return 0 £¡£¡

who can help me£¿
what is the problem£¿

thank you very much£¡

Hi,
Problems can be different.
Try to locate it.
1) visualize both (or dump coordinates of both) to check that they are not coincident
2) if you are friendly with Draw environment use, please, command , which reports distance between shapes. Or check the command implementation and use obtained knowledge in your own example.
Good luck
Sergey

Sergey£¬

i solved the problem

////////
gp_Ax1 axis = GetAxis(aface1);
//gp_Lin line1=gp_Lin(axis);
gp_Pnt point1=axis.Location();
TopLoc_Location loc;
Handle(Geom_Surface) theSurf2 = BRep_Tool::Surface(aface2, loc);