How to set page index?
-
What is the correct way of setting the index and name with "pages.add" ?
I want to inset a new page at a certain position. -
Jan,
I haven't tested, but if the new pages gets added after the "current" page, you could set the current page before adding the new page?
-
I'm not sure that would work in this perticular case.
The docs says:@unknownuser said:
If index is given, it specifies the position in the page list that the new page is added. Otherwise the new page is added to the end.
name The name of the specific page.
flags (optional) Bit flags in integer form.
index (optional) Index of where to inset.So if I want to add a page, give it a name AND a index what would be the correct syntax?
pages.add "name" ??????
-
Really, no one knows this?
-
I'm not how to derive the value for the second argument (flags) is used for - 0 works but it's not what you want. I'll need to see if I can find that...
index = 0 model = Sketchup.active_model pages = model.pages pages.add("Page Name", 0, index)
You may need to go through each page property and set them.
-
Ok, I found the flags:
Object.constants.grep /^pag/i ["PAGE_USE_SECTION_PLANES", "PAGE_USE_ALL", "PAGE_NO_CAMERA", "PAGE_USE_CAMERA", "PAGE_USE_RENDERING_OPTIONS", "PAGE_USE_SHADOWINFO", "PAGE_USE_SKETCHCS", "PAGE_USE_HIDDEN", "PAGE_USE_LAYER_VISIBILITY"]
And it looks like
PAGE_USE_ALL
will do it if you want the default of All Enabled.model = Sketchup.active_model pages = model.pages index = 0 page = pages.add("New Page", PAGE_USE_ALL, index)
If you want to pick and choose which options, bitwise OR (
|
) the options together:model = Sketchup.active_model pages = model.pages index = 0 page = pages.add("New Page", (PAGE_USE_HIDDEN|PAGE_USE_CAMERA), index)
-
Thanks, will try this.
Advertisement