Explorations of the heekcad setPointFixedconstraint.

Long stressful day today, I thought I’d relax a little a do a little code exploration.  I thought I’d step through what’s going on with the setPointFixed constraint and see if I can have an aha moment as to why this silly thing wont save.  I need to unpeel some layers to try to understand the overall architecture of this software.

As far as I’m aware there are least two ways of set a setPointFixed constraint:

  • Selected a point in the menu tree and right clicking to select “Toggle Fixed”
  • Click on sketcher background, click the line, get close to the point and the right click points=>

I set a break point on src/ConstrainedObject.cpp in the  member function[?] and set it off  using the treeview.

void ConstrainedObject::SetPointFixedConstraint()
{
if(RemoveExisting(NULL,FixedPointConstraint)) return;

Constraint *c = new Constraint(FixedPointConstraint,this);
constraints.push_back(c);
}

It seems both the tree click and direct click on the sketch seem stop at this break point.
I was curious to see what initiated these calls so I shift-ctrl F7’d to where it looks like these calls originated.
When clicking on tree view things see to get going from:
src/TreeCanvas.cpp

void CTreeCanvas::OnMenuEvent(wxCommandEvent& event)
{
wxGetApp().on_menu_event(event);
}

which goes to src/HeeksCAD.cpp:

IMPLEMENT_APP(HeeksCADapp)

Which goes to app.h

static wxAppConsole *GetInstance() { return ms_appInstance

This is now into wxwigets stuff which is deeper than I care to go at this point.
sooo shift-Ctrl F7 to backout.
Getting tired here and I it’s not too late yet… So time to pack it in… Perhaps I’ll have some time in the morning to poke at this some more.

———————————————————————————————————————–

[Edit.. 9/23/10.. Got a good nights rest… Got a hour +1 to play in the before work… Let see
Ehh.  My apologises to anyone reading my dribble on my punctuation, grammar and spelling…
I backed up using the tree view, I wonder where things back up from the break point using the sketch?

void ConstrainedObject::SetPointFixedConstraint()
{
if(RemoveExisting(NULL,FixedPointConstraint)) return;

Constraint *c = new Constraint(FixedPointConstraint,this);
constraints.push_back(c);
}

Oh… Just a quick side note. I was yakking on the irc and sliptonic mentioned thingiverse to me. I never heard of that before. I poked around this site and ran across this gem: http://www.thingiverse.com/thing:4096 My no so little little one, wanted to know when the toy machine was going to be built….(no pressure here).

Back to business.

class SetPointFixed:public Tool{
public:
void Run(){
point_for_tool->SetPointFixedConstraint();
SolveSketch((CSketch*)point_for_tool->Owner());
wxGetApp().Repaint();
}
const wxChar* GetTitle(){return _(“Toggle Fixed”);}
wxString BitmapPath(){return _T(“new”);}
const wxChar* GetToolTip(){return _(“Set this point as fixed”);}
};

I just noticed that when I shift-ctrl F7 it advances to the next line.. Opps.. I wonder if there is a way to view a call stack in code::blocks? Well according to http://www.codeblocks.org/features there is…
Just got my answer:
http://ubuntuforums.org/showthread.php?t=1580315

Hmm.. This does seem to be much more efficient than what I was doing:

#0 ( SetPointFixed::Run(this=0x83785d4) (/home/jonas/HeeksCAD/src/HPoint.cpp:137)
#1 0x81426ce HeeksCADapp::on_menu_event(this=0x849ef18, event=…) (/home/jonas/HeeksCAD/src/HeeksCAD.cpp:1939)
#2 0x81082e0 CGraphicsCanvas::OnMenuEvent(this=0x8727f70, event=…) (/home/jonas/HeeksCAD/src/GraphicsCanvas.cpp:396)
#3 0xb77c2a9f wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&) (/usr/lib/libwx_baseu-2.8.so.0:??)
#4 0xb7861209 wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () (/usr/lib/libwx_baseu-2.8.so.0:??)
#5 0xb78622d4 wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () (/usr/lib/libwx_baseu-2.8.so.0:??)
#6 0xb78623d3 wxEvtHandler::ProcessEvent(wxEvent&) () (/usr/lib/libwx_baseu-2.8.so.0:??)
#7 0xb7b2b1dd wxMenuBase::SendEvent(int, int) () (/usr/lib/libwx_gtk2u_core-2.8.so.0:??)
#8 0xb7aaedf0 ??() (/usr/lib/libwx_gtk2u_core-2.8.so.0:??)
#9 0xb3449dcc g_cclosure_marshal_VOID__VOID() (/usr/lib/libgobject-2.0.so.0:??)
#10 0xb343c252 g_closure_invoke() (/usr/lib/libgobject-2.0.so.0:??)
#11 0xb345099d ??() (/usr/lib/libgobject-2.0.so.0:??)
#12 0xb3451db4 g_signal_emit_valist() (/usr/lib/libgobject-2.0.so.0:??)
#13 0xb3452256 g_signal_emit() (/usr/lib/libgobject-2.0.so.0:??)
#14 0xb39593e5 gtk_widget_activate() (/usr/lib/libgtk-x11-2.0.so.0:??)
#15 0xb38379a0 gtk_menu_shell_activate_item() (/usr/lib/libgtk-x11-2.0.so.0:??)
#16 0xb383931f ??() (/usr/lib/libgtk-x11-2.0.so.0:??)
#17 0xb382ec64 ??() (/usr/lib/libgtk-x11-2.0.so.0:??)
#18 0xb3828424 ??() (/usr/lib/libgtk-x11-2.0.so.0:??)
#19 0xb343a8b9 ??() (/usr/lib/libgobject-2.0.so.0:??)
#20 0xb343c252 g_closure_invoke() (/usr/lib/libgobject-2.0.so.0:??)
#21 0xb34505e6 ??() (/usr/lib/libgobject-2.0.so.0:??)
#22 0xb3451c33 g_signal_emit_valist() (/usr/lib/libgobject-2.0.so.0:??)
#23 0xb3452256 g_signal_emit() (/usr/lib/libgobject-2.0.so.0:??)
#24 0xb3955636 ??() (/usr/lib/libgtk-x11-2.0.so.0:??)
#25 0xb3820a5d gtk_propagate_event() (/usr/lib/libgtk-x11-2.0.so.0:??)
#26 0xb3821e07 gtk_main_do_event() (/usr/lib/libgtk-x11-2.0.so.0:??)
#27 0xb36ab39a ??() (/usr/lib/libgdk-x11-2.0.so.0:??)
#28 0xb338d5e5 g_main_context_dispatch() (/lib/libglib-2.0.so.0:??)
#29 0xb33912d8 ??() (/lib/libglib-2.0.so.0:??)

Awe man… Time to get ready for work ;(
But first I’m going to try this with the tree view and see what happens:

#0 ( ConstrainedObject::SetPointFixedConstraint(this=0x8773db8) (/home/jonas/HeeksCAD/src/ConstrainedObject.cpp:347)
#1 0x812bcd3 SetPointFixed::Run(this=0x83785d4) (/home/jonas/HeeksCAD/src/HPoint.cpp:136)
#2 0x81426ce HeeksCADapp::on_menu_event(this=0x849ef18, event=…) (/home/jonas/HeeksCAD/src/HeeksCAD.cpp:1939)
#3 0x81fc018 CTreeCanvas::OnMenuEvent(this=0x85e4100, event=…) (/home/jonas/HeeksCAD/src/TreeCanvas.cpp:311)
#4 0xb77c2a9f wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&) (/usr/lib/libwx_baseu-2.8.so.0:??)
#5 0xb7861209 wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () (/usr/lib/libwx_baseu-2.8.so.0:??)
#6 0xb78622d4 wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () (/usr/lib/libwx_baseu-2.8.so.0:??)
#7 0xb78623d3 wxEvtHandler::ProcessEvent(wxEvent&) () (/usr/lib/libwx_baseu-2.8.so.0:??)
#8 0xb7862369 wxEvtHandler::ProcessEvent(wxEvent&) () (/usr/lib/libwx_baseu-2.8.so.0:??)
#9 0xb7b8d8e6 wxScrollHelperEvtHandler::ProcessEvent(wxEvent&) () (/usr/lib/libwx_gtk2u_core-2.8.so.0:??)
#10 0xb7b2b1dd wxMenuBase::SendEvent(int, int) () (/usr/lib/libwx_gtk2u_core-2.8.so.0:??)
#11 0xb7aaedf0 ??() (/usr/lib/libwx_gtk2u_core-2.8.so.0:??)
#12 0xb3449dcc g_cclosure_marshal_VOID__VOID() (/usr/lib/libgobject-2.0.so.0:??)
#13 0xb343c252 g_closure_invoke() (/usr/lib/libgobject-2.0.so.0:??)
#14 0xb345099d ??() (/usr/lib/libgobject-2.0.so.0:??)
#15 0xb3451db4 g_signal_emit_valist() (/usr/lib/libgobject-2.0.so.0:??)
#16 0xb3452256 g_signal_emit() (/usr/lib/libgobject-2.0.so.0:??)
#17 0xb39593e5 gtk_widget_activate() (/usr/lib/libgtk-x11-2.0.so.0:??)
#18 0xb38379a0 gtk_menu_shell_activate_item() (/usr/lib/libgtk-x11-2.0.so.0:??)
#19 0xb383931f ??() (/usr/lib/libgtk-x11-2.0.so.0:??)
#20 0xb382ec64 ??() (/usr/lib/libgtk-x11-2.0.so.0:??)
#21 0xb3828424 ??() (/usr/lib/libgtk-x11-2.0.so.0:??)
#22 0xb343a8b9 ??() (/usr/lib/libgobject-2.0.so.0:??)
#23 0xb343c252 g_closure_invoke() (/usr/lib/libgobject-2.0.so.0:??)
#24 0xb34505e6 ??() (/usr/lib/libgobject-2.0.so.0:??)
#25 0xb3451c33 g_signal_emit_valist() (/usr/lib/libgobject-2.0.so.0:??)
#26 0xb3452256 g_signal_emit() (/usr/lib/libgobject-2.0.so.0:??)
#27 0xb3955636 ??() (/usr/lib/libgtk-x11-2.0.so.0:??)
#28 0xb3820a5d gtk_propagate_event() (/usr/lib/libgtk-x11-2.0.so.0:??)
#29 0xb3821e07 gtk_main_do_event() (/usr/lib/libgtk-x11-2.0.so.0:??)

Yikess.. t2sss
I’m going to need to redo my blog… dont’ like how its displaying… ;(

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *