Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/25/2020 in all areas

  1. If your old like me then you will remember digitiser's, the advantage was you have commands on the pad. As well as a-z 0-9. yes you can still buy them I played with one from Aldi like $35 but very small. if you have dual screens have you typed "Keyboard" in the windows CMD bottom left may be usefull. Found speech recognition in Win10 inside MS-word worked well. I have not tried to set it up with Autocad 2020 but did so like 30 years ago so its not new technology.Fun to swear at it. as you remap speech to other words.
    2 points
  2. Benchmarking .. done for 512 iterations. Sorted from fastest. Statement Increment Time(ms) Normalize Relative -------------------------------------------------------------------------------- (FOO2 ATTDATA) 512 1218 1218 1.46 (_PAIR ATTDATA) 512 1781 1781 1.00 -------------------------------------------------------------------------------- Of course, calling the function with the list already sorted is even better (..for benchmark purpose. In reality you will sort it only once, inside or outside the function) (setq attdata (vl-sort attdata (function (lambda ( a b ) (if (= (car a) (car b)) (> (cadr a) (cadr b)) (> (car a) (car b))))))) (length attdata) -> 100 (defun foo3 ( l / m r ) (while l (setq m (list (car l)) l (cdr l) ) (while (and l (= (caar m) (caar l)) (= (cadar m) (cadar l))) (setq m (cons (car l) m) l (cdr l) ) ) (setq r (cons (reverse m) r)) ) ) Benchmarking .. done for 2048 iterations. Sorted from fastest. Statement Increment Time(ms) Normalize Relative -------------------------------------------------------------------------------- (FOO3 ATTDATA) 2048 1078 1078 7.19 (_PAIR ATTDATA) 512 1938 7752 1.00 -------------------------------------------------------------------------------- And some minor improvement, using PBE's idea with local variables instead of multiple (caar m) and (cadar m) (defun foo4 ( l / m r a b) (while l (setq m (list (car l)) a (caar m) b (cadar m) l (cdr l) ) (while (and l (= a (caar l)) (= b (cadar l))) (setq m (cons (car l) m) l (cdr l) ) ) (setq r (cons (reverse m) r)) ) ) Benchmarking ... done for 2048 iterations. Sorted from fastest. Statement Increment Time(ms) Normalize Relative -------------------------------------------------------------------------------- (FOO4 ATTDATA) 2048 1015 1015 7.70 (FOO3 ATTDATA) 2048 1110 1110 7.05 (_PAIR ATTDATA) 512 1955 7820 1.00 -------------------------------------------------------------------------------- _$ Benchmarking .. done for 2048 iterations. Sorted from fastest. Statement Increment Time(ms) Normalize Relative -------------------------------------------------------------------------------- (FOO4 ATTDATA) 2048 1016 1016 1.09 (FOO3 ATTDATA) 2048 1110 1110 1.00 --------------------------------------------------------------------------------
    1 point
  3. Hi Trying to test the speed for different approaches, I've added a recursive way (defun f (l q) ( (if q vl-remove-if-not vl-remove-if) (function (lambda (a) (and (= (car a) (caar l)) (= (cadr a) (cadar l)) ) ) ) l ) ) (defun group_1 (lst) (if lst (cons (f lst T) (group_1 (f lst nil))) ) ) Speed test result Benchmarking ... done for 8192 iterations. Sorted from fastest. Statement Increment Time(ms) Normalize Relative -------------------------------------------------------------------------------- (_PAIR ATTDATA) 8192 1172 1172 16.44 (GROUP_1 ATTDATA) 4096 1187 2374 8.11 (FOO ATTDATA (QUOTE (LAMBDA (A B) (A...) 512 1204 19264 1.00 -------------------------------------------------------------------------------- And for a longer, scrambled list (setq attdata nil) (repeat 100 (setq attdata (cons (list (rem (dos_random) 5) (rem (dos_random) 5) (chr (+ 65 (rem (dos_random) 26))) ) attdata ) ) ) Benchmarking ... done for 512 iterations. Sorted from fastest. Statement Increment Time(ms) Normalize Relative -------------------------------------------------------------------------------- (_PAIR ATTDATA) 512 1799 1799 40.02 (GROUP_1 ATTDATA) 256 1719 3438 20.94 (FOO ATTDATA (QUOTE (LAMBDA (A B) (A...) 8 1125 72000 1.00 -------------------------------------------------------------------------------- Well done PBE!
    1 point
  4. @Mugna101 Some more food for thought (defun c:test (/ coord layer linelayer pgl ph ptl text textlayer) ;; Check if layer exists .. no need to get all that input then not have the layer you need ;) (if (tblobjname "layer" (setq textlayer (strcat (setq linelayer (getvar "clayer")) "-txt"))) ;; Validate entries before moving on (if (and (setq coord (getpoint "\nPick coordinate point: ")) (setq text (getpoint "\nPick text location: ")) (setq pgl (getreal "\nGround level: ")) (setq ph (getreal "\nHeight: ")) (setq ptl (- pgl ph)) ) (progn ;; Removed 'tl' 'gl' 'h' 'ans' vars. They only are used once. (setvar "clayer" textlayer) (command "mleader" coord text (strcat "G.L=" (rtos pgl 2 2) "\nH=" (rtos ph 2 2) "\nT.L=" (rtos ptl 2 2)) ) (setvar "clayer" linelayer) ) ) (print "Layer needed not found!") ) (princ) )
    1 point
  5. Hopefully the following would be clear to you to know how the process goes on. ;; this is to get the current active layer name (setq LINELAYER (getvar "clayer")) ;; the variable 'lay' holds the target layer name that you are after along wiht the ;; suffix '-txt' and the function tblsearch with "LAYER" is to check if the target ;; layer is already existed into current opened drawing, if it is not, then the alert ;; function would interfere to popup a message with the target layer name to the user ;; to let them know what's going on and this is much better than just exit quitely. (if (tblsearch "LAYER" (setq lay (strcat LINELAYER "-txt"))) (progn ;; so if the layer is already existed then (setvar "clayer" lay) ;; set the target layer name current (command "mleader" COORD TEXT ANS) ;; then draw the Mleader (setvar "clayer" LINELAYER) ;; and finally reset the layer active layer name current. ) (alert (strcat "layer name < " lay " > is unavailable in this drawing ")) ;; here is the message with the unavailable layer name )
    1 point
×
×
  • Create New...