The Curve attribute of an edge always returns the actual (untrimmed) geometry -- in your case the infinite line.
There are two ways to get the both end points of the edge:
Code: Select all
box.Edge1.firstVertex().Point
box.Edge1.lastVertex().Point
Code: Select all
segm=box.Edge1.Curve.trim(*box.Edge1.ParameterRange)
segm.StartPoint
segm.EndPoint
If an edge has reversed orientation then the edge's start and end points are swapped compared to the underlying geometry. So, in case it's important to consider the orientation of the edge you must pass True to the functions firstVertex/lastVertex.