Polyline change fra layer AM_0
I am trying to make a routine that could change all polylines in a drawing from layer AM_0 to 0. But i can't get i to work.(defun C:chgpllnul ( / pllist ) (setq pllist ((ssget '((8 . "AM_0") (0 . "Polyline")))(command "change" pllist "" "P" "LA" "0" "" ))))Please help!
Thx in advance. (0 . "Polyline")
or for both
(0 . "*POLYLINE")
(setq pllist ((ssget '((8 . "AM_0") (0 . "Polyline"))) I think this work
(defun C:chgpllnul (/ pllist slen sname entlst) (if (setq pllist (ssget '((8 . "AM_0") (0 . "*Polyline")))) (repeat (setq slen (sslength pllist)) (setq sname (ssname pllist (setq slen (1- slen)))) (entmod (subst (cons 8 "0") (assoc 8 (setq entlst (entget sname))) entlst ) ) ) ) (princ))
Neither #2 or #3 works.(using A2008) so ?
Without testing #3 myself (nothing jumps out to me as to why it wouldn't work?), you could always iterate the VLA ActiveSelectionSet Object, and use vla-put-layer Method as an alternative.
(defun C:chgpllnul(/ pllist) (setq pllist (ssget '((8 . "AM_0") (0 . "*Polyline")))) (command "change" pllist "" "P" "LA" "0" "")))
from
(defun C:chgpllnul ( / pllist ) (setq pllist ((ssget '((8 . "AM_0") (0 . "Polyline")))(command "change" pllist "" "P" "LA" "0" "" ))))
and while we're at it
(defun C:chgpllnul(/ pllist (if (ssget '((8 . "AM_0") (0 . "*Polyline"))) (progn (vlax-for itm(setq pllist (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-acad-object)))) (vla-put-layer itm "0") ) (vla-delete pllist) ) ) ) You could do this very easily with your action recorder, if you have your quick properties palette turned on to provide the POLYLINE filter selection, then just change the layer on the quick properties palette.Not sexy, but it would work. You could always use QSELECT also... Just saying. :wink:
http://img2.moonbuggy.org/imgstore/hey-snoopy-im-bringing-sexy-back.jpg Point taken guys...
In fairness to the OP, he did ask for help why he cant get his code to work .. but then again it wouldnt hurt to know you can usenative commands for such a task. You make a good point RenderMan.I have never used it before, have used FILTER though, looks pretty similar.I always use my quick properties palette, so get an awful lot of handy information and limited selectivity there, but I will definitely start using this, good tool, I've seen it mentioned a lot, thanks.
页:
[1]
2