2.26.1 Add


Description

Syntax

VB: Function Add As MatrixObject
C++: MatrixObject Add
C#: MatrixObject Add

Return

Remark

Examples

VB

    Dim m_pOrigin As Origin.IOApplication
    Dim m_mtxPage As Origin.MatrixPage
    Dim m_mtxSheet As Origin.MatrixSheet
    Dim m_mtxObj As Origin.MatrixObject

    Private Sub ConnectAndPrepare()
        m_pOrigin = New Origin.ApplicationSI()
        m_pOrigin.NewProject()
        m_pOrigin.Visible = Origin.MAINWND_VISIBLE.MAINWND_SHOW

        m_mtxPage = m_pOrigin.MatrixPages.Add()
        m_mtxSheet = m_pOrigin.FindMatrixSheet("")
        m_mtxSheet.Cols = 200
        m_mtxSheet.Rows = 200
        m_mtxObj = m_mtxSheet.MatrixObjects.Add()
        m_mtxObj.DataFormat = Origin.COLDATAFORMAT.DF_USHORT
        m_mtxObj.ViewImage = True

    End Sub

VC

Origin::IOApplicationPtr m_pIOApp;
Origin::MatrixPagePtr m_pMatrixPage;
Origin::MatrixSheetPtr m_pMatrixSheet;
Origin::MatrixObjectPtr m_pMatrixObject;
bool connect(void)
{
	CoInitialize(NULL);

	this->m_pIOApp.CreateInstance(__uuidof(Application));
	m_pIOApp->PutVisible(Origin::MAINWND_SHOW_BRING_TO_FRONT);

	const int nMatrixPageType = 5;
	const int nVisible = 2;
	m_pIOApp->CreatePage( nMatrixPageType, "Data", "", nVisible);

	m_pMatrixPage = m_pIOApp->GetActivePage();
	m_pMatrixSheet = m_pMatrixPage->GetLayers()->Add();

	m_pMatrixSheet->Activate();

	if( m_pMatrixSheet )
	{
		m_pMatrixSheet->PutCols(200);
		m_pMatrixSheet->PutRows(200);
		m_pMatrixObject = m_pMatrixSheet->GetMatrixObjects()->Add();
		m_pMatrixObject->Activate();
		m_pMatrixObject->DataFormat = Origin::DF_USHORT;
                //set to view matrix as image, this has to be done by LabTalk for now, until we add the
                //proper COM method in next SR
		m_pMatrixSheet->Execute("matrix -ii");
	}

}

C#

        object Default = System.Type.Missing;
        private Origin.ApplicationSI m_app;
        private MatrixPage m_mpg;
        private MatrixSheet m_msht;
        private MatrixObject m_mObj;

        private void Init()
        {
            m_app = new Origin.ApplicationSI();
            m_app.NewProject();

            m_app.Visible = MAINWND_VISIBLE.MAINWND_SHOW;

            m_mpg = m_app.MatrixPages.Add(Default, Default);
            m_msht = m_mpg.Layers[0] as MatrixSheet;
            m_msht.Cols = 200;
            m_msht.Rows = 200;

            m_mObj = m_msht.MatrixObjects.Add();
            m_mObj.DataFormat = COLDATAFORMAT.DF_USHORT; // unsign short

            m_mObj.ViewImage = true;
        }

Version Information

8.0SR2

See Also