MatrixLayer::MatrixObjects

Description

A Collection of all matrix objects in a matrix layer.


Get matrix object of matrix layer by index.


Get matrix object of matrix layer by name.

Syntax

Collection<MatrixObject> MatrixObjects

MatrixObject     MatrixObjects(int ObjIndex = -1)

MatrixObject     MatrixObjects(LPCTSTR lpcszName)

Parameters

index
[input] matrix object's index. default is -1, means active matrix object.

lpcszName
[input] matrix object's name.

Return

return matrix object got by index. if it is invalid, will be NULL.


return matrix object got by name. If it is invalid, will be NULL.

Examples

EX1

void MatrixLayer_MatrixObjects_Ex1()
{
    MatrixPage mp = Project.MatrixPages(0);
    if(!mp)
        return;
    
    MatrixLayer ml = mp.Layers(0);
    MatrixObject mo = ml.MatrixObjects.Item(0); //get first matrix object
    
    mp.AddLayer(); //add new layer
    int nCount = mp.Layers.Count();
    MatrixLayer mlNew = mp.Layers(nCount - 1);
    matrix& mat = mlNew.MatrixObjects().GetDataObject();
    mat = mo.GetDataObject(); //copy data to new layers acyive matrix object
}

EX2

//by index
void       MatrixLayer_MatrixObjects_Ex2()
{
        MatrixPage mp = Project.MatrixPages(0);
        if(!mp)
                return;
        
        MatrixLayer ml = mp.Layers(0);
        MatrixObject mo = ml.MatrixObjects(); //get active matrix object
        
        mp.AddLayer(); //add new layer
        int nCount = mp.Layers.Count();
        MatrixLayer mlNew = mp.Layers(nCount - 1);
        matrix& mat = mlNew.MatrixObjects().GetDataObject();
        mat = mo.GetDataObject(); //copy data to new layers active matrix object
        if( mat )
                printf("Success to get matrix object!");
        else
                printf("Fail to get matrix object!");
}

EX3

//by name
void       MatrixLayer_MatrixObjects_Ex3()
{
        MatrixPage mp = Project.MatrixPages(0);
        if(!mp)
                return;
        
        MatrixLayer ml = mp.Layers(0);
        MatrixObject mo = ml.MatrixObjects("1"); //get the matrix object which name is "1"
        
        if( mo )
                printf("Success to get matrix object!");
        else
                printf("Fail to get matrix object!");
}

Remark

See Also

Reference