Delete all scenes?
-
I have a need to delete all scenes from my ruby script. I read somewhere that this is not possible, but I did find model.pages.erase: http://code.google.com/apis/sketchup/docs/ourdoc/pages.html#erase.
I thought that this code would work, but it splats for me:
pgs = Array.new model.pages.each {|pg| pgs.push pg} pgs.each {|pg| model.pages.erase pg}
Any ideas? CB.
-
I think you just missed out the
model = Sketchup.active_model
This works for me:
model = Sketchup.active_model pgs = Array.new model.pages.each {|pg| pgs.push pg} pgs.each {|pg| model.pages.erase pg}
-
Remus's code works on v7, BUT not on v6.
There is no equivalent to model.pages.erase(page) till v7...
-
Ah, that's the confusion (v6 vs v7).
I had set model earlier in the script.
My splat seems to be related to undoing the erasures, and then erasing them again. Will require more investigation. -
Seems I can create this splat fairly easily without using ruby at all. Just open a model that has one scene, and then delete that scene. Then close SU, and it will splat. At least for me.
-
Interesting, I'm not seeing that. Perhaps you have a ruby installed that is conflicting. You might need to test which ruby it is.
Advertisement