ASMI,
这可能吗?
- ; create all company layers list
- (setq layLst '("D-EX-ELECT" "Electrical2" "Electrical3" "Electrical4"))
- ; foreach layer in list
- (foreach lay layLst
- ; if user has select entity for this layer and selection set has created
- (if
- (and
- (setq cEnt(entsel(strcat "\nSelect entity for '" lay "' or Enter for none> ")))
- (setq cLay(cdr(assoc 8(entget(car cEnt)))))
- (setq cSet(ssget "x"(list(cons 410(getvar "ctab"))(cons 8 cLay))))
- ); and and
- (progn
- ; higlight selection set for user can to see it
- (sssetfirst nil cSet)
- (initget "Yes No")
- ; if user press Y or hit Enter
- (setq cAns(getkword
- (strcat "\nDo you want to cnahge layer to '" lay "'? [Yes/No]<Yes>: ")))
- (if(/= "No" cAns)
-
- ; change properties of selection set
- (command "chprop" "P" "" "la" lay "C" "bylayer" "LT" "bylayer" "")
- (princ(strcat "\nLayer '" lay "' passed by user "))
- ); end if
- ); end progn
- (while
- (and
- (= (setq cEnt(entsel(strcat "\nSelect entity for '" lay "' or Enter for none> "))) nil)
- (setq cLay(cdr(assoc 8(entget(car cEnt)))))
- (setq cSet(ssget "x"(list(cons 410(getvar "ctab"))(cons 8 cLay))))
- ); end and
- ; higlight selection set for user can to see it
- (sssetfirst nil cSet)
- (initget "Yes No")
- ; if user press Y or hit Enter
- (setq cAns(getkword
- (strcat "\nDo you want to cnahge layer to '" lay "'? [Yes/No]<Yes>: ")))
- (if(/= "No" cAns)
-
- ; change properties of selection set
- (command "chprop" "P" "" "la" lay "C" "bylayer" "LT" "bylayer" "")
- ); end if
- ); end while
- ); end if
- ); end foreach
|