symysgames Posted November 29, 2016 Posted November 29, 2016 I often use selection sets in my programming but always encounter difficulties when they are empty. why is it so problematic? is it because of the nature of nil who is a atom and a list at the same time. Most of the time I make sure my selection set is never empty, I insert a dummy object and then remove once I don't need it, and I found it works ok . There are filters but I don't see how they can be of any use. For example if I have a selction set ss1 and then do (setq lg (sslength ss1)) if my selection set is empty it will not set lg to 0 but to nil. how can I overcome this without having to insert a dummy object. Quote
jammie Posted November 29, 2016 Posted November 29, 2016 Hi, I'd sometimes create an empty selection set at the beginning of the code using SSADD with no other inputs (setq ss1 (ssadd)) This produces a selection set of length 0. Possibly, in the code you are working with, you may receive an error message similar to this ; error: bad argument type: lselsetp nil If the selection set ss1 is not defined or nil, calling (setq lg (sslength ss1)) Will cause an error in the code. Regards Jammie Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.