Message 1 of 4
Help with selection confirmation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
For my code below the first section for preselected entities works as intended, but using ssget in the second section requires the user to confirm the selection. The attached image shows how the code wants the user to continue selecting objects (or enter) after an object is selected
I'd like the user to:
- Run the command
- Select the entity
- Have layer of the selected entity be set to current without confirmation
Any ideas?
thanks in advance
(defun c:TEC (/ ss ent entLayer)
(vl-load-com)
(setvar "CMDECHO" 0)
;; First check for preselected entities
(if (setq ss (ssget "_I"))
(progn
(setq ent (ssname ss 0))
(setq entLayer (cdr (assoc 8 (entget ent))))
(command "_.layer" "_set" entLayer "")
(princ (strcat "\nCurrent layer set to: " entLayer))
)
;; If no preselection, prompt for selection
(if (setq ss (ssget))
(progn
(setq ent (ssname ss 0))
(setq entLayer (cdr (assoc 8 (entget ent))))
(command "_.layer" "_set" entLayer "")
(princ (strcat "\nCurrent layer set to: " entLayer))
)
(princ "\nNo object selected.")
)
)
(setvar "CMDECHO" 1)
(princ)
)