not exactly what you want but i already had an example for that.
probably this was for teaching something to someone and may be using unnecessary c_trace calls, so there is room for a lot of improvement.
click on an image to build a building, higlight a building and press DEL to delete
press R to rotate while building.f9 toggles debug mode. you cant build on sloppy surface and on other buildings. red means you can not build, green means you can build.
http://depot.acknexturk.com/rtsbuild.rar