Guest Posted September 16, 2022 Posted September 16, 2022 (edited) Quote Edited March 29, 2023 by Remco Koedoot Quote
Tharwat Posted September 16, 2022 Posted September 16, 2022 What's the need in moving objects from position to the same position ? although if objects on locked layer then that won't work. Also when you set a new system variable then you need to set it back as it was. Quote
Guest Posted September 16, 2022 Posted September 16, 2022 (edited) Quote Edited March 29, 2023 by Remco Koedoot Quote
Steven P Posted September 16, 2022 Posted September 16, 2022 cmdecho.... it is nice to reset system variables like cmdecho back to the starting point after you have done all you need to do, that way the user can continue with the same setting as before for example: (setq Cmdecho_Old (getvar 'cmdecho)) ;; get variable setting (setvar 'cmdecho 0) ;; new variable setting .... all your code here...... (setvar 'cmdecho Cmdecho_Old) ;; reset variable to starting point This works well for a single variable change, MHUPP had a good example maybe 6 weeks if you want to change several using mapcar and lists (noting that you will want to put a similar reset in any error functions) Quote
BIGAL Posted September 16, 2022 Posted September 16, 2022 A similar approach to set or reset Vars (setq vars (list '("insunits" 6) '("Insunitsdefsource" 6) '("INSUNITSDEFTARGET" 6)'("lunits" 2)'("luprec" 3)'("aunits" 1) )) (foreach var vars (setvar (car var)(cadr var)) ) You can add the existing setting in the list (setq vars (list '("insunits" 6 (getvar 'insunits)) '("Insunitsdefsource" 6 (getvar Insunitsdefsource)) '("INSUNITSDEFTARGET" 6 (getvar 'INSUNITSDEFTARGET)) '("lunits" 2 (getvar 'lunits))'("luprec" 3 (getvar 'luprec))'("aunits" 1 (getvar 'aunits)) )) So at end rest back to original. (setvar (car var)(caddr var)) 1 Quote
StevJ Posted September 18, 2022 Posted September 18, 2022 (edited) This might do what you want. ;Posted by rkmcswain 06FEB2006 ;cadtutor.net/forum/showthread.php?5713-Change-Object-Color ;Post 2 ; "This defines a function for each color (1-255). So command 1 will change ; color to red, command 2 will change color to yellow, and so on." (defun CHANGECOLOR (color / ss1) (setq ss1 (ssget)) (command "._chprop" ss1 "" "p" "c" color "") ) (setq i 1) (while (<= i 254) (eval (read (strcat "(defun c:" (itoa i) (chr 40) (chr 41) "(CHANGECOLOR " (itoa i) "))") ) ) (setq i (1+ i)) ) Steve Edited September 18, 2022 by StevJ Spellin errers Quote
mhupp Posted September 18, 2022 Posted September 18, 2022 @Remco Koedoot Don't think anyone has told you but please use the <> button when posting code. Quote
Guest Posted September 23, 2022 Posted September 23, 2022 (edited) Quote Edited March 29, 2023 by Remco Koedoot Quote
BIGAL Posted September 25, 2022 Posted September 25, 2022 Does it works for elements in blocks and attributes? Did you try it ? Quote
Guest Posted September 26, 2022 Posted September 26, 2022 (edited) On 9/25/2022 at 3:18 AM, BIGAL said: Edited March 29, 2023 by Remco Koedoot Quote
mhupp Posted September 26, 2022 Posted September 26, 2022 (edited) You cant just change the colors of selected blocks. if they are anywhere else in the drawing they will be changed also. best to have the entity's in the block set to bylayer. then change it to a layer that is red. or you could use this on the selected blocks giving them unique names. https://www.cadtutor.net/forum/topic/76007-make-block-reference-names-unqiue/?do=findComment&comment=600502 store those name and then change all those entity's to red. Edited September 26, 2022 by mhupp Quote
Guest Posted September 27, 2022 Posted September 27, 2022 (edited) Quote Edited March 29, 2023 by Remco Koedoot Quote
BIGAL Posted September 27, 2022 Posted September 27, 2022 (edited) Why save them ? If you use ssget just save in a variable will still be there till dwg is closed. (setq a!b@c$d%E^ (ssget Edited September 27, 2022 by BIGAL Quote
Guest Posted September 27, 2022 Posted September 27, 2022 (edited) Quote Edited March 29, 2023 by Remco Koedoot 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.