The function edmiRemoteReadStepFile may optionally create a STEP identifier model. The purpose of such a model is to preserve the correlation between the ISO10303-21 STEP file instance identifiers, stepIds, and their corresponding instanceIds in the EDMdatabase.
If an edmModel was initially populated from a STEP file, and a STEP identifyer model was created, this function will return the stepId in the ISO10303-21 STEP file that corresponds to an instanceId in the EDMdatabase.
Related function: edmiRemoteGetInstanceOfStepId
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteGetStepIdOfInstance(SdaiServerContext serverContextId,
SdaiAppInstance currInst,
SdaiInteger *stepId,
SdaiInvocationId *edmiInvocationId);
Arguments:
serverContextId |
Context identification, from edmiDefineServerContext |
currInst |
The numeric instanceId that uniquely identifies the instance in the remote _EDMdatabase{_}. |
stepId |
A variable that will receive the numeric stepId that corresponds to the instanceId specified by the <currinst> argument. |
edmiInvocationId |
Currently not used. |
Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an _EDMinterface_ error code. Use edmiGetErrorText to get the error text corresponding to the error code.
Example:
EdmiError rstat, error;
SdaiInteger nWrn, nErr, stepId;
SdaiInstance instId;
SdaiServerContext myContext;
SdaiModel modelId, stepModelId;
/* Create Server Context */
rstat = edmiDefineServerContext("MyContext",
"Johnny", "Supervisor", "cf37ftr",
"TCP", "9090", "MyServerHost",
NULL, NULL, NULL, NULL, NULL, &myContext);
/* Read the population into the remote database */
rstat = edmiRemoteReadStepFile(myContext,
"OurRemoteRepository", "OurRemoteModel",
NULL, NULL, "c:/data/population.stp",
NULL, "OurExpressSchema", NULL,
DELETING_EXISTING_MODEL | KEEP_STEP_IDENTIFIERS,
&nWrn, &nErr, &error, NULL);
/* Get the modelId of the data model */
rstat = edmiRemoteGetModelBN(myContext, "OurRemoteRepository",
"OurRemoteModel", &modelId, NULL);
printf("Created model %s with modelId %d",
"OurRemoteModel", modelId);
/* Get the modelId of the step identifyer model */
rstat = edmiRemoteGetModelBN(myContext, "OurRemoteRepository",
"OurRemoteModel_EDM_STEPID_",
&stepModelId, NULL);
printf("Created stepId model %s with modelId %d",
"OurRemoteModel_EDM_STEPID_", stepModelId);
/* Get the instanceId that corresponds to
the ISO10303-21 StepIdentifyer #1. */
rstat = edmiRemoteGetInstanceOfStepId(myContext,
modelId, 1, &instId, NULL);
/* Get the ISO10303-21 StepIdentifyer that
corresponds to the instance Id.
That, of course, will be 1 */
rstat = edmiRemoteGetStepIdOfInstance(myContext,
instId, &stepId, NULL);
/* Delete instance with stepId #1 */
rstat = edmiRemoteDeleteInstance(myContext, instId, 0, NULL);
/* Write the modified population
back on a step physical file.
The step identifyers in this file
will equal to those in the input file,
except that the stepId #1 will be gone. */
rstat = edmiRemoteWriteStepFile(myContext,
"OurRemoteRepository", "OurRemoteModel",
NULL, NULL, "c:/data/new_population.stp",
NULL, NULL, KEEP_STEP_IDENTIFIERS, 6,
&nWrn, &nErr, &error, NULL);
. . .