Message 1 of 12
How do you select drawing elements in AutoLISP?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am new to AutoLISP and programming. The following code is supposed to turn green any object I select, but it doesn't let me select anything. What is going on? Thanks.
(defun c:ChangeColorToGreen ()
(setq obj (car (entsel "\nSelect an object: "))) ; Prompt the user to select an object
(if obj
(progn
(setq color 3) ; Green color code
; Modify the object's properties to change its color to green
(if (setq oldProps (entget obj))
(progn
(setq newProps (subst (cons 62 color) (assoc 62 oldProps) oldProps))
(entmod newProps)
(redraw)
(princ "\nObject color changed to green.")
)
)
)
(princ "\nNo object selected. Nothing changed.")
)
(princ)
)