Message 1 of 13
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am having trouble making an loop for user-selecting a viewport as a variable, and test to make sure it is a viewport before proceeding to the next one. I've had the problem before but the usual tweaks aren't working. Whether I use ssget and then ssname, or if I use entsel and then car, I'm still getting the target as an ename and not a viewport. If I convert to a vla it becomes a vla object and some methods can be applied, but its object type is a vla-object and not a viewport. I am using the (0 . "VIEWPORT") filter on ssget, but this doesn't give an error on selection to re-select, it just chokes on the resulting nil value farther down the lisp.
(alert "\nSelect viewports one at a time from top to bottom")
(setq VwPrt1 (ssget "_+.:E:S" '((0 . "VIEWPORT"))))
(setq VP1v (vlax-ename->vla-object (ssname VwPrt1 0)))
(while (/= (type VP1v) "VIEWPORT")
(progn
(princ "Object must be a viewport")
(setq VwPrt1 (ssget "_+.:E:S" '((0 . "VIEWPORT"))))
)
Thanks for any help
Gorra
Solved! Go to Solution.