AnimatLab  2
Test
PyAnimatSimTest.cpp
1 
2 #include "StdAfx.h"
3 
4 int main(int argc, const char **argv)
5 {
6 
7 try
8 {
9  std::string strExePath = Std_ExecutablePath();
10  std::string strExecutablePath, strExeFile;
11  Std_SplitPathAndFile(strExePath, strExecutablePath, strExeFile);
12  std::string strProjFile = "";
13 
14 #ifdef _DEBUG
15  strProjFile = strExecutablePath + "../Tutorials/Examples/StandAloneSimTest/Bullet_Single_x32_debug.asim";
16 #else
17  strProjFile = strExecutablePath + "../Tutorials/Examples/StandAloneSimTest/Bullet_Single_x32.asim";
18 #endif
19 
20  SimulationMgr *lpSimMgr = new SimulationMgr();
21 
22  SimulationThread *lpThread = lpSimMgr->CreateSimulation(strProjFile);
23 
24  AnimatBase *lpNeuron = lpThread->Sim()->FindByID("0825d6e6-ebc4-4d4e-8c87-1fd06f821916");
25 
26  float fltVth = -0.050f;
27  for(int iIdx=0; iIdx<1; iIdx++)
28  {
29  lpNeuron->SetData("Vth", fltVth);
30 
31  lpThread->Simulate(0.5f);
32 
33  fltVth-=-0.02f;
34  }
35 
36  lpSimMgr->ShutdownAllSimulations();
37 
38  if(lpSimMgr)
39  delete lpSimMgr;
40 }
41 catch(char *str)
42 {
43  printf("Error occurred: %s\n", str) ;
44  return -1;
45 }
46 catch(...)
47 {
48  printf("An Unknown Error occurred.\n") ;
49  return -1;
50 }
51 }
void Std_SplitPathAndFile(std::string &strFullPath, std::string &strPath, std::string &strFile)
Splits the path from the actual filename.
std::string Std_ExecutablePath()
Finds the name and path of the current executable.