Dayananda Posted July 29, 2022 Posted July 29, 2022 (setq set1 (ssget "_C" p1 p2)) All objects inside this selection set want to send layer 0 Quote
Scoutr4 Posted July 29, 2022 Posted July 29, 2022 Like this? (defun c:example () (setq x (ssget '((0 . "LINE,LWPOLYLINE,INSERT,ARC")))) (repeat (setq y (sslength x)) (setq ss (ssname x (setq y (1- y)))) (command "_.CHANGE" ss "" "_Properties" "_LAyer" "0" "")) ) 1 Quote
mhupp Posted July 29, 2022 Posted July 29, 2022 @Scoutr4 You don't need to irradiate thought the selection set you just reference it to change them all at the same time. (defun c:example (/ ss) (if (setq set1 (ssget "_C" p1 p2)) (command "_.CHPROP" set1 "" "_LAyer" "0" "")) (prompt "\nNothing Selected") ) ) 1 1 Quote
Steven P Posted July 29, 2022 Posted July 29, 2022 more than one way to do anything, above is neater, this is another (useful if you want to change any other properties of the selection) (setq set1 (ssget "_C" p1 p2)) (setq acount 0) (while (< acount (sslength set1)) (setq MyEntList (entget (ssname set1 acount))) (entmod (subst (cons 8 "0") (assoc 8 MyEntList) MyEntList)) (entupd (ssname set1 acount)) (setq acount (+ acount 1)) (princ MyEnt) ) 1 1 Quote
mhupp Posted July 29, 2022 Posted July 29, 2022 Yes their is no "wrong" way to do things if it works. But it usually boils down to people arguing over if its the most efficient. 1 Quote
Steven P Posted July 29, 2022 Posted July 29, 2022 It is fractions of a second each way which in a working day you can loose chatting to someone at the coffee machine - if it works, then it works and I reckon that shows you have gone the 'right' way whatever that was. 1 Quote
mhupp Posted July 29, 2022 Posted July 29, 2022 100% dealing with small selection sets is always negligible. when selection sets get bigger the differences balloons out of control. and people are usually impatient when it comes to commands thinking everything is instant. I made a command that took a 30+ min process down to sub 30 sec and the person using it thought it didn't work because it was taking too long and would canceled the command and then do it the manual 30+ min way. and why not if their isn't a progress output how long are you suppose to wait? This is an example of why doing the same task with different code. And was really impressed with my code until i saw the rest of the results. https://www.cadtutor.net/forum/topic/74035-copy-multiple-text-contents-to-nearest-text-multiples/ On 11/21/2021 at 10:02 AM, Isaac26a said: Well I tested the programs in a much larger scale (about 1550) text for each selection set and the results were ronjonp 0:04.07 Tharwat 0:16.27 Mhupp 1:16.88 Mine took 2:50:15 1 Quote
Isaac26a Posted July 29, 2022 Posted July 29, 2022 Quote 25 minutes ago, mhupp said: why not if their isn't a progress output how long are you suppose to wait? I think I have seen people using progress bars, although I'd like to know how to use them myself. I've seen your progress in lisp and you do much better things than when you started posting. You have helped me many times. Thanks 1 Quote
mhupp Posted July 29, 2022 Posted July 29, 2022 (edited) Thank you for the kind words. Yeah seen a few also but they output to the command prompt so you get a bunch of spam. i just put in an alert "This process could take up to 1 minute to complete" and then plays a sound with another alert when done. Edited July 29, 2022 by mhupp Quote
BIGAL Posted July 30, 2022 Posted July 30, 2022 Progress bars are built in as a Acet command. One example. Moving away from using (command and using (entmake speeds up processing immensly but like mhupp changing 1000+ objects 4 times takes like 2 minutes compared to say 4 hours. Still working on progress bar a cheats way something is happening is (princ x) then add 1 to x so see 12345................ ;; EXAMPLE LISP SHORT VERSION (defun c:test(/ progress) (defun progressbar (a b c d) (cond ((= 0 a) (acet-ui-progress-init d 100) (setq c 0) ) ((= 1 a) (setq c (+ (/ 100.0 b) c)) (acet-ui-progress-safe c) ) ((= 2 a) (acet-ui-progress-done) ) ) c ) (setq repeatvariable 10000) (setq progress (Progressbar 0 repeatvariable progress "Processing:")) ;Create the progress bar, total length is repeatvariable or 10000 (repeat repeatvariable (setq progress (Progressbar 1 repeatvariable progress "")) ;arg (a) is set to 1 and (d) can be blank here ;code to repeat in here ) (Progressbar 2 0 0 "") ;arg(a) is set to 2 to close the progress bar, arg (b), (c) & (d) can be blanks ) 3 Quote
BIGAL Posted July 31, 2022 Posted July 31, 2022 Another example, having some fun getting to work correct as inside a complex modify objects 1000+ (acet-ui-progress-init "Redoing blocks :" (length lst2)) (setq i 0) (foreach val lst2 .................................. (setq i (1+ i)) (acet-ui-progress-safe i) ) ; foreach (acet-ui-progress-done) Quote
Isaac26a Posted July 31, 2022 Posted July 31, 2022 On 7/29/2022 at 7:57 PM, BIGAL said: Progress bars are built in as a Acet command. One example I'll look into it as soon I have some free time, thank you for your help Bigal, you're always great at helping others. 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.