SVG on Images Matrix

 

Version Info

Minimum Origin Version Required: Origin 2023

Example

The example will show you how to add an SVG file to the active Matrix object of matrix layer (Image view mode), and how to remove it.

Add SVG

Following function will add an SVG file to a matrix layer (sheet) and associate it with the active matrix object by index, .

void        load_svg_to_matrix(string strPathName)
{
        MatrixLayer                     matlayer = Project.ActiveLayer();
        if (!matlayer)
        {
                out_str("Matrix must be active!");
                return;
        }
        
        LPCOSTR                         lpcszPathName = strPathName;
        OLP                             olpRet = matlayer.PathsObjectsManagement(PATHSMNG_ADD_PATHS_OBJ, lpcszPathName);
        if (olpRet <= 0)
        {
                out_str("Failed to add SVG!");
                return;
        }
}

Remove SVG

Following function will remove all SVG files from active Matrix layer.

void        remove_all_svgs_from_matrix()
{
        MatrixLayer                     matlayer = Project.ActiveLayer();
        if (!matlayer)
        {
                out_str("Matrix must be active!");
                return;
        }
        
        OLP                             olpCountRemoved = matlayer.PathsObjectsManagement(PATHSMNG_REMOVE_ALL);
        out_int("Paths objects removed: ", olpCountRemoved);
}