To make a call of a global function/constant user needs to:

Example:

import pyark
def run(self):
    pyark.GetRoot( "The Tree" ) #Using global function to get the tree root

String validation policies

imposes some limitations on names of objects, types, filters and some other string values. If script passes incorrect string, default behavior is to raise an exception. This can be adjusted, using the following functions:

Object management functions

Types management functions

Filters (tree views) management functions

Getting and setting current context

History management functions

Example calling GetHistory:

import pyark
import datetime
d1 =datetime.date(2015,12,1) #from 1 December 2015
d2 = datetime.datetime.now() #until now
user = 'user@k.i'
hpIdFrom = '230000'
hpIdTo = '240000'
hist = pyark.GetHistory(d1, d2)  #request history for the given period
#hist2 = pyark.GetHistory(None, d2, user, hpIdFrom, hpIdTo)  #request history for the given user within given history points range
for h in hist:
    print h #printing all found history records

Images management functions

Variants management functions

Projects management functions


These functions allow script to query, create, delete and copy projects in the current workspace. For working with other workspaces, see documentation for pyark.OpenConnection in the Connection management functions section.

Querying and modifying current project information

Functions that return information about the state of the currently open project and allow to modify it.

Connection management functions

These functions allow to open connection, accessing projects in other servers and workspaces.

User interface management functions

These functions allow the user to customize the graphical interface of the arKItect client. It relies on the PyQt integration technology. An example of PyQt integration within the arKItect client can be found here
The following functions are defined in a submodule of pyark named 'ui'. This means that in order to use them, you have to use the prefix 'pyark.ui' and not just 'pyark'.

Other functions to control arKItect GUI from scripts:

Send alert functions

AUA management functions

Querying user permissions functions

Enable Reader Cache for heavy operations

To improve performance on different reading actions when they are done multiple times - e.g. getting all objects and then checking for each object whether it is a flow or getting attributes for each object - it is possible to enable data reader cache in .

DataReaderCacheContext  should be used to parse the model (walk_objects, GetAllChildren, IsChildFlow, GetInputFlowList / GetOutputFlowList ...)

Setting requests grouping mode

To improve performance of scripts which create a lot of objects, query packaging mode can be enabled in . In this mode, object creation and modification queries are grouped into single packets, which significantly improves performance. However, functionality of is seriously limited in this mode: basically, only object creation and modification methods are working. The following functions can be used to control this mode:

BulkModeContext  should be used when updating several object

A good practice is to split reader and setter task when it is possible and use DataReaderCacheContext for reading tasks and BulkModeContext  for writing tasks

Sometimes when a script is being executed, it is needed to visualize intermediate results (update diagrams) - to do so a special method is introduced:

Logging and Reporting functions

Scripts might need to give user some information about details of the execution: information messages, warnings, recoverable errors and other. It is possible to print this information to the "Program Trace" window, using Python's "print" operator. However, their use is discouraged in production scripts because of the limited features of this approach. Instead, developers are encouraged to use "Pythons Events" system.

There are 2 API functions that control it:

Each event is characterized by 6 parameters:

User can define, what levels of events to ignore and what to store in the memory; it is also possible to configure, when to show pop-up window with event log messages.

Generally, generating lots of long descriptions may cause significant performance degradation. To avoid this problem, title and description generation are delayed. Instead of providing 2 strings, developer must provide a callback function that produces a tuple of 2 strings: (title, description). This callable is executed only if the event is not ignored by the current logging settings. Thus, ignored messages are never generated, and don't waste resources.

Example of a code, that adds a message:

pyark.LogEvent( pyark.LOG_WARNING, 0, "important script",
                lambda: ("Warning title", "Warning description") )

This code uses lambda expression to make a callback function, but any other kind of callable is appropriate.

Shared files functions

Shared files are stored together on the server side in the project shared storage, under the SVN сontrol. The storage is unique for each project. Shared files are commonly associated to objects.

Note about revision numbers: current latest revision is incremented each time someone updates file data on server.

Other functions

Examples:

version

pyark.GetVersion()

"2.1"

(2,1,0,"")

"2.1alpha"

(2,1,0,"alpha")

"2.1.1"

(2,1,1,"")

"2.1.1.2009"

(2,1,1,"2009")

"2.alpha2.3"

(2,0,0,"alpha2.3")

Global constants

Attributes

ARK_ATTRIB_APP, ARK_ATTRIB_AUTHOR, ARK_ATTRIB_SIMULINK_CONFIG, ARK_ATTRIB_BOOL, ARK_ATTRIB_DATE, ARK_ATTRIB_DOUBLE, ARK_ATTRIB_ENUM, ARK_ATTRIB_ENUM_VALUE, ARK_ATTRIB_FILE, ARK_ATTRIB_GROUP, ARK_ATTRIB_HYPERLINK, ARK_ATTRIB_INT, ARK_ATTRIB_MEMO, ARK_ATTRIB_RICHTEXT, ARK_ATTRIB_POINTERS, ARK_ATTRIB_PROGRAM, ARK_ATTRIB_SAVEDFILE, ARK_ATTRIB_SINGLE, ARK_ATTRIB_TEXT, ARK_ATTRIB_TEXTLARGE, ARK_ATTRIB_MARKUP

Diagrams

ARK_GRAPH_INNER_VIEW, ARK_GRAPH_PEER_VIEW, ARK_GRAPH_MATDRAW_VIEW, ARK_GRAPH_MATDRAW_INNER_VIEW, ARK_GRAPH_MATDRAW_PEER_VIEW, ARK_GRAPH_TABULAR_VIEW

Type properties

ARK_ATYPE_CLRTEXT, ARK_ATYPE_CLRLINE, ARK_ATYPE_CLRFILL, ARK_ATYPE_CLRFLOW,  ARK_ATYPE_CLRFLOW_TEXT, ARK_ATYPE_CLRFILLBG, ARK_ATYPE_CLRTEXT_TRANSP, ARK_ATYPE_CLRTEXTFLOW_TRANSP, ARK_ATYPE_CLRLINE_TRANSP, ARK_ATYPE_CLRFILL_TRANSP, ARK_ATYPE_CLRFLOW_TRANSP, ARK_ATYPE_CLRFILLBG_TRANSP, ARK_ATYPE_LINESHAPE, ARK_ATYPE_LINESTYLE, ARK_ATYPE_LINEWIDTH, ARK_ATYPE_BORDERSTYLE, ARK_ATYPE_BORDERWIDTH, ARK_ATYPE_ARROWSTYLE, ARK_ATYPE_OBJSHAPE, ARK_ATYPE_SIMTYPE, ARK_ATYPE_ICON, ARK_ATYPE_DISPLAY_ATTRIB_NAME, ARK_ATYPE_DISPLAY_ATTRIB_ICON, ARK_ATYPE_DISPLAY_ATTRIB_VALUE, ARK_ATYPE_FILLHATCH, ARK_ATYPE_KEEP_RATIO, ARK_ATYPE_DEFAULT_SIZE, ARK_ATYPE_READ_ONLYARK_ATYPE_EXCLUDE_FROM_REVMNG, ARK_ATYPE_UNIQUE, ARK_ATYPE_FLEXIBLE

ATYPE_GEN_TAG_ATRRIB_BGIMAGE, ATYPE_GEN_TAG_ATRRIB_FGIMAGE, ATYPE_GEN_TAG_ATRRIB_FONT, ATYPE_GEN_TAG_ATRRIB_FONT_FLOW

Line shapes

ARK_LINESHAPE_CURVE, ARK_LINESHAPE_STRAIGHT, ARK_LINESHAPE_ORTHOGONAL, ARK_LINESHAPE_CUSTOMIZABLE

Line styles

ARK_LINESTYLE_SOLID, ARK_LINESTYLE_DASH, ARK_LINESTYLE_DOTARK_LINESTYLE_DASHDOT, ARK_LINESTYLE_DASHDOTDOT

Arrow styles

ARK_ARROWSTYLE_NOARROW, ARK_ARROWSTYLE_ARROW, ARK_ARROWSTYLE_OPEN, ARK_ARROWSTYLE_STEALTH, ARK_ARROWSTYLE_DIAMOND, ARK_ARROWSTYLE_DIAMOND_WHITEARK_ARROWSTYLE_CIRCLE

Object shapes

ARK_OBJSHAPE_AND, ARK_OBJSHAPE_COMMENT, ARK_OBJSHAPE_CROSS, ARK_OBJSHAPE_CUBE, ARK_OBJSHAPE_DIAMOND, ARK_OBJSHAPE_DOC, ARK_OBJSHAPE_ELLIPSE, ARK_OBJSHAPE_FLAG, ARK_OBJSHAPE_METEOR,ARK_OBJSHAPE_OR, ARK_OBJSHAPE_PLAQUE, ARK_OBJSHAPE_PRLGRM, ARK_OBJSHAPE_RECT, ARK_OBJSHAPE_RECT_RE, ARK_OBJSHAPE_SAIL, ARK_OBJSHAPE_SIGN_LEFT, ARK_OBJSHAPE_SIGN_RIGHT, ARK_OBJSHAPE_TEARDROP, ARK_OBJSHAPE_TRAPEZ_UP, ARK_OBJSHAPE_TRAPEZ_DOWN, ARK_OBJSHAPE_TRIANGLE_UP, ARK_OBJSHAPE_TRIANGLE_DOWN, ARK_OBJSHAPE_WAVE, ARK_OBJSHAPE_PENTAGON, ARK_OBJSHAPE_HEXAGON, ARK_OBJSHAPE_HEPTAGON, ARK_OBJSHAPE_OCTAGON, ARK_OBJSHAPE_DECAGON, ARK_OBJSHAPE_DODECAGON, ARK_OBJSHAPE_CAN, ARK_OBJSHAPE_CAN_LYING, ARK_OBJSHAPE_END_NODE, ARK_OBJSHAPE_INIT_NODE, ARK_OBJSHAPE_CROSS_NODE, ARK_OBJSHAPE_JOIN, ARK_OBJSHAPE_BIFURCATION, ARK_OBJSHAPE_BIFURCATIONV, ARK_OBJSHAPE_PRIORITY_AND_GATE, ARK_OBJSHAPE_HOUSE_EVENT, ARK_OBJSHAPE_XOR, ARK_OBJSHAPE_INHIBIT_GATE, ARK_OBJSHAPE_SIMULINK

Simulink types

ARK_SIMTYPE_ENABLE, ARK_SIMTYPE_FCALL, ARK_SIMTYPE_SM, ARK_SIMTYPE_SUBSYSTEM, ARK_SIMTYPE_STATE, ARK_SIMTYPE_SIGNAL, ARK_SIMTYPE_TRANSITION, ARK_SIMTYPE_TRIGGER, ARK_SIMTYPE_VECTOR

Rule types

ARK_RULE_SIMPLE, ARK_RULE_FLOW, ARK_RULE_BIFLOW, ARK_RULE_INPUT, ARK_RULE_OUTPUT

Projection properties

ARK_TREEVIEW_SIMTYPE, ARK_TREEVIEW_DISPNAME, ARK_TREEVIEW_MASTERSECONDARY, ARK_TREEVIEW_GRAPHORIENT

Projection master/secondary

ARK_TREEVIEW_MASTER, ARK_TREEVIEW_SECONDARY

Object options/variants/phases status

ARK_OBJVAR_UNDEFINED, ARK_OBJVAR_MANUAL, ARK_OBJVAR_PROPAGATED, ARK_OBJVAR_PROPAGATED_UP

Diagram orientation

ARK_GRAPHORIENT_STANDARD, ARK_GRAPHORIENT_TB, ARK_GRAPHORIENT_LR

Object parent relations

RELATION_NONE, RELATION_DIRECT_CHILD, RELATION_INDIRECT_CHILD, RELATION_ATTRIBUTE

Events

EVENT_ONADDCHILD, EVENT_ONADDEXISTING, EVENT_ONADDNEW, EVENT_ONCHANGEATTRIBVALUE, EVENT_ONCHANGEDIRECTION, EVENT_ONCLOSE, EVENT_ONCUSTOMFILTER, EVENT_ONDELETE, EVENT_ONOPEN, EVENT_ONREMOVECHILD, EVENT_ONRENAME, EVENT_ONACTIVATEIBD, EVENT_ONCHANGEPROPERTIES, EVENT_ONCHANGEPROJECTION, EVENT_ONADDCHILD_GLOBAL, EVENT_ONREMOVECHILD_GLOBAL

User permissions

STATUS_DEVELOPER, STATUS_DEVELOPER_ADMIN, STATUS_DESIGNER, STATUS_READONLY

Use access types

RIGHTS_NOT_VISIBLE, RIGHTS_READ_ONLY, RIGHTS_FULL_ACCESS

String validation policies

SVP_STRICT, SVP_IGNORE, SVP_REPLACE

Message logging levels

LOG_INFO, LOG_DEBUG, LOG_WARNING, LOG_ERROR, LOG_EXCEPTION, LOG_CRITICAL

History action types

HISTORY_OBJECT_ATTRIBUTES, HISTORY_OBJECT_ATTRIBUTES_REVISION_EXCLUDED, HISTORY_OBJECT_PARENTSTRUCTURE, HISTORY_OBJECT_OPTIONS, HISTORY_OBJECT_RENAME, HISTORY_ADD_NEW_OBJECT, HISTORY_DELETE_REFERENCE, HISTORY_DELETE_OBJECT_GLOBALLY, HISTORY_LINK_DIRECTION, HISTORY_NEW_OBJECT_REFERENCE, HISTORY_PROJECT_ACTION, HISTORY_OBJECT_CREATE_REVISION, HISTORY_OBJECT_SWITCH_REVISION,HISTORY_SCRIPT