
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello - I have seen several posts about using selection sets to change line color but I have not been able to locate any posts that discuss how to change the layer of selected entities.
I tried to modify some code that I found that changed an entities color but I was not able run the code. I keep getting "error: bad argument type: numperp: nil" which I know means that I am passing an empty argument. I am just new to Autolisp so I don't know which argument is empty.
defun selectionlisp1 ( / sset check)
;load the visual lisp extensions
(vl-load-com)
(setq adoc (vla-get-activedocument
(vlax-get-acad-object)))
(vlax-for a (vla-get-activeselectionset adoc)
;check for selection
(while
;get the entity and entity name
(setq sset (car (entsel)))
;convert to vl object
(setq sset (vlax-ename->vla-object sset))
;check if the entity has a color property
;and it can be updated
(progn
;change it's layer
(vlax-put-layer subent "0")
)
);if
);while
(princ)
);defun
Any additional insight on using the ssget function would also be helpful. There are a lot of tutorials about passing an selection set function but very few about modifying the selected entities (that I have found).
Thanks in advanced for your time!
Solved! Go to Solution.