How could I add a linear dimension

What should I define this point? point_on_dimension_line.
I set it to be like this:

#Add position dimension on top view
basepoint = x, y, z

originx = 0, y, z
Dimpointx = 0.5*x,y+40000,z

originy = x, 0, z
Dimpointy = x+2000,0.5*y,z

originz = x, y, 0
Dimpointz = x-2000,y,0.5*z

dimensionGx_id = rs.AddLinearDimension( originx, basepoint, Dimpointx )
dimensionGy_id = rs.AddLinearDimension( originy, basepoint, Dimpointy )
dimensionGz_id = rs.AddLinearDimension( originz, basepoint, Dimpointz )

But it wouldn’t work for the y direction, always appears as o length.

Not quite sure what you are trying to do. But this simple example works:

import rhinoscriptsyntax as rs
start_point = (5,5,0)
end_point = (15,5,0)
point_on_dimension_line = (15,7,0)
dimension_id = rs.AddLinearDimension(start_point, end_point, point_on_dimension_line)

Thank you so much Dale. I wanted to add dimension of the top view (XY plane), the width(Y) of a cube. But it always appears on the ZY plane. Is it possible to flip it 90 degree?