- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
This code let user select multiple text/block objects and check if those are defined in a list relation. If those are defined, code remember what user picks and move one to another and so on...
If object is not in definition it ask to write what it is and then checks if the entry is correct if not is give alert to try again.
Its part of bigger autocadlisp function which then paste various blocks defined in relation list in the exact the same order as in the selection process.
to this fragment of code i want to add those function but i struggle to 😞
1. If user selects empty field in autocad alert "You pick nothing select again" and continue the loop of picking objects( this one has to repeat even if user picks object in step 1 and then select empty)
2. Somehow a possibility to end while loop of selection ( best would be when press spacebar or write endnow in command prompt. but i am open to sugestions)
3. A possibility to undo last selection (i want to undo multiple as well - best case scenario just pressing backspace multiple times etc.)
4. If it is possible prompts user with information what exactly was the object which was canceled in undo selection process.
(setq selectionList (list))
(while (setq selection (entsel "Wybierz napis lub blok: "))
(setq entType (cdr (assoc 0 (entget (car selection)))))
(setq entName (if (equal entType "TEXT")
(cdr (assoc 1 (entget (car selection))))
(cdr (assoc 2 (entget (car selection))))
)
)
(setq found nil)
(foreach relation
'(("pralka" . "svp_pralka")
)
(if (equal entName (car relation))
(setq found t)
)
)
(if (not found)
(while (not found)
(setq entName (getstring "Podaj nazwę napisu/bloku: "))
(foreach relation
'(("pralka" . "svp_pralka")
)
(if (equal entName (car relation))
(setq found t)
)
)
(if (not found)
(alert "Nie ma takiego napisu/bloku w relacjach, spróbuj ponownie.")
)
)
)
(setq selectionList (append selectionList
(list (cons entName (car selection)))
)
)
)
Solved! Go to Solution.