...
In the following, we will walk you through all the statements and explain them.
Creating the EDMdatabase
When your application is a EDMstandaloneClient, you will create and operate on the EDMdatabase locally. The first you need to do is to create this database (unless you already have one on your file system). This sample assumes that there is already an EDMdatabase on your file system, created by your previous run, and that you will delete it first.
...
Code Block | ||||
---|---|---|---|---|
| ||||
numberOfHits = 100; /* Read only the 100 first hits in this invocation */ index = 0; if (rstat = edmiRemoteSelectInstances(contextId, repositoryName, modelName, "ifcSpace", "xpxLike(Name, '1*', XPXCASE_INSENSITIVE)", ASCENDING, "GlobalId, Name, OwnerHistory.OwningUser.ThePerson.FamilyName->OwnerName", NULL, "Name", &index, &numberOfHits, &queryResult, NULL, &resultString, NULL, NULL)) { printf("\nERROR: Select IFCSPACE objects failed with error '%s'", edmiGetErrorText(rstat)); goto err; } |
...
Code Block | ||||
---|---|---|---|---|
| ||||
if (queryResult) { SdaiString *gid = (SdaiString *) queryResult->columnDescr[0]->pvalue; SdaiString *name = (SdaiString *) queryResult->columnDescr[1]->pvalue; SdaiString *owner = (SdaiString *) queryResult->columnDescr[2]->pvalue; printf("\n%-24s%-6s%-30s", "GlobalId", "Name", "Owner Name"); printf("\n======================================================="); for (i = 0; i < queryResult->rows; i++) { printf("\n%-24s%-6s%-30s", gid[i], name[i], owner[i]); } } |
...
The last operation in this sample will be to export a subset of the data set to Part28 XML. The exported sub set will be all instances of type IFCBUILDINGSTOREY with a name containing the string 'etg' or 'storey'.
Code Block | ||||
---|---|---|---|---|
| ||||
numberOfHits = 100; /* Read only the 100 first hits in this invocation */
index = 0;
if (rstat = edmiRemoteSelectInstances(contextId, repositoryName, modelName, "ifcBuildingStorey",
"xpxLike(Name,'*etg*',XPXCASE_INSENSITIVE) or xpxLike(Name,'*storey*',XPXCASE_INSENSITIVE)",
RESULT_IN_FILE | XML_FORMAT, NULL, NULL, NULL, &index, &numberOfHits, &queryResult,
NULL, &resultString, queryResultFile, NULL)) {
printf("\nERROR: Select IFCBUILDINGSTOREY objects failed with error '%s'", edmiGetErrorText(rstat));
goto err;
} |
This statement reads only the fires 100 instances of type IFCBUILDINGSTOREY that match the condition. What if there are more than 100? That is what the arguments index and numberOfHits are for. To handle that, you simply put the code block in a loop and if numberOfHits comes out with 100 after the first iteration, you increase index with 100 and repeat until there are no more hits.
Check also the other samples in Getting Started with EDMsdk