我看了你的一篇帖子,它正是我想要的。我只是改变了一些颜色,而不是图层,我改变了线型。但我只是想确保我理解这个代码
-
- (defun c:doit (/ i ss ent eLst)
- (if (setq i -1 [color=Red];i'm guessing this is for the "while" counter[/color]
- ss (ssget "_:L")) [color=Red];this is the selection set. not sure what kind if selec :L is[/color]
- (while
- (setq ent [color=Red];variable for the entity name[/color]
- (ssname ss
- (setq i (1+ i)))) [color=Red];this will continue to +1 untill it runs out of object entities[/color]
- [color=Red];when it runs out it returns nil and stops the loop.[/color]
- [color=Red];(1+ i) = 0 which is first entity in selection set[/color]
- (setq eLst (entget ent)) [color=Red] ;retrieve DXF codes[/color]
-
- (setq eLst (subst '(8 . "0") (assoc 8 eLst) eLst)) [color=Red];modify DXF[/color]
- (entmod [color=Red];all of this is incase a DXF code does not exist.[/color]
- (if (assoc 62 eLst)
- (subst '(62 . 3) (assoc 62 eLst) eLst)
- (append eLst '((62 . 3)))))))
- (princ))
|