I think I have it in my minds eye how I want to build this heekscad constraint tester.
Ultimately, I want to move this thing in the code like a probe on a mutlimeter to figure out where things are going are going south. To start out I want to create something on the menu bar. I think I’m going to call it “Constraint Tester” as I think Alt-C is available
So I think if I search for “Set Origin” I should be able to find what I need to plug into.
Ok… Just need to keep track of a few things here.
src/stdafx.h
//JT THIS IS ATTEMPT TO CREATE A TEST PROBE FUNCTION THAT CAN BE USED TO IDENTIFY ROOT CAUSE OF CONSTRAINT ERROR
#define CONSTRAINT_TESTER#ifdef CONSTRAINT_TESTER
#define FIRE_CONSTRAINT_TESTER_FROM_MAIN_MENU#endif
Ok… Brain is a little dusty on wxMenubar
Ok… to the tutorials.
http://zetcode.com/tutorials/wxwidgetstutorial/menustoolbars/
…….
// Window Menu
m_menuWindow = new wxMenu;
AddMenuItem(m_menuWindow, _(“Objects”), wxBitmap(), OnViewObjects, OnUpdateViewObjects, NULL, true);
AddMenuItem(m_menuWindow, _(“Log”), wxBitmap(), OnLog);
AddMenuItem(m_menuWindow, _(“Options”), wxBitmap(), OnViewOptions, OnUpdateViewOptions, NULL, true);
AddMenuItem(m_menuWindow, _(“Input”), wxBitmap(), OnViewInput, OnUpdateViewInput, NULL, true);
AddMenuItem(m_menuWindow, _(“Properties”), wxBitmap(), OnViewProperties, OnUpdateViewProperties, NULL, true);
AddMenuItem(m_menuWindow, _(“Tool Bar”), wxBitmap(), OnViewToolBar, OnUpdateViewToolBar, NULL, true);
AddMenuItem(m_menuWindow, _(“Solids Tool Bar”), wxBitmap(), OnViewSolidBar, OnUpdateViewSolidBar, NULL, true);
AddMenuItem(m_menuWindow, _(“Geometry Tool Bar”), wxBitmap(), OnViewGeometryBar, OnUpdateViewGeometryBar, NULL, true);
AddMenuItem(m_menuWindow, _(“Viewing Tool Bar”), wxBitmap(), OnViewViewingBar, OnUpdateViewViewingBar, NULL, true);
AddMenuItem(m_menuWindow, _(“Status Bar”), wxBitmap(), OnViewStatusBar, OnUpdateViewStatusBar, NULL, true);//JT
#ifdef FIRE_CONSTRAINT_TESTER_FROM_MAIN_MENU
wxMenu * m_menuConstraintTester = new wxMenu;
AddMenuItem(m_menuConstraintTester, _(“Validate Constraints”), wxBitmap(), OnTestConstraint);#endif
……….
// Add them to the main menu
m_menuBar = new wxMenuBar;
m_menuBar->Append( file_menu, _( “&File” ) );
m_menuBar->Append( edit_menu, _( “&Edit” ) );
m_menuBar->Append( view_menu, _( “&View” ) );
m_menuBar->Append( geometry_menu, _( “&Geometry” ) );
m_menuBar->Append( solids_menu, _( “&Solid” ) );
m_menuBar->Append( coordinate_menu, _( “&Set Origin” ) );
m_menuBar->Append( transform_menu, _( “&Transform” ) );
m_menuBar->Append( m_menuWindow, _( “&Window” ) );//JT
#ifdef FIRE_CONSTRAINT_TESTER_FROM_MAIN_MENUm_menuBar->Append( m_menuConstraintTester, _( “&Constraint Tester” ) );
#endif
src/HeeksFrame.h
I thought I was going to need something here but turns out I didn’t
src/HeeksCAD.h
//JT
#ifdef CONSTRAINT_TESTER
bool TestForValidConstraints();
#endif
src/HeeksCAD.cpp
void HeeksCADapp::RegisterOnBuildTexture(void(*callbackfunc)())
{
m_on_build_texture_callbacks.push_back(callbackfunc);
}#ifdef CONSTRAINT_TESTER
bool HeeksCADapp::TestForValidConstraints();
{
wxMessageBox(_(“Hello World”));
}
#endif
src/HeeksFrame.cpp
static void OnMoveScaleButton( wxCommandEvent& event )
{
TransformTools::Scale(false);
}//JT
#ifdef FIRE_CONSTRAINT_TESTER_FROM_MAIN_MENU
static void OnTestConstraint( wxCommandEvent& event )
{
wxGetApp().TestForValidConstraints();
}
#endif
http://docs.wxwidgets.org/2.6/wx_appinifunctions.html#wxgetapp
Nothing worthy of committed yet. But I think I have a place to write some code.
I think my next step is to research HeeksCADapp::SaveFile a bit. I’m tired… Sorry world about the typo’s