Oasys.REPORTER.Page class¶
Properties¶
Constructor¶
- classmethod Page(template, options=Oasys.gRPC.defaultArg)¶
Create a new
Page.
- Parameters:
template (Template) –
Template
to create page inoptions (dict) –
Optional. Options specifying various page properties, including where the page should be created. If omitted, the default values below will be used
- colour (optional):
(Colour object) Page background colour (white if omitted)
- index (optional):
(integer) The page index at which the new page will be inserted (indices start from zero). You cannot create pages prior to the current page i.e. the index must be greater than the index of the current page. If omitted, the new page will be created immediately after the current page. Note that the current page continues to be the page that the Script item is running on (it does not change to the newly-created page).
- name (optional):
(string) Name for page (empty if omitted)
- Returns:
Page object
- Return type:
dict
Example
To create a new blank Page object in template t:
page = Oasys.REPORTER.Page(t)To create a new red page named “Last page” as the last page in template t:
page = Oasys.REPORTER.Page(t, {name:"Last page", colour:Colour.Red(), index:t.GetAllPages().length})
Instance methods¶
- Page.DeleteItem(index)¶
Deletes an item from a page
- Parameters:
index (integer) – The index of the item that you want to delete. Note that indices start at 0
- Returns:
No return value
- Return type:
None
Example
To delete the first item of page p:
p.DeleteItem(0)
- Page.Duplicate(index=Oasys.gRPC.defaultArg)¶
Duplicate a page
- Parameters:
index (integer) – Optional. The page index that you want to insert the duplicate page at in the template. Note that indices start at 0. If omitted the duplicate page will be put after the one that you are duplicating
- Returns:
Page object
- Return type:
dict
Example
To duplicate page p:
dp = p.Duplicate()To duplicate page p putting the duplicate as the first page in the template:
dp = p.Duplicate(0)
- Page.Generate()¶
Generate a page
- Returns:
no return value
- Return type:
None
Example
To generate page p:
p.Generate()
- Page.GetAllItems()¶
Gets all of the items from a page
- Returns:
List of Item objects
- Return type:
list
Example
To get all of the items on page p:
items = p.GetAllItems()
- Page.GetItem(index)¶
Get an item from a page
- Parameters:
index (integer) – The index of the item on the page that you want to get. Note that indices start at 0
Example
To get the 1st item on page p:
p.GetItem(0)
- Page.ImportItem(filename)¶
Import an item from a file onto the page
- Parameters:
filename (string) – File containing the object to import
Example
To read an item from file “item.oro” and put it on page p:
p.ImportItem("item.oro")