8.1.21.2 OriginObject::Destroy

It is recommended that you switch to the originpro package. PyOrigin is primarily for users who need to work with Origin version prior to 2021.


Description

Destroy the Origin object

Syntax

Destroy(Ctrl = OCD_DEL_LINKED_OBJS | OCD_DEL_PARENT_IF_LAST)

Parameters

Cntrl
various bits to control further the related actions to be taken on deleting the object. This is used for Layer only.
OCD_DEL_PARENT_IF_LAST : If the OriginObject is the last Layer in the Page then also destroy the page
OCD_DEL_LINKED_OBJS: also delete all the linked datasets if the OriginObject is a worksheet layer or matrix layer, since all the column and matrix objects are deleted.

Return

Returns True on successful exit (the OriginObject was destroyed) and False on failure.

Examples

EX1

import PyOrigin
wks=PyOrigin. ActivePage()
if wks.IsValid():
    print('wks object is valid\n')
    wks.Destroy()
    if wks.IsValid():
        print("Still valid (but shouldn't be)\n")
    else:
        print('No longer valid\n')
else:
    print('There was a problem\n')