Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/05/2023 in all areas

  1. Thanx for reminding me again to this program Bigal but I can't install anything on work computer. PC (laptop) is scanned continuously, it sounds like a vacuum cleaner because of all the scanning going on. AutoCad (cloud based) crashes a few times a day , I suspect due to this scanning because most cpu time is used up by this process. I only find comfort in the fact all my colleagues suffer with me haha
    2 points
  2. Well, firstly, so many thanks to you because of the help of you. I really looked in the code of Lee-Mac, but maybe i didn't understand clearly the code of Lee. I will look it again. Thanks again.
    1 point
  3. This has become the most true statement I have come across in all of my days on any forum. ("I only find comfort in the fact all my colleagues suffer with me haha") Way to go RLX, you summarized our lives and explained many of our troubles so succinctly. If only others would realize that we too struggle with the same things on a daily basis, the CAD-world would be a little bit more gracious... [my vote for post of the year] ~Greg
    1 point
  4. @quangcongx3 I edited the above reply to add a number grouping function.
    1 point
  5. @quangcongx3 Did you really look into Lee's functions? ;; Round Multiple - Lee Mac ;; Rounds 'n' to the nearest multiple of 'm' (defun LM:roundm ( n m ) (* m (atoi (rtos (/ n (float m)) 2 0))) ) (setq s '(3998 3999 4010 3995 4005 4003)) (defun test (l p) (mapcar '(lambda (x) (LM:roundm x p) ) l ) ) Result: Command: (test s 5) (4000 4000 4010 3995 4005 4005) Command: (test s 10) (4000 4000 4010 4000 4010 4000) Your logic is mathematically flawed. If you round a number like 3995 by a tolerance of 5, it is going to return 3995, not 4000. If you round a number like 3998 by 10, your going to get 4000, not 4010. As for the grouping part, I am not great at list functions but I used another Lee Mac function to make it work: ;; Count Items - Lee Mac ;; Returns a list of dotted pairs detailing the number of ;; occurrences of each item in a supplied list. (defun LM:CountItems ( l / c l r x ) (while l (setq x (car l) c (length l) l (vl-remove x (cdr l)) r (cons (cons x (- c (length l))) r) ) ) (reverse r) ) ;; Groups duplicate items into sublists. (defun Groupn (l / c r x) (setq l (LM:CountItems l)) (foreach n l (if (> (setq c (cdr n)) 1) (progn (repeat c (setq x (cons (car n) x))) (setq r (cons x r) x nil) ) (setq r (cons (car n) r) x nil) ) ) (reverse r) ) Example: Command: (setq l1 (list 1 1 1 3 3 5 6 2 8 8 8)) (1 1 1 3 3 5 6 2 8 8 8) Command: (groupn l1) ((1 1 1) (3 3) 5 6 2 (8 8 8))
    1 point
×
×
  • Create New...