//The main method of the class - processes string containing G-code to the vector of commands for the interpreter
bool GCodeInterpreter::ProcessString(string code, vector<ProcessedData>& output, vector<PathPartSimple>* simpleOutput, vector<PathPartSimple>* offsetOutput)
{
	//Prepare
	output.clear();
	this->output = &output;
	try
	{
		LoadConfiguration();
		ParseCodeToPath(code);
		PostProcessPath();
		//assert(IsPathValid());
		if(simpleOutput)
			CreateSimpleOutput(simpleOutput);
		if(offsetOutput)
			CreateOffsetOutput(offsetOutput);
		TunePath();
		assert(IsPathValid());
		TransformPathToCommands();
	}
	catch(exception ex)
	{
		wxString text(ex.what(), *wxConvCurrent);
		wxMessageBox(text, wxT("Chyba!"), wxOK | wxICON_EXCLAMATION);
		return false;
	}
	//Clean
	commands.clear();
	path.clear();
	return true;
}
Exemplo n.º 2
0
void CPage6::OnItemexpanding(NMHDR *pNMHDR, LRESULT *pResult)
{

	LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
	HTREEITEM hItem = pNMTreeView->itemNew.hItem;
	CString strPathName = GetPathFromItem (hItem);

	if (!IsMediaValid (strPathName)) 
	{
		HTREEITEM hRoot = GetDriveNode (hItem);
		m_FileTree.Expand (hRoot, TVE_COLLAPSE);
		DeleteChildren (hRoot);
		AddDummyNode (hRoot);
		*pResult = TRUE;
		return;
	}


	if (!IsPathValid (strPathName)) 
	{
		if(strPathName != MYCOMPUTER && strPathName != "")
		{
			m_FileTree.DeleteItem (hItem);
			*pResult = TRUE;
			return;
		}
	}

	CWaitCursor wait;
	
	if (pNMTreeView->action == TVE_EXPAND) 
	{
		if(strPathName != MYCOMPUTER)
		{
			DeleteChildren (hItem);
			if (!AddDirectoryNodes (hItem, strPathName))
				*pResult = TRUE;
		}
	}
	else {
		if(strPathName != MYCOMPUTER)
		{
			DeleteChildren (hItem);
			if (IsDriveNode (hItem))
				AddDummyNode (hItem);
			else
				SetButtonState (hItem, strPathName);
		}
	}

	m_LocalPath = strPathName;


	*pResult = 0;
}
Exemplo n.º 3
0
char *ExternalBlastTool :: GetResults (BlastFormatter *formatter_p)
{
	char *results_s = NULL;

	if (ebt_results_filename_s)
		{
			if (formatter_p && (bt_output_format != BS_DEFAULT_OUTPUT_FORMAT))
				{
					results_s = formatter_p -> GetConvertedOutput (ebt_results_filename_s, bt_output_format);

					if (!results_s)
						{
							PrintErrors (STM_LEVEL_SEVERE, __FILE__, __LINE__, "Failed to format %s to " UINT32_FMT, ebt_results_filename_s, bt_output_format);
						}

				}		/* if (formatter_p && (bt_output_format != BS_DEFAULT_OUTPUT_FORMAT)) */
			else
				{
					if (IsPathValid (ebt_results_filename_s))
						{
							results_s = GetFileContentsAsStringByFilename (ebt_results_filename_s);

							if (!results_s)
								{
									PrintErrors (STM_LEVEL_SEVERE, __FILE__, __LINE__, "Failed to read data from  %s", ebt_results_filename_s);
								}

						}		/* if (IsPathValid (ebt_results_filename_s)) */
					else
						{
							PrintErrors (STM_LEVEL_INFO, __FILE__, __LINE__, "File %s does not exist", ebt_results_filename_s);

						}
				}
		}		/* if (ebt_results_filename_s) */
	else
		{
			char uuid_s [UUID_STRING_BUFFER_SIZE];

			ConvertUUIDToString (bt_job_p -> bsj_job.sj_id, uuid_s);
			PrintErrors (STM_LEVEL_SEVERE, __FILE__, __LINE__, "Results output object is NULL for \"%s\"", uuid_s);
		}

	return results_s;
}