Quantcast
Channel: ArchiCAD-Talk - Developer Forum
Viewing all articles
Browse latest Browse all 564

Library Part - array - GSHandle

$
0
0
Author:gehairing
Posted: Tue Feb 23, 2016 6:09 pm (GMT+1)


Hi,

Did you look at the \Examples\LibPart_Test\Src\LibPart_Test.cpp in the SDK samples folder ?

There is an example for creating lib parts.

In the method "Do_CreateLibraryPart" there is a code for creating simple parameters and also array parameters.

Here is a part of the code but the best is to look at the complete sample :

Code:
         pAddPar = &(*addPars)[3];
         pAddPar->typeID = APIParT_RealNum;
         pAddPar->typeMod = API_ParArray;
         pAddPar->dim1 = 3;
         pAddPar->dim2 = 4;
         CHTruncate ("matrix", pAddPar->name, sizeof (pAddPar->name));
         GS::ucscpy (pAddPar->uDescname, L("Array parameter with real numbers"));
         pAddPar->value.array = BMAllocateHandle (pAddPar->dim1 * pAddPar->dim2 * sizeof (double), ALLOCATE_CLEAR, 0);
         double** arrHdl = reinterpret_cast<double**>(pAddPar->value.array);
         for (Int32 k = 0; k < pAddPar->dim1; k++)
            for (Int32 j = 0; j < pAddPar->dim2; j++)
               (*arrHdl)[k * pAddPar->dim2 + j] = (k == j ? 1.1 : 0.0);


Viewing all articles
Browse latest Browse all 564

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>