Jeff,
Thanks for the info.
If the selection set is always 1 or greater, you don't need the test, just
(ssget "X" '((0 . "VIEWPORT")))
(command "chprop" "p" """layer""defpoints""")
BUT, I did some testing and got this error
chprop
Select objects: p 1 found
1 was not in current space.
Select objects:
Command: layer
Current layer: "0"
Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/PStyle/Freeze/Thaw/LOck/Unlock]:
0
Invalid option keyword.
I tried several combinations & what I found was this.
If you are in model space the chprop command generates an error
If you are in a tab with no vp it generates an error
If you have DWG with 2 tabs and no VP will generate an error
If you have a DWG with 2 tabs & one vp not in the current tab it generates an error
If you have a DWG with 2 tabs & one vp in the current tab & active it generates an error
Conclusion:
chprop only works on items in the current space.
(ssget "X" '((0 . "VIEWPORT"))) gets all tabs as well as view ports so the tabs must be filtered
Looks like more code is needed.