Author Topic: QRCODE for Autocad  (Read 10183 times)

0 Members and 1 Guest are viewing this topic.

Sam

  • Bull Frog
  • Posts: 201
QRCODE for Autocad
« on: March 02, 2013, 01:49:51 AM »
QR CODE FOR AUTOCAD - TEST PAGE
QR code string Generator
This form will return a sequence of 0 and 1 representing each line of the QR code.
It can be easily used to create the QR code image in various applications.
The string always begins with 1111111, representing the upper black border of the upper-left square.

text to encode :     
QR code Block symbol
This is a Block sample generated in Autocad with a lisp routine.
It contains optimized Solids.
Cadorg_QRCode.dwg

Plan Sample with QR code
In my AutoCAD document management software, I have implemented QR codes in title blocks.
It has 2 functions :
- Check the validity of a specific plan by scanning its QR code, for example with an Iphone.
- The user will be instantly warned if the plan has been updated and redirected to the online set of PDF plans.

Check it out :

Code - Auto/Visual Lisp: [Select]
  1. ;*********************************************************************************
  2. ; QRCODE for Autocad
  3. ; © 2010 swisscad / Ian Vogel
  4. ; V 0.91 released 2010.08.22
  5. ;http://www.xcad.ch/tests/qrcode.html
  6. ;*********************************************************************************
  7. (defun c:QRcode ( / str)
  8. ((not (validstr (setq str (getstring "\nEnter Text to encode :" T))))
  9. (princ "\nNo text entered")
  10. )
  11. ((QRcode str (setq name "QRCode") 0)
  12. (command "_REGENALL")
  13. (command "_INSERT" name)
  14. )
  15. )
  16. )
  17. (defun QRcode (string ; string to encode
  18. blockname ; name of the block to create
  19. options ; options
  20. ; 1 = perform only if block already exists
  21. / QR x y startx row)
  22. ((not (validstr blockname)))
  23. ((or (zerop (logand 1 options))
  24. (tblsearch "BLOCK" blockname)
  25. )
  26. (setq baseurl "www.xcad.ch/tests/getqrcode.php")
  27. (setq QR (valstr (gethttp (strcat baseurl"%3Fstring=" (urlencode (urlencode string))) 0)))
  28. ((eq (substr QR 1 6) "111111");response OK
  29. (setq QR (split QR "-")
  30. y 0)
  31. ;create Qrcode block
  32. (entmake (list '(0 . "BLOCK")
  33. (cons 2 blockname)
  34. '(8 . "0")
  35. '(70 . 0)
  36. '(10 0.0 0.0 0.0)
  37. )
  38. )
  39. (foreach row QR
  40. (setq x 0)
  41. (while (< x (strlen row))
  42. ((eq (substr row (1+ x) 1) "1")
  43. ;memorize start of filled zone
  44. (if (not startx)(setq startx x))
  45. (if (not (eq (substr row (+ x 2) 1) "1"))
  46. ;draw filled zone
  47. (entmake (list (cons 0 "SOLID")
  48. (cons 8 "0")
  49. (cons 10 (list startx y))
  50. (cons 11 (list (1+ x) y))
  51. (cons 12 (list startx (1- y)))
  52. (cons 13 (list (1+ x)(1- y)))
  53. (cons 62 0)
  54. )
  55. )
  56. (setq startx nil)
  57. ))
  58. ))
  59. (setq x (1+ x))
  60. )
  61. (setq y (1- y))
  62. )
  63. ;end of block
  64. (setq bl_a (entmake '((0 . "ENDBLK"))))
  65. )
  66. )
  67. T
  68. ))
  69. )
  70. ;-------------------------------------------------------
  71. ; Get an URL
  72. ;-------------------------------------------------------
  73. (defun gethttp (lien
  74. opt
  75. / fi line tmp util content)
  76. )
  77. )
  78. (if (eq (vla-isurl util lien) :vlax-true)
  79. (vl-catch-all-apply
  80. (list util lien 'tmp :vlax-true)
  81. )
  82. )
  83. (princ "\nError getting http file.")
  84. (setq fi (open tmp "r")
  85. content "")
  86. (while (setq line (read-line fi))
  87. (setq content (strcat content line))
  88. )
  89. (close fi)
  90. )
  91. )
  92. )
  93. content
  94. )
  95. ;-------------------------------------------------------
  96. ; Turn any var to a string
  97. ;-------------------------------------------------------
  98. (defun valstr (val)
  99. ((eq (type val) 'STR) val)
  100. ((eq (type val) 'REAL) (rtos val))
  101. ((eq (type val) 'INT) (itoa val))
  102. (T "")
  103. ))
  104. ;-------------------------------------------------------
  105. ; Check that a string is not empty
  106. ;-------------------------------------------------------
  107. (defun validstr (str / tmp)
  108. (if (> (strlen (setq tmp (trim (valstr str)))) 0) tmp nil)
  109. )
  110. ;-------------------------------------------------------
  111. ; Remove blanks from a string
  112. ;-------------------------------------------------------
  113. (defun trim ( str / )
  114. (setq str (valstr str))
  115. (while (eq (substr str 1 1) " ")
  116. (setq str (substr str 2))
  117. )
  118. (while (and (> (strlen str) 1)
  119. (eq (substr str (strlen str) 1) " ")
  120. )
  121. (setq str (substr str 1 (- (strlen str) 1)))
  122. )
  123. str
  124. )
  125.  
  126. ;-------------------------------------------------------
  127. ; Split a string
  128. ;-------------------------------------------------------
  129. (defun split (str ; string to split
  130. cara ; separator
  131. / n portion xstring seqstart chrcode portion)
  132. ((and (= (type str)(type cara) 'STR)(eq (strlen cara) 1))
  133. (setq n -1 seqstart 1 chrcode (ascii cara))
  134. (while (setq n (vl-string-position chrcode str (+ n 1) nil))
  135. (setq xstring (append xstring (list (substr str seqstart (- n seqstart -1)))) seqstart (+ n 2) )
  136. )
  137. (setq xstring (append xstring (list (substr str seqstart))))
  138. (if xstring xstring (list str))
  139. )
  140. ((= (type str)(type cara) 'STR)
  141. (setq portion "" n 1)
  142. (if (<= (strlen cara) (strlen str))
  143. (while (<= n (strlen str))
  144. (if (eq (substr str n (strlen cara)) cara)
  145. (setq xstring (append xstring (list portion))
  146. portion ""
  147. n (+ n (strlen cara))
  148. )
  149. (setq portion (strcat portion (substr str n 1))
  150. n (+ 1 n)
  151. )
  152. )
  153. )
  154. (if (or (> (strlen portion) 0)
  155. (eq (substr str (abs (- (strlen str)(strlen cara) -1))) cara)
  156. )
  157. (setq xstring (append xstring (list portion)))
  158. )
  159. )
  160. (setq xstring (list str))
  161. )
  162. (if xstring xstring (list ""))
  163. )
  164. (T (list nil))
  165. )
  166. )
  167. ;----------------------------------------------------------
  168. ; See PHP function
  169. ; http://ch2.php.net/manual/fr/function.htmlentities.php
  170. ;----------------------------------------------------------
  171. (defun urlencode (str / result n len )
  172. (setq result ""
  173. n 1
  174. len (strlen str))
  175.  
  176. (while (<= n len)
  177. (setq result (strcat result (urlenc (substr str n 1)))
  178. n (+ 1 n))
  179. )
  180. result
  181. )
  182. (defun urlenc (ch)
  183. ((eq ch " ") " ");+
  184. ((eq ch "!") "%21")
  185. ((eq ch "\"") "%22")
  186. ((eq ch "#") "%23")
  187. ((eq ch "$") "%24")
  188. ((eq ch "%") "%25")
  189. ((eq ch "&") "%26")
  190. ((eq ch "'") "%27")
  191. ((eq ch "(") "%28")
  192. ((eq ch ")") "%29")
  193. ((eq ch "*") "%2A")
  194. ((eq ch "+") "%2B")
  195. ((eq ch ",") "%2C")
  196. ((eq ch "/") "%2F")
  197. ((eq ch ":") "%3A")
  198. ((eq ch ";") "%3B")
  199. ((eq ch "<") "%3C")
  200. ((eq ch "=") "%3D")
  201. ((eq ch ">") "%3E")
  202. ((eq ch "?") "%3F")
  203. ((eq ch "@") "%40")
  204. ((eq ch "[") "%5B")
  205. ((eq ch "\\") "%5C")
  206. ((eq ch "]") "%5D")
  207. ((eq ch "^") "%5E")
  208. ((eq ch "`") "%60")
  209. ((eq ch "{") "%7B")
  210. ((eq ch "|") "%7C")
  211. ((eq ch "}") "%7D")
  212. ((eq ch "~") "%7E")
  213. ((eq ch "‘") "%91")
  214. ((eq ch "’") "%92")
  215. ((eq ch "ˇ") "%A1")
  216. ((eq ch "˘") "%A2")
  217. ((eq ch "Ł") "%A3")
  218. ((eq ch "¤") "%A4")
  219. ((eq ch "Ą") "%A5")
  220. ((eq ch "¦") "%A6")
  221. ((eq ch "§") "%A7")
  222. ((eq ch "¨") "%A8")
  223. ((eq ch "©") "%A9")
  224. ((eq ch "Ş") "%AA")
  225. ((eq ch "«") "%AB")
  226. ((eq ch "¬") "%AC")
  227. ((eq ch "­") "%AD")
  228. ((eq ch "®") "%AE")
  229. ((eq ch "Ż") "%AF")
  230. ((eq ch "°") "%B0")
  231. ((eq ch "±") "%B1")
  232. ((eq ch "˛") "%B2")
  233. ((eq ch "ł") "%B3")
  234. ((eq ch "´") "%B4")
  235. ((eq ch "µ") "%B5")
  236. ((eq ch "¶") "%B6")
  237. ((eq ch "·") "%B7")
  238. ((eq ch "¸") "%B8")
  239. ((eq ch "ą") "%B9")
  240. ((eq ch "ş") "%BA")
  241. ((eq ch "»") "%BB")
  242. ((eq ch "Ľ") "%BC")
  243. ((eq ch "˝") "%BD")
  244. ((eq ch "ľ") "%BE")
  245. ((eq ch "ż") "%BF")
  246. ((eq ch "Ŕ") "%C0")
  247. ((eq ch "Á") "%C1")
  248. ((eq ch "Â") "%C2")
  249. ((eq ch "Ă") "%C3")
  250. ((eq ch "Ä") "%C4")
  251. ((eq ch "Ĺ") "%C5")
  252. ((eq ch "Ć") "%C6")
  253. ((eq ch "Ç") "%C7")
  254. ((eq ch "Č") "%C8")
  255. ((eq ch "É") "%C9")
  256. ((eq ch "Ę") "%CA")
  257. ((eq ch "Ë") "%CB")
  258. ((eq ch "Ě") "%CC")
  259. ((eq ch "Í") "%CD")
  260. ((eq ch "Î") "%CE")
  261. ((eq ch "Ď") "%CF")
  262. ((eq ch "Đ") "%D0")
  263. ((eq ch "Ń") "%D1")
  264. ((eq ch "Ň") "%D2")
  265. ((eq ch "Ó") "%D3")
  266. ((eq ch "Ô") "%D4")
  267. ((eq ch "Ő") "%D5")
  268. ((eq ch "Ö") "%D6")
  269. ((eq ch "×") "%D7")
  270. ((eq ch "Ř") "%D8")
  271. ((eq ch "Ů") "%D9")
  272. ((eq ch "Ú") "%DA")
  273. ((eq ch "Ű") "%DB")
  274. ((eq ch "Ü") "%DC")
  275. ((eq ch "Ý") "%DD")
  276. ((eq ch "Ţ") "%DE")
  277. ((eq ch "ß") "%DF")
  278. ((eq ch "ŕ") "%E0")
  279. ((eq ch "á") "%E1")
  280. ((eq ch "â") "%E2")
  281. ((eq ch "ă") "%E3")
  282. ((eq ch "ä") "%E4")
  283. ((eq ch "ĺ") "%E5")
  284. ((eq ch "ć") "%E6")
  285. ((eq ch "ç") "%E7")
  286. ((eq ch "č") "%E8")
  287. ((eq ch "é") "%E9")
  288. ((eq ch "ę") "%EA")
  289. ((eq ch "ë") "%EB")
  290. ((eq ch "ě") "%EC")
  291. ((eq ch "í") "%ED")
  292. ((eq ch "î") "%EE")
  293. ((eq ch "ď") "%EF")
  294. ((eq ch "đ") "%F0")
  295. ((eq ch "ń") "%F1")
  296. ((eq ch "ň") "%F2")
  297. ((eq ch "ó") "%F3")
  298. ((eq ch "ô") "%F4")
  299. ((eq ch "ő") "%F5")
  300. ((eq ch "ö") "%F6")
  301. ((eq ch "÷") "%F7")
  302. ((eq ch "ř") "%F8")
  303. ((eq ch "ů") "%F9")
  304. ((eq ch "ú") "%FA")
  305. ((eq ch "ű") "%FB")
  306. ((eq ch "ü") "%FC")
  307. ((eq ch "ý") "%FD")
  308. ((eq ch "ţ") "%FE")
  309. ((eq ch "˙") "%FF")
  310. (T ch)
  311. )
  312. )
  313. (princ "\nType QRCODE")
  314. ;*********************************************************************************
Every time we waste electricity, we put our planet's future in the dark. Let's turn around our attiude and start saving power and our planet, before it's too late
http://www.theswamp.org/donate.html

pBe

  • Bull Frog
  • Posts: 402
Re: QRCODE for Autocad
« Reply #1 on: March 02, 2013, 06:06:41 AM »
Have not tested the result yet, but i like the  idea Sam. Nice  :)
Thank you for sharing




Sam

  • Bull Frog
  • Posts: 201
Re: QRCODE for Autocad
« Reply #2 on: March 02, 2013, 06:26:57 AM »
Have not tested the result yet, but i like the  idea Sam. Nice  :)
Thank you for sharing
dear sir,

this lisp not written me. ( and i am not lisp programmer  i am just user)
thx for original writer.
i am just sharing this lisp

Every time we waste electricity, we put our planet's future in the dark. Let's turn around our attiude and start saving power and our planet, before it's too late
http://www.theswamp.org/donate.html

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: QRCODE for Autocad
« Reply #3 on: March 02, 2013, 06:43:38 AM »
A slightly optimized set of helper functions:
Code - Auto/Visual Lisp: [Select]
  1. (defun valstr  (Val)
  2.   (cond
  3.     ((listp Val)
  4.      (strcat
  5.        "("
  6.        (substr (apply 'strcat
  7.                       (mapcar '(lambda (v) (strcat " " (valstr v))) Val))
  8.                2)
  9.        ")"))
  10.     ((= (type Val) 'Real) (rtos Val 2 16))
  11.     ((= (type Val) 'Str) (vl-prin1-to-string Val))
  12.     (t (vl-princ-to-string Val))))
  13.  
  14. (defun trim (source) (vl-string-trim " " source))
  15.  
  16. (defun split  (source chars)
  17.   (mapcar (function (lambda (m n) (substr source (+ 2 m) (- n m 1))))
  18.           (cons -1
  19.                 (setq chars
  20.                        (vl-sort
  21.                          (apply
  22.                            'append
  23.                            (mapcar
  24.                              (function (lambda (code / result n)
  25.                                          (setq n -1)
  26.                                          (while (setq n (vl-string-position
  27.                                                           code
  28.                                                           source
  29.                                                           (1+ n)))
  30.                                            (setq result (cons n result)))
  31.                                          result))
  32.                              (vl-string->list chars)))
  33.                          '<)))
  34.           (append chars (list (strlen source)))))
  35.  
  36. (defun urlencode  (source / codes)
  37.   (setq codes (mapcar 'cons
  38.                       '(33   34   35   36   37   38   39   40   41   42
  39.                         43   44   47   58   59   60   61   62   63   64
  40.                         91   92   93   94   96   123  124  125  126  145
  41.                         146  161  162  163  164  165  166  167  168  169
  42.                         170  171  172  173  174  175  176  177  178  179
  43.                         180  181  182  183  184  185  186  187  188  189
  44.                         190  191  192  193  194  195  196  197  198  199
  45.                         200  201  202  203  204  205  206  207  208  209
  46.                         210  211  212  213  214  215  216  217  218  219
  47.                         220  221  222  223  224  225  226  227  228  229
  48.                         230  231  232  233  234  235  236  237  238  239
  49.                         240  241  242  243  244  245  246  247  248  249
  50.                         250  251  252  253  254  255)
  51.                       '("%21"    "%22"    "%23"    "%24"    "%25"
  52.                         "%26"    "%27"    "%28"    "%29"    "%2A"
  53.                         "%2B"    "%2C"    "%2F"    "%3A"    "%3B"
  54.                         "%3C"    "%3D"    "%3E"    "%3F"    "%40"
  55.                         "%5B"    "%5C"    "%5D"    "%5E"    "%60"
  56.                         "%7B"    "%7C"    "%7D"    "%7E"    "%91"
  57.                         "%92"    "%A1"    "%A2"    "%A3"    "%A4"
  58.                         "%A5"    "%A6"    "%A7"    "%A8"    "%A9"
  59.                         "%AA"    "%AB"    "%AC"    "%AD"    "%AE"
  60.                         "%AF"    "%B0"    "%B1"    "%B2"    "%B3"
  61.                         "%B4"    "%B5"    "%B6"    "%B7"    "%B8"
  62.                         "%B9"    "%BA"    "%BB"    "%BC"    "%BD"
  63.                         "%BE"    "%BF"    "%C0"    "%C1"    "%C2"
  64.                         "%C3"    "%C4"    "%C5"    "%C6"    "%C7"
  65.                         "%C8"    "%C9"    "%CA"    "%CB"    "%CC"
  66.                         "%CD"    "%CE"    "%CF"    "%D0"    "%D1"
  67.                         "%D2"    "%D3"    "%D4"    "%D5"    "%D6"
  68.                         "%D7"    "%D8"    "%D9"    "%DA"    "%DB"
  69.                         "%DC"    "%DD"    "%DE"    "%DF"    "%E0"
  70.                         "%E1"    "%E2"    "%E3"    "%E4"    "%E5"
  71.                         "%E6"    "%E7"    "%E8"    "%E9"    "%EA"
  72.                         "%EB"    "%EC"    "%ED"    "%EE"    "%EF"
  73.                         "%F0"    "%F1"    "%F2"    "%F3"    "%F4"
  74.                         "%F5"    "%F6"    "%F7"    "%F8"    "%F9"
  75.                         "%FA"    "%FB"    "%FC"    "%FD"    "%FE"
  76.                         "%FF")))
  77.   (apply
  78.     'strcat
  79.     (mapcar
  80.       (function (lambda (elt / found)
  81.                   (cond ((setq found (assoc elt codes)) (cdr found))
  82.                         (t (chr elt)))))
  83.       (vl-string->list source))))
A bit less code  ;) , and in some cases should run faster.
« Last Edit: March 02, 2013, 06:47:58 AM by irneb »
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

owenwengerd

  • Bull Frog
  • Posts: 451
Re: QRCODE for Autocad
« Reply #4 on: March 02, 2013, 11:18:57 AM »
this lisp not written me. ( and i am not lisp programmer  i am just user)
thx for original writer.

Did the copyright owner give you permission to post this?

VovKa

  • Water Moccasin
  • Posts: 1628
  • Ukraine
Re: QRCODE for Autocad
« Reply #5 on: March 02, 2013, 01:17:24 PM »
having seen the topic subject i thought it would be the original QR generator. sad...
some time ago i even tried to write my own, but quit

pBe

  • Bull Frog
  • Posts: 402
Re: QRCODE for Autocad
« Reply #6 on: March 03, 2013, 07:38:33 AM »

this lisp not written me. ( and i am not lisp programmer  i am just user)
thx for original writer.
i am just sharing this lisp

.....i thought it would be the original QR generator. sad...
I see, now is there a QRCODE reader program for cad?  :laugh:

A slightly optimized set of helper functions:
...... A bit less code  ;) , and in some cases should run faster.

Nice, i'm almost tempted to write one myself but it would be somewhat similar with what you have.

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: QRCODE for Autocad
« Reply #7 on: March 03, 2013, 07:51:30 AM »
having seen the topic subject i thought it would be the original QR generator. sad...

I was also quite disappointed to see that the AutoLISP code is simply retrieving the QR code data using a php script.  :|

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: QRCODE for Autocad
« Reply #8 on: March 03, 2013, 12:27:42 PM »
I was also quite disappointed to see that the AutoLISP code is simply retrieving the QR code data using a php script.  :|
Same here. At least the author made his own custom PHP to return a text file containing 0's and 1's so the lisp can figure out where to place the 2d solids.

Then I thought, what if one of those online QR generators could save to WMF instead? But no, there is none - at least none that I can find. They all save to raster images, mostly PNG. The closest I came to was saving to SVG, but only through post codes in a html form, so no way of lisp sending the requirements through a url.

Looks like the whole QR system needs re-implementing inside lisp. Or possibly use one of the API libraries and add it to DotNet/ObjectARX.

Anyhow, I've actually optimized the urlencoding of UTF8 even more  ;)
Code - Auto/Visual Lisp: [Select]
  1. (defun int2hex2 (int / result mod)
  2.   (while (> int 0)
  3.     (setq result (cons (cond ((< (setq mod (rem int 16)) 10) (+ mod 48))
  4.                              (t (+ mod 55)))
  5.                        result)
  6.           int (/ int 16)))
  7.   (while (< (length result) 2) (setq result (cons 48 result)))
  8.   (vl-list->string result))
  9.  
  10. (defun str->url (source)
  11.                                      (cond ((or (<= 65 elt 90) (<= 97 elt 122) (member elt '(45 46 95 126))) (chr elt))
  12.                                            ((= elt 32) "+")
  13.                                            (t (strcat "%" (int2hex2 elt))))))
  14.                          (vl-string->list source))))
Should perform a lot faster and use less RAM
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: QRCODE for Autocad
« Reply #9 on: March 03, 2013, 04:29:09 PM »
Nice one Irné!

I couldn't resist joining in - here is my variation of your str->url function (using some of your code)  :-)
Code - Auto/Visual Lisp: [Select]
  1. (defun int2hex ( n )
  2.     (cond
  3.         (   (< n 10) (chr (+ n 48)))
  4.         (   (< n 16) (chr (+ n 55)))
  5.         (   (strcat (int2hex (/ n 16)) (int2hex (rem n 16))))
  6.     )
  7. )
  8.  
  9. (defun str->url ( s )
  10.     (apply 'strcat
  11.         (mapcar
  12.             (function
  13.                 (lambda ( a )
  14.                     (cond
  15.                         (   (or (<= 65 a 90) (<= 97 a 122) (member a '(45 46 95 126))) (chr a))
  16.                         (   (= a 32) "+")
  17.                         (   (< a 16) (strcat "%0" (int2hex a)))
  18.                         (   (strcat "%" (int2hex a)))
  19.                     )
  20.                 )
  21.             )
  22.             (vl-string->list s)
  23.         )
  24.     )
  25. )

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: QRCODE for Autocad
« Reply #10 on: March 04, 2013, 05:46:46 AM »
Thanks Lee! And as usual your recursive routines are awesome!
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: QRCODE for Autocad
« Reply #11 on: March 04, 2013, 07:45:47 AM »
Thanks Irné!  8-)

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: QRCODE for Autocad
« Reply #12 on: March 04, 2013, 10:31:17 AM »
From what I can tell, the QR code is generated in bit-blocks, depending on the style, density, etc.  Maybe somebody could create a series of dynamic blocks to represent the different configurations, since dynamic blocks can be programmatically manipulated?
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

AIberto

  • Guest
Re: QRCODE for Autocad
« Reply #13 on: January 27, 2015, 08:58:38 AM »
 I use SAM' code can generate  Qr code , I use mobile scan ,It's unreadable codes.


Nice one Irné!

I couldn't resist joining in - here is my variation of your str->url function (using some of your code)  :-)
Code - Auto/Visual Lisp: [Select]
  1. (defun int2hex ( n )
  2.     (cond
  3.         (   (< n 10) (chr (+ n 48)))
  4.         (   (< n 16) (chr (+ n 55)))
  5.         (   (strcat (int2hex (/ n 16)) (int2hex (rem n 16))))
  6.     )
  7. )
  8.  
  9. (defun str->url ( s )
  10.     (apply 'strcat
  11.         (mapcar
  12.             (function
  13.                 (lambda ( a )
  14.                     (cond
  15.                         (   (or (<= 65 a 90) (<= 97 a 122) (member a '(45 46 95 126))) (chr a))
  16.                         (   (= a 32) "+")
  17.                         (   (< a 16) (strcat "%0" (int2hex a)))
  18.                         (   (strcat "%" (int2hex a)))
  19.                     )
  20.                 )
  21.             )
  22.             (vl-string->list s)
  23.         )
  24.     )
  25. )

Lee, Can you give me a complete routine ? Many Thanks!

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: QRCODE for Autocad
« Reply #14 on: January 27, 2015, 10:23:36 AM »
See this topic, a bit more updated.


http://www.theswamp.org/index.php?topic=48557.0