text translation

Discussion in 'AutoCAD' started by Jan-Mikael, Apr 14, 2004.

  1. Jan-Mikael

    Jan-Mikael Guest

    I want to translate textdatabase from "dos 850" to "ansi 1252". In previous versions of AutoCAD there was an arx-file called "dbtrans.arx" that allowed this to be made pretty easy. I can't understand why somebody would remove this option.. Now i have questionmarks in many drawings and no possibility to fix them..not that i know of anyway.
    Does anyone know how to solve this?

    thx
     
    Jan-Mikael, Apr 14, 2004
    #1
  2. Jan-Mikael

    mataeux Guest

    this works for TEXT objects
    will take some tweeking to work for MTEXT objects
    you may want to modify it to work on a selection set


    ;;;
    ;;; update text in DOS_850 format to use unicode
    ;;;
    (defun c:update850text(/ codepage translate ent lst txt new)
    (defun translate (code) (strcat"\\U+"(cdr(assoc code codepage))) )
    (setq codepage
    '(
    (32 . "0020")(33 . "0021")(34 . "0022")(35 . "0023")(36 .
    "0024")(37 . "0025")(38 . "0026")
    (39 . "0027")(40 . "0028")(41 . "0029")(42 . "002A")(43 .
    "002B")(44 . "002C")(45 . "002D")
    (46 . "002E")(47 . "002F")(48 . "0030")(49 . "0031")(50 .
    "0032")(51 . "0033")(52 . "0034")
    (53 . "0035")(54 . "0036")(55 . "0037")(56 . "0038")(57 .
    "0039")(58 . "003A")(59 . "003B")
    (60 . "003C")(61 . "003D")(62 . "003E")(63 . "003F")(64 .
    "0040")(65 . "0041")(66 . "0042")
    (67 . "0043")(68 . "0044")(69 . "0045")(70 . "0046")(71 .
    "0047")(72 . "0048")(73 . "0049")
    (74 . "004A")(75 . "004B")(76 . "004C")(77 . "004D")(78 .
    "004E")(79 . "004F")(80 . "0050")
    (81 . "0051")(82 . "0052")(83 . "0053")(84 . "0054")(85 .
    "0055")(86 . "0056")(87 . "0057")
    (88 . "0058")(89 . "0059")(90 . "005A")(91 . "005B")(92 .
    "005C")(93 . "005D")(94 . "005E")
    (95 . "005F")(96 . "0060")(97 . "0061")(98 . "0062")(99 .
    "0063")(100 . "0064")(101 . "0065")
    (102 . "0066")(103 . "0067")(104 . "0068")(105 . "0069")(106 .
    "006A")(107 . "006B")(108 . "006C")
    (109 . "006D")(110 . "006E")(111 . "006F")(112 . "0070")(113 .
    "0071")(114 . "0072")(115 . "0073")
    (116 . "0074")(117 . "0075")(118 . "0076")(119 . "0077")(120 .
    "0078")(121 . "0079")(122 . "007A")
    (123 . "007B")(124 . "007C")(125 . "007D")(126 . "007E")(128 .
    "00C7")(129 . "00FC")(130 . "00E9")
    (131 . "00E2")(132 . "00E4")(133 . "00E0")(134 . "00E5")(135 .
    "00E7")(136 . "00EA")(137 . "00EB")
    (138 . "00E8")(139 . "00EF")(140 . "00EE")(141 . "00EC")(142 .
    "00C4")(143 . "00C5")(144 . "00C9")
    (145 . "00E6")(146 . "00C6")(147 . "00F4")(148 . "00F6")(149 .
    "00F2")(150 . "00FB")(151 . "00F9")
    (152 . "00FF")(153 . "00D6")(154 . "00DC")(155 . "00F8")(156 .
    "00A3")(157 . "00D8")(158 . "00D7")
    (159 . "0192")(160 . "00E1")(161 . "00ED")(162 . "00F3")(163 .
    "00FA")(164 . "00F1")(165 . "00D1")
    (166 . "00AA")(167 . "00BA")(168 . "00BF")(169 . "00AE")(170 .
    "00AC")(171 . "00BD")(172 . "00BC")
    (173 . "00A1")(174 . "00AB")(175 . "00BB")(176 . "2591")(177 .
    "2592")(178 . "2593")(179 . "2502")
    (180 . "2524")(181 . "00C1")(182 . "00C2")(183 . "00C0")(184 .
    "00A9")(185 . "2563")(186 . "2551")
    (187 . "2557")(188 . "255D")(189 . "00A2")(190 . "00A5")(191 .
    "2510")(192 . "2514")(193 . "2534")
    (194 . "252C")(195 . "251C")(196 . "2500")(197 . "253C")(198 .
    "00E3")(199 . "00C3")(200 . "255A")
    (201 . "2554")(202 . "2569")(203 . "2566")(204 . "2560")(205 .
    "2550")(206 . "256C")(207 . "00A4")
    (208 . "00F0")(209 . "00D0")(210 . "00CA")(211 . "00CB")(212 .
    "00C8")(213 . "0131")(214 . "00CD")
    (215 . "00CE")(216 . "00CF")(217 . "2518")(218 . "250C")(219 .
    "2588")(220 . "2584")(221 . "00A6")
    (222 . "00CC")(223 . "2580")(224 . "00D3")(225 . "00DF")(226 .
    "00D4")(227 . "00D2")(228 . "00F5")
    (229 . "00D5")(230 . "00B5")(231 . "00FE")(232 . "00DE")(233 .
    "00DA")(234 . "00DB")(235 . "00D9")
    (236 . "00FD")(237 . "00DD")(238 . "00AF")(239 . "00B4")(240 .
    "00AD")(241 . "00B1")(242 . "2017")
    (243 . "00BE")(244 . "00B6")(245 . "00A7")(246 . "00F7")(247 .
    "00B8")(248 . "00B0")(249 . "00A8")
    (250 . "00B7")(251 . "00B9")(252 . "00B3")(253 . "00B2")(254 .
    "25A0")(255 . "00A0")
    )

    ent (car(nentsel "\nSelect text or attribute: "))
    lst (entget ent)
    txt (cdr(assoc 1 lst))
    new ""
    )
    (while(>(strlen txt)0)
    (setq new (strcat new (translate(ascii(substr txt 1 1))) )
    txt (substr txt 2)
    )
    )
    (entmod(subst(cons 1 new)(assoc 1 lst)lst))
    (princ)
    )
     
    mataeux, Apr 14, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.