Jump to content

Take properties from selected object


aboychuk
 Share

Recommended Posts

Hi everybody.

I am new to lisp, so I need your help.

I have a diagram with different lines. I need to select each line separately and change a color and a line weight of it.

I have one problem right now.

 

here is the example of my selection set line

 

(setq ssLine (ssget "X"(list (cons 0 "LWpolyline")(cons 8 "0")(cons 62 253))))

 

I want to keep everything the same except the last CONS (cons 62 253). I want it to take a value of a color from a object that I will select in my drawing.

First, I need some command or variable to prompt me to select a line. After that, I need my selection set to change the last cons from color 222 to a color of the selected object.

 

Thank you,

 

AB

Link to comment
Share on other sites

Consider this example perhaps:

 

(defun c:test ( / e )

 (if
   (and
     (setq e (car (entsel "\nSelect LWPolyine: ")))
     (eq "LWPOLYLINE" (cdr (assoc 0 (entget e))))
   )
   (sssetfirst nil
     (ssget "_X"
       (list
         (cons 0 "LWPOLYLINE")
         (cons 8 "0")
         (cond ( (assoc 62 (entget e)) ) ( (cons 62 256) ))
       )
     )
   )
 )
 
 (princ)
)

Link to comment
Share on other sites

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
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.

 Share

×
×
  • Create New...