Jump to content

Recommended Posts

Posted

Hello together,

 

I thought I have a simple task to perform, but unfortunately it turned out to be more difficult than I expected:

 

I have in my lisp a code to select all elements in a drawing using (setq tbe (ssget "_X")), what I want to do now is to change the color of the selectionset to have a certain color. This color is defined by the RGB code 102,204,255.

 

Unfortunately I was not able to find the important hint to solve it by my own :(

 

Thank you for your help,

Ament

Posted

Try this:

(defun c:foo (/ s)
 (if (setq s (ssget ":L"))
   (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
     (entmod (append (entget e) '((420 . 6737151))))
   )
 )
 (princ)
)

Posted

Hi nahhphuc, unfortunately I'm a beginner in LISP and not able to identify the relevant code in the threat you mentioned :( Could you give me the hint?

Posted

To convert the rgb use lee-mac function

 

;; RGB -> True  -  Lee Mac
;; Args: r,g,b - [int] Red, Green, Blue values
(defun LM:RGB->True ( r g b )
   (logior (lsh (fix r) 16) (lsh (fix g)  (fix b))
)

;(setq rgb (LM:RGB->True R G B))
(setq rgb (LM:RGB->True 102 204 255))
;6737151

  • 2 months later...
Posted

Wonderfull. It works just perfectly for me. Thanks again!

Posted

autocad chprop command would change the selected item color. is I am missing something ?

Posted
autocad chprop command would change the selected item color. is I am missing something ?

 

 

yeah , you're missing all the fun of trying to use no command calls :D

Posted
:) haha big time learner here. i know only some functions of autolisp activex functions are like god for me i know its there but don't know how to use hahahaha (need your tips for better learning). thank you
Posted
yeah , you're missing all the fun of trying to use no command calls :D

 

 

No, thats called Masochism. :lol:

Posted
No, thats called Masochism. :lol:

 

 

my wife doesn't like commands too haha

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...