11
Mach SDK plugin questions and answers. / Re: Plugin problems with Mach3 functions
« on: December 03, 2010, 06:31:00 AM »
looks like the program cannot find the interop.Mach4.1.0.dll, anyone knows how to solve it? please...
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
private: System::Void iniciarButton_Click(System::Object^ sender, System::EventArgs^ e) {
String^ selectedNorma = (String^)(this->normaComboBox->SelectedItem);
string text[5], outputGcode[1024];
int pseudoId = this->normaComboBox->SelectedIndex;
string tempText[5];
char *stochar, *charToAng, *gCode, *gCodeTemp;
float angA = 0.0, angB = 0.0;
string commA, commB; //, gCodeTemp;
int minCDi, maxCDi, ordemi[80], indexOfString, lastOrder = 0;
gCodeTemp = (char*) malloc(sizeof(char)*128);
int comm1;
myDatabase conexao("*******", "*******", "*****", "*****", "norma");
int numf = conexao.search("norma", "id", "name");
int idFinal = conexao.stringAnswer( pseudoId, 0);
string descricao = conexao.searchDesc(idFinal);
this->descricaoDaNormaTextBox->Text = convertion( descricao);
int numberOfRows = conexao.searchAngulos("angulos", idFinal, 0);
if( this->fotometro25MRadioButton->Checked == 1){
comm1 = 4;
}else{
comm1 = 3;
}
int tempoDeInicio = atoi(convertion(this->aquecimentoInicialTextBox->Text));
int tempoDeAquecimento = atoi(convertion(this->aquecimentoTextBox->Text));
tempoDeInicio *= 60;
tempoDeAquecimento *= 60;
for( int i = 0, k = 0, j = 0; i < 80; i++){
text[k] = conexao.stringAnswer( j++); //anguloA
if( !text[k].empty()){
tempText[k] = text[k];
stochar = (char*) text[k].c_str();
if( (indexOfString = text[k].find_first_of( 'D', 0)) >= 0 ){
tempText[k].erase( indexOfString, 1);
commA = "D";
}else if( (indexOfString = text[k].find_first_of( 'U', 0)) >= 0 ){
tempText[k].erase( indexOfString, 1);
commA = "U";
}else if( (indexOfString = text[k].find_first_of( 'R', 0)) >= 0 ){
tempText[k].erase( indexOfString, 1);
commA = "R";
}else if( (indexOfString = text[k].find_first_of( 'L', 0)) >= 0 ){
tempText[k].erase( indexOfString, 1);
commA = "L";
}
angA = atof((char*) text[k].c_str());
switch( commA.at(0)){
case 'U':
commA = "A";
break;
case 'D':
commA = "A";
angA *= -1.0;
break;
case 'R':
commA = "B";
break;
case 'L':
commA = "B";
angA *= -1.0;
break;
}
}
k++;
text[k] = conexao.stringAnswer( j++); //anguloB
if( !text[k].empty()){
tempText[k] = text[k];
stochar = (char*) text[k].c_str();
if( (indexOfString = text[k].find_first_of( 'D', 0)) >= 0 ){
tempText[k].erase( indexOfString, 1);
commB = "D";
}else if( (indexOfString = text[k].find_first_of( 'U', 0)) >= 0 ){
tempText[k].erase( indexOfString, 1);
commB = "U";
}else if( (indexOfString = text[k].find_first_of( 'R', 0)) >= 0 ){
tempText[k].erase( indexOfString, 1);
commB = "R";
}else if( (indexOfString = text[k].find_first_of( 'L', 0)) >= 0 ){
tempText[k].erase( indexOfString, 1);
commB = "L";
}
angB = atof((char*) text[k].c_str());
switch( commB.at(0)){
case 'U':
commB = "A";
break;
case 'D':
commB = "A";
angB *= -1.0;
break;
case 'R':
commB = "B";
break;
case 'L':
commB = "B";
angB *= -1.0;
break;
}
}
k++;
text[k] = conexao.stringAnswer( j++);//ordem
if( !text[k].empty()){
stochar = (char*) text[k].c_str();
ordemi[i] = atoi(stochar);
if(lastOrder < ordemi[i])
lastOrder = ordemi[i];
}else{
//sprintf( gCodeTemp, "%i", lastOrder);
//outputGcode[1023] = (string) gCodeTemp;
break;
}
k = 0;
strcpy( gCodeTemp, "");
sprintf( gCodeTemp, "G01 %c%.2f %c%.2f", commA.at(0), angA, commB.at(0), angB);
outputGcode[ordemi[i]] = (string) gCodeTemp;
}
ofstream saveFile;
char data[1024];
this->tempoDeParada = atoi(convertion(this->tempoDePausaTextBox->Text));
saveFile.open( "code.g");
saveFile << ";(Medição - lâmpada fria)";
saveFile << "G0 A0 B0 (posiciona no eixo 0)\n";
saveFile << "G4 P" << tempoDeInicio << " (tempo de preaquecimento)\n";
for(int j = 0; j < lastOrder; j++ ){
saveFile << outputGcode[ordemi[j]] << " (posiciona os eixos A e B)\n";
saveFile << "G4 P" << tempoDeParada << " (tempo de espera antes da medição)\n";
saveFile << "M" << comm1 << " (aciona leitura de medição, M3 = comm1, M4 = comm2)\n";
}
saveFile << "G0 A0 B0 (posiciona no eixo 0)\n";
saveFile << ";(Medição - lâmpada quente)\n";
saveFile << "G4 P" << tempoDeAquecimento << " (tempo de aquecimento para medição nova)\n";
for(int j = 0; j < lastOrder; j++ ){
saveFile << outputGcode[ordemi[j]] << " (posiciona os eixos A e B)\n";
saveFile << "G4 P" << tempoDeParada << " (tempo de espera antes da medição)\n";
saveFile << "M" << comm1 << " (aciona leitura de medição)\n";
}
saveFile << "G0 A0 B0 (posiciona no eixo 0)\n";
saveFile.close();
free( gCodeTemp);
}
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in System.Windows.Forms.dll
Additional information: Was not possible to load file of assembly 'Interop.Mach4.1.0, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencys. The system could not find the specified file.