OMC::Element Class Reference

Detailed Description

Provides the methods and properties for an Element.

An Element is a collection of ElementDrawing objects that are managed and sourced on disk relative to the project. The element's are referred to by their ID and name, and are linked to an ElementAttribute with a ElementColumn. The ElementColumn provides the exposure and order of the drawings when used in an ElementAttribute.

All elements are owned by the project and are provided by the ElementList in the project's elements attribute (See OMH::HarmonyProject::elements).

List All Elements in a Project

from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
proj = sess.project #Get the active session's currently loaded project.
elems = proj.elements #The element list of all elements in the project.
print( "Element Count: %s"%(len(elems)) )
for elem in elems: #Expectation: All names of all scenes in the project printed.
print( "Element Name: %s"%(elem.name) )



Create a New Element with Some Drawings

from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
proj = sess.project #Get the active session's currently loaded project.
elems = proj.elements #The element list of all elements in the project.
#Create the new Element
new_element = elems.create( "NEW_ELEMENT_NAME", "COLOR", 12.0, "SCAN", "TVG" )
#Create some new drawings.
new_drawing1 = new_element.drawings.create( "DRAWING_NAME_001", False, True )
new_drawing2 = new_element.drawings.create( "DRAWING_NAME_002", False, True )
new_drawing3 = new_element.drawings.create( "DRAWING_NAME_003", False, True )

Public Member Functions

virtual void lock ()
 Get the lock on the database.
 
virtual void release ()
 Release the lock on the database.
 
OMC::Obj duplicate (const QString &elementName) const
 Duplicate the element.
 

Public Attributes

int id
 Provides the id of the element in the project.
 
QString name
 Provides the name of the element in the project.
 
eScanType scan_type
 Provides and sets the scan type of the element in the project.
 
double field_chart
 Provides the fieldchart of the element in the project.
 
QString vector_type
 Provides the vector type of the element in the project. More...
 
QString pixmap_format
 Provides the pixmap format for the provided element ID.
 
QString folder
 Provides the actual element folder. More...
 
QString folder_complete
 Provides the complete element folder. More...
 
OMC::ElementDrawingListdrawings
 Provides the list of drawings contained in the element.
 
QString physical_name
 Provide the actual name of the drawings. More...
 
bool locked
 Whether the element is currently locally locked by the session, and can be modified.
 
bool temp_directory_located
 Whether the element is currently located in the temp directory.
 
bool deleted
 Whether the element is deleted.
 
bool linked
 Whether the element is linked to a column.
 

Member Data Documentation

◆ folder

QString OMC::Element::folder
read

Provides the actual element folder.

This is normally the element name (unless it has been renamed and the project is not saved) but may include the ".<element id>" in the name if multiple elements share the same name.

◆ folder_complete

QString OMC::Element::folder_complete
read

Provides the complete element folder.

This is normally the element name (unless it has been renamed and the project is not saved) but may include the ".<element id>" in the name if multiple elements share the same name.

◆ physical_name

QString OMC::Element::physical_name
read

Provide the actual name of the drawings.

This is different that the element name if this one has been renamed and the changes have not yet been saved.

◆ vector_type

QString OMC::Element::vector_type
readwrite

Provides the vector type of the element in the project.

This provides the vector type for the given element. For standard vector or Toon Boom bitmap drawing, the vector type will be TVG.

Inheritance diagram for OMC::Element:
Collaboration diagram for OMC::Element: