Page 1 of 1

scalebar in shapeplot

Posted: Fri Sep 09, 2011 4:55 am
by tine
Dear all,

I would like to add a scalebar in my shapeplot before exporting it to a postscript. How could I do this?

Thanks a lot, Martine

Re: scalebar in shapeplot

Posted: Fri Sep 09, 2011 10:24 am
by ted
Create a section with known length. If you want to get fancy, cap it at each end with short sections at right angles, like so
|_____|
Assign values to these symbolic constants
BARX, BARY, BARL, CAPL
which are, respectively, the x,y coords of the origin of the scalebar, length of the scalebar, and length of the end caps. Then this code will do what you want:

Code: Select all

create scalebar, endcaps[2]
for i=0,1 {
  connect endcap[i](0), scalebar(i)
}
scalebar {
  pt3dclear()
  pt3dadd(BARX, BARY, 0, 1)
  pt3dadd(BARX + BARL, BARY, 0, 1)
}
for i=0,1 endcap[i] {
  pt3dclear()
  pt3dadd(0, 0, 0, 1)
  pt3dadd(0, CAPL, 0, 1)
}