heathera Posted December 19, 2013 Posted December 19, 2013 I have many TQ files for OS mapping etc these are labelled TQ3456 etc. I used to use a lsp where i would type TQ and click within Autocad and it would place the correct TQ tile where ever i click. i have lost the lsp and cant seem to find it anywhere on the net?? any ideas would be much appreciated Quote
MSasu Posted December 19, 2013 Posted December 19, 2013 it would place the correct TQ tile where ever i click. Which is the relation that link "the correct" TQ file to the picked point? Quote
heathera Posted December 19, 2013 Author Posted December 19, 2013 each TQ CAD file is sitting in the correct X/Y already..... so if i block in each TQ file comes in the correct location. but i have to do one at a time. i would like just to click on screen and the block comes in. Quote
eldon Posted December 19, 2013 Posted December 19, 2013 There is probably a little bit more to it than the OP appreciates. The attached pdf will give the basic numbers for the Ordnance Survey Grid system. (Oops, the pdf is too big for the forum file capacity, probably because there are too many pretty pictures. I will try and provide the information otherwise.) I will keep a watch to field any further queries, but I expect that by clicking in space, the coordinate and therefore the corresponding one kilometre tile can be inserted. Quote
heathera Posted December 19, 2013 Author Posted December 19, 2013 well like i say the TQtile are already sitting in the correct X/Y within CAD. so the chain would be something like Click the mouse > looks up what block contains those X/Y iv clicked in > inserts that block with those X/Y. Quote
ReMark Posted December 19, 2013 Posted December 19, 2013 Didn't you ask this very same question over at the AutoDesk Discussion Groups back in September of this year? Quote
eldon Posted December 19, 2013 Posted December 19, 2013 That is all very well, but for those not used to the Ordnance Survey, the first two letters of the tile have to be translated into numbers. The tiles are to an all number coordinate. Quote
eldon Posted December 19, 2013 Posted December 19, 2013 Something like this. Picture taken from the grid explanation for schools (which seems to be the only source with the numbers shown) Shows the 100 kilometre squares and coordinates. Quote
eldon Posted December 19, 2013 Posted December 19, 2013 Since the OP has disappeared without giving the technical detail for a desired lisp, I thought that I should provide a few figures. The Ordnance Survey grid is a metric one. Normally coordinates have six significant figures in both the Easting and the Northings (with zeros filling up the leftmost spaces if necessary). Working from the left hand side, the first digit of the Easting and the first digit of the Northing are combined to give a two character code. In the OP's case TQ, (which is near London). The next two digits of both the Easting and the Northing are then added to this to give a six character reference for the kilometre square. So the OS tile labelled TQ3456, would in fact have the coordinate 534000mE, 156000mN for the bottom left hand corner of the tile. I suspect that the OP is hoping for a lisp so that when clicking in the drawing, the coordinates would be read of the pick point, and with a simple bit of arithmetic, the correct tile would be inserted. As all the tiles are drawn to the proper coordinates, the insertion point for every case would be at 0,0. Of course, Architects usually work in millimetres, so that an Architect factor of 1000 must be allowed for, if necessary. Quote
ymg3 Posted December 19, 2013 Posted December 19, 2013 Here are two assoc list that you might find useful in your quest. ymg ;; Assoc list for ngr Source: http://support.promap.co.uk/entries/27310638-National-Grid-Reference-Coordinate-Conversion ; ;; Example of use (cdr (assoc "NN" ngrl)) -> (2 7) ; (setq ngrl '(("HL" . (0 12))("HM" . (1 12))("HN" . (2 12))("HO" . (3 12))("HP" . (4 12))("JL" . (5 12))("JM" . (6 12))("JN" . (7 12)) ("HQ" . (0 11))("HR" . (1 11))("HS" . (2 11))("HT" . (3 11))("HU" . (4 11))("JQ" . (5 11))("JR" . (6 11))("JS" . (7 11)) ("HV" . (0 10))("HW" . (1 10))("HX" . (2 10))("HY" . (3 10))("HZ" . (4 10))("JV" . (5 10))("JW" . (6 10))("JX" . (7 10)) ("NA" . (0 9))("NB" . (1 9))("NC" . (2 9))("ND" . (3 9))("NE" . (4 9))("OA" . (5 9))("OB" . (6 9))("OC" . (7 9)) ("NF" . (0 )("NG" . (1 )("NH" . (2 )("NJ" . (3 )("NK" . (4 )("OF" . (5 )("OG" . (6 )("OH" . (7 ) ("NL" . (0 7))("NM" . (1 7))("NN" . (2 7))("NO" . (3 7))("NP" . (4 7))("OL" . (5 7))("OM" . (6 7))("ON" . (7 7)) ("NQ" . (0 6))("NR" . (1 6))("NS" . (2 6))("NT" . (3 6))("NU" . (4 6))("OQ" . (5 6))("OR" . (6 6))("OS" . (7 6)) ("NV" . (0 5))("NW" . (1 5))("NX" . (2 5))("NY" . (3 5))("NZ" . (4 5))("OV" . (5 5))("OW" . (6 5))("OX" . (7 5)) ("SA" . (0 4))("SB" . (1 4))("SC" . (2 4))("SD" . (3 4))("SE" . (4 4))("TA" . (5 4))("TB" . (6 4))("TC" . (7 4)) ("SF" . (0 3))("SG" . (1 3))("SH" . (2 3))("SJ" . (3 3))("SK" . (4 3))("TF" . (5 3))("TG" . (6 3))("TH" . (7 3)) ("SL" . (0 2))("SM" . (1 2))("SN" . (2 2))("SO" . (3 2))("SP" . (4 2))("TL" . (5 2))("TM" . (6 2))("TN" . (7 2)) ("SQ" . (0 1))("SR" . (1 1))("SS" . (2 1))("ST" . (3 1))("SU" . (4 1))("TQ" . (5 1))("TR" . (6 1))("TS" . (7 1)) ("SV" . (0 0))("SW" . (1 0))("SX" . (2 0))("SY" . (3 0))("SZ" . (4 0))("TV" . (5 0))("TW" . (6 0))("TX" . (7 0))) ) ;; Assoc list for ngr Source: http://support.promap.co.uk/entries/27310638-National-Grid-Reference-Coordinate-Conversion ; ;; Example of use (cdr (assoc '(1 0) digl)) -> "SW" ; (setq digl '(((0 12) . "HL") ((1 12) . "HM") ((2 12) . "HN") ((3 12) . "HO") ((4 12) . "HP") ((5 12) . "JL") ((6 12) . "JM") ((7 12) . "JN") ((0 11) . "HQ") ((1 11) . "HR") ((2 11) . "HS") ((3 11) . "HT") ((4 11) . "HU") ((5 11) . "JQ") ((6 11) . "JR") ((7 11) . "JS") ((0 10) . "HV") ((1 10) . "HW") ((2 10) . "HX") ((3 10) . "HY") ((4 10) . "HZ") ((5 10) . "JV") ((6 10) . "JW") ((7 10) . "JX") ((0 9) . "NA") ((1 9) . "NB") ((2 9) . "NC") ((3 9) . "ND") ((4 9) . "NE") ((5 9) . "OA") ((6 9) . "OB") ((7 9) . "OC") ((0 . "NF") ((1 . "NG") ((2 . "NH") ((3 . "NJ") ((4 . "NK") ((5 . "OF") ((6 . "OG") ((7 . "OH") ((0 7) . "NL") ((1 7) . "NM") ((2 7) . "NN") ((3 7) . "NO") ((4 7) . "NP") ((5 7) . "OL") ((6 7) . "OM") ((7 7) . "ON") ((0 6) . "NQ") ((1 6) . "NR") ((2 6) . "NS") ((3 6) . "NT") ((4 6) . "NU") ((5 6) . "OQ") ((6 6) . "OR") ((7 6) . "OS") ((0 5) . "NV") ((1 5) . "NW") ((2 5) . "NX") ((3 5) . "NY") ((4 5) . "NZ") ((5 5) . "OV") ((6 5) . "OW") ((7 5) . "OX") ((0 4) . "SA") ((1 4) . "SB") ((2 4) . "SC") ((3 4) . "SD") ((4 4) . "SE") ((5 4) . "TA") ((6 4) . "TB") ((7 4) . "TC") ((0 3) . "SF") ((1 3) . "SG") ((2 3) . "SH") ((3 3) . "SJ") ((4 3) . "SK") ((5 3) . "TF") ((6 3) . "TG") ((7 3) . "TH") ((0 2) . "SL") ((1 2) . "SM") ((2 2) . "SN") ((3 2) . "SO") ((4 2) . "SP") ((5 2) . "TL") ((6 2) . "TM") ((7 2) . "TN") ((0 1) . "SQ") ((1 1) . "SR") ((2 1) . "SS") ((3 1) . "ST") ((4 1) . "SU") ((5 1) . "TQ") ((6 1) . "TR") ((7 1) . "TS") ((0 0) . "SV") ((1 0) . "SW") ((2 0) . "SX") ((3 0) . "SY") ((4 0) . "SZ") ((5 0) . "TV") ((6 0) . "TW") ((7 0) . "TX")) ) Quote
eldon Posted December 19, 2013 Posted December 19, 2013 Here are two assoc list that you might find useful in I hope the OP appreciates your expertise. Quote
ymg3 Posted December 19, 2013 Posted December 19, 2013 Eldon, Not so sure about that, he went AWOL ymg Quote
ymg3 Posted December 19, 2013 Posted December 19, 2013 And here is a function from coordinates to tile name. It needs the assoc list digl from post #10 (defun coordtotile (p / l e n) (setq l (list (fix (/ (car p) 100000)) (fix (/ (cadr p) 100000))) e (fix (/ (- (car p) (* (car l) 100000)) 1000)) n (fix (/ (- (cadr p) (* (cadr l) 100000)) 1000)) ) (strcat (cdr (assoc l digl)) (itoa e) (itoa n)) ) Quote
ymg3 Posted December 20, 2013 Posted December 20, 2013 (edited) Yet another routine to transform a point to a tile name. This one does it without the need of the assoc list. (defun floor (x) (if (minusp (rem x 1)) (- (fix x) 1) (fix x))) ;; Translated to Autolisp from a C# routine by Alex@UEA ; ;; http://www.codeproject.com/Articles/13577/GPS-Deriving-British-Ordnance-Survey-Grid-Referenc ; (defun pt->ngr (p / eing ex ning nx tm) (setq ex (/ (car p) 500000) nx (/ (cadr p) 500000) tm (+ (- (floor ex) (* 5 (floor nx))) 17) nx (* 5 (- nx (floor nx))) ex (+ (- 20 (* 5 (floor nx)) (floor (* 5 (- ex (floor ex)))))) ex (if (> ex 7) (1+ ex) ex) tm (if (> tm 7) (1+ tm) tm) eing (rtos (car p) 2 0) ning (rtos (cadr p) 2 0) eing (substr eing 2 (- (strlen eing) 4)) ning (substr ning 2 (- (strlen ning) 4)) ) (strcat (chr (+ tm 65)) (chr (+ ex 65)) eing ning) ) Edited December 20, 2013 by ymg3 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.