hexagon logo

Problem on adding BsicScan Points with C++

Hello,everyone,
I have learned a little about using C++ for PC_DMIS secondary development.
Here I am using BasicScan Object to add scan points,there were some errows happend caused that 0 points were generated.But I don't know why...
Here is a part of my code.Rolling eyes  ​Any comments are welcome...Wink

IApplication App;
IPartPrograms Ppms;
IPartProgram Ppm;
ICommands Cmds;
ICommand Cmd;

IBasicScan Bscn;
IPoint MS;
IPoint CP;
IPoint IT;


void CTest_01Dlg::OnAddCmd()
{
// declare variables
IBasicScan Bscn;
IPoint MS;
IPoint CP;
IPoint IT;

if(!ConnectPcdmis()) // Connect PC_DMIS,if failed , exit
{
return;
}
// Check if there is an open measuring program. If not, an error is reported
if(Ppms.GetCount() < 1)
{
AfxMessageBox("You need to open at least one measurement program to do this~",MB_ICONWARN ING);
ReleasePcdmis();
return;
}
Ppm = App.GetActivePartProgram(); // Connect to the current PC_DMIS measurement program

// Test section, add command
Cmds = Ppm.GetCommands(); // Connect to the set of commands for this measure

// Cmds.AddCmdOfName(214,TRUE,"demo.PRG"); // add command 214
// Cmds.Add(214,TRUE);

/*
CString temp;
temp.Format(_T("%d"),Cmds.GetCount());
AfxMessageBox(temp);
*/

Cmd = Cmds.AddCmdOfName(214,FALSE,"demo.PRG");

Bscn = Cmd.GetBasicScanCommand();

Bscn.SetMethod(100125);

Bscn.SetMethodParams(2, 1, 1, 23.5,180,-5,0);

MS.XYZ(-30.75,111,13); // MethodStart(-30.75,111,13)
CP.IJK(0,0,-1); // CutPlane(0,0,-1)
IT.IJK(1,0,0); // InitTouch(1,0,0)

Bscn.SetMethodStart(MS);
Bscn.SetMethodCutPlane(CP);
Bscn.SetMethodInitTouch(IT);

Bscn.GenerateScan();

Bscn.CreateBasicScan();


}