Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
i'm new in this group, either, very new in AutoLisp 🙂
For you for sure simple thing - this simple (i guess:) lisp have to search for blocks in drawing and change Layer according to block name.
Worked fine till blocks with underbars and minus came. I needed to change block name and Layer in code.
Can you please help me modify lisp, to make search for stuff like 'simple_block' and 'simple-block' possible ?
Block's name have to stay unchanged !
Thanks !
Martin.
Code :
(defun c:demo (/ cly ent i lay ss)
(if (setq ss (ssget "_X" (list '(0 . "INSERT") '(2 . "simple_block") '(66 . 1))))
(progn
(setq cly (getvar 'CLAYER))
(command "_.layer" "_U" "BS" "_T" "BS" "_M" "BS" "")
(repeat (setq i (sslength sS))
(setq ent (entget (ssname ss (setq i (1- i))))
lay (cdr (assoc 8 ent))
)
(if (/= lay "BS")
(entmod (subst (cons 8 "BS") (assoc 8 ent) ent))
)
)
(setvar 'CLAYER cly)
)
(prompt "\n \"simple_block\" block not found! ")
)
(princ)
)
Solved! Go to Solution.