Hi Gary,
You're on the right track -- you just need to adjust the way you're asking about the objects. If you know what the name of the object is, you want to ask the system if an object with that name exists. In this case, you don't want to do anything if it doesn't exist, so you can use "when" rather than "if" (fyi, the counterpart of "when" is "unless").
The following should work:
(when (oli:sd-pathname-to-obj "/w1") (delete_3d "/w1"))
(when (oli:sd-pathname-to-obj "/p1") (delete_3d "/p1"))
Does that help?
Good luck!
andy