How to convert AcGeMatrix3d to VARIANT

By Gopinath Taget

AcAxMatrix3d converts VARIANT to AcGeMatrix3d but not vice-versa. How can I do the reverse conversion?

The code below does the conversion from AcGeMatrix3d to VARIANT:

HRESULT GetVariantFromMatrix(VARIANT* pVal, AcGeMatrix3d mat)    {     // Declare our Variant to be an array of doubles.     pVal->vt = VT_ARRAY | VT_R8;          SAFEARRAYBOUND rgsaBound[2];// 2 dimensional array...     rgsaBound[0].lLbound = 0L;// First dimension size is 4     rgsaBound[0].cElements = 4;     rgsaBound[1].lLbound = 0L;// Second dimension size is 4     rgsaBound[1].cElements = 4;          pVal->parray = SafeArrayCreate(VT_R8, 2, &rgsaBound[0]);// Create the VARIANT     if (! pVal->parray)      return E_OUTOFMEMORY;          // Now populate it.     HRESULT hr;     long i[2];     for (i[0]=0;i[0]

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading