Even more Polyline Arc stuff for freecad

Well, life seems to in one of these modes where I’m busy as heck and not feeling like I have a lot to show for it.    It’s been a few weeks since I looked at that freecad stuff, so all the insites that I’ve had have gone a bit fuzzy.

On the workshop side of things, I want to cut some slots with my metal shaper and I was reflecting one how cool it would be if I had a automatic  downfeed.  I have my project that I was working on over Christmas break.  So I think I might be bouncing around projects on this lovely saturday.

When I last left off on this I seemed to think this is where I need to  set break points:
class DrawSketchHandlerLineSet: public DrawSketchHandler
in function:
virtual bool releaseButton(Base::Vector2D onSketchPos)

I was talking about this in the freecad forum. https://sourceforge.net/apps/phpbb/free-cad/viewtopic.php?f=10&t=2097&start=20

Ok… I think may have narrowed in on the section of code that I need to hack..

So the next thing I need to figure out is how freecad how free cad stores a character during a keypress event.  (hopefully this will be relatively painless?)

I think I might have found something promising in:

 

I was able to set a breakpoint on keypressing during a sketch which looks real promising here:

 

 

 

 

 

So I think I need to examine the call stack at this point..  What I need to figure out is how to get a the keypress value at this point.

void ViewProvider::eventCallback(void * ud, SoEventCallback * node)

From the IRC these suggestions came about:

http://qt-project.org/doc/qt-4.8/qt.html#KeyboardModifier-enum

It seems like you can easily test to see if an alt ctrl etc… is pressed but not an “a”

http://qt-project.org/doc/qt-4.8/qapplication.html#keyboardModifiers

It seems like going with a keyboard modifier would be easiest… but I’m not sure that’s the best approach..

I threw the question out to the free-cad forum: https://sourceforge.net/apps/phpbb/free-cad/viewtopic.php?f=10&t=2386

Time to cut a few chips in the workshop.

 

 

Posted in Uncategorized | Leave a comment

On the road of the freecad polyline arc.

I’ve been distracted from freecad for the last couple of weeks.     I’ve  had a lot of fun developing a arduino controlled trigger for a trebuchet.  I should post some pictures and the code..  Anyway.. It’s been a week or so since I’ve updated the source.

To freshen things up this should work from the master branch:

 

git pull origin master

At some point, I need to get more versed in git…
After doing a little with googling I ran across this tutorial that caught my eye.
http://www-cs-students.stanford.edu/~blynn//gitmagic/index.html

This seems to be rather interesting..
So I

Posted in Uncategorized | Leave a comment

Even more on integrating the Arc into the polyline.

I think I’m honing in on the code where I would need add code to change a line to a polyline. I’m starting to run into coin3d stuff. I never worked with coin3d so I need to do a little research here just to understand what’s going on.

http://www.coin3d.org/coin3d_news/coin3d-and-qt-tutorial/
This links to a short(8page) and terse PDF that explains soQT and I was following along to about page 4. ;( Not so much that I didn’t understand… More like information overload..
So.. up to now, I’ve been playing in the layers of the the code where we’re in the sketch and interacting with the events. This hasn’t been too bad, it all makes sense to me. This soQT stuff seems somewhat similar to my journey into Ogre (which makes sense but it’s still a bit fuzzy too me). I’m still fuzzy on the layers that interact with opencascade. Hopefully, all will be revealed as I hammer through this…

It is important to note:

“that SoQt classes are NOT instances of QWidget or QObject. SoQt uses delegation rather than
inheritance to integrate with Qt. This allows greater flexibility and a cleaner architecture. Internally, SoQt creates an
instance of a QGLWidget to perform rendering.”

For a brief refresher on delegates.
http://en.wikipedia.org/wiki/Delegation_pattern#C.2B.2B_example_.28complex.29
I think there’s a lot of that going on..

4 Displaying a Scenegraph
Just need to refresh on a couple topics:
http://en.wikipedia.org/wiki/Abstract_data_type
http://en.wikipedia.org/wiki/Subclass_%28computer_science%29#Subclasses_and_superclasses

4.1 Inheritance hierarchy of Viewers
This section makes a lot of sense to me and it talks about the object hierarchy of soQT.

Basically what they said, was that the bottommost class can do a lot of things without a lot of programming but are the lease flexible for customization. Makes perfect sense..
So the thought that crosses my mind is what level is the sketcher working at in freecad..
SoQtFlyViewer (231 Matches)
src/3rdParty/Pivy (1 File)
src/Gui (1 File)

SoQtConstrainedView (135 Matches)
src/3rdParty/Pivy

SoQtExaminerViewer(296 Matches)
src/3rdParty/Pivy(1 file)
src/Gui(3 files)

SoQtplaneViewer (189 Matches)
src/3rdParty/Pivy(1 file)
src/Gui(1 files)

SoQtFullViewer (290 Matches)
src/3rdParty/Pivy(1 file)

SoQtViewer (991 Matches)
src/3rdParty/Pivy(1 file)
src/Gui(6 files)
src/Mod/Mesh/Gui(2 files)

SoQtRenderArea (846 Matches)
src/3rdParty/Pivy(1 file)
src/Gui(1 files)

SoQtGLWidget  (424 Matches)
src/3rdParty/Pivy(1 file)

SoQtComponent (413 Matches)

src/3rdParty/Pivy-0.5/s0qt_wrap.cpp

SoQtObject(107 Matches)
src/3rdParty/Pivy-0.5/s0qt_wrap.cpp

 

Oh Well… The house is just woke up… The dog’s are demanding pets and the family is hungry and wanting my fluffy waffles……

Basically what I get out this is it appears that freeCad focuses at the SoQtViewer levels.
Wife getting hungry and cranky….

Thats it for now
 

 

Posted in Uncategorized | Leave a comment

More on integrating an arc into polyline.

 

 

This post is some notes, I was keeping working out how free cad is put together.(This may not make sense to anyone other than me)
So.. freshly armed with Qt-Creator 2.4.1 I’m delving into freeCAD source once again.
There is all kind fun stuff in this code.  Anyway… What I want to do is to draw an Arc instead of a polyline when drawing in polyline mode and the left mouse button is released.

So.. I think the goals for me in this post:

  • Find the code line where the decision needs to be made to either continue with an arc or line.
  • Understand what defines polyline mode.

Seems like this should be simple enough chunk to digest in a couple of  gulps.  After that I need to see how to test for the keypress state and how to invoke the arc mode.  Anyway, that’s another step further down…

Ok.. I think whats going on is that events get processed through a base class?Gui::ViewProvider::eventCallback.  It looks like that perhaps the indivdual benches have there own implementation in virtual functions..
I believe my first goal is going to be found in:
bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVec3f &point,
const SbVec3f &normal, const SoPickedPoint *pp)

So.. Some how ViewProvider is provider is inherited by ViewProviderSketch..  (Hmm. Just a quick thought here if I do a search on ViewProvider I wonder what else pops up.  I’m seeing ViewProvider* stuff in Fem,Inspection… What a second… the filename ViewProvider.h shows up in a bunch a places in the code trunk.

jonas@jonas-laptop:~/freecad$ find -name ViewProvider.h
./free-cad/src/Mod/Points/Gui/ViewProvider.h
./free-cad/src/Mod/PartDesign/Gui/ViewProvider.h
./free-cad/src/Mod/Part/Gui/ViewProvider.h
./free-cad/src/Mod/Mesh/Gui/ViewProvider.h
./free-cad/src/Gui/ViewProvider.h

Hopefully I’ll have an aha moment when I dissect that, but at first glance that seems strange.

Anyway there seems to be a bunch of headers prefixed with viewProvider:

jonas@jonas-laptop:~/freecad$ find -name ViewProvider*.h
./free-cad/src/Mod/Inspection/Gui/ViewProviderInspection.h
./free-cad/src/Mod/Image/Gui/ViewProviderImagePlane.h
./free-cad/src/Mod/Points/Gui/ViewProvider.h
./free-cad/src/Mod/Robot/Gui/ViewProviderRobotObject.h
./free-cad/src/Mod/Robot/Gui/ViewProviderTrajectoryCompound.h
./free-cad/src/Mod/Robot/Gui/ViewProviderTrajectory.h
./free-cad/src/Mod/Robot/Gui/ViewProviderEdge2TracObject.h
./free-cad/src/Mod/Robot/Gui/ViewProviderTrajectoryDressUp.h
./free-cad/src/Mod/Fem/Gui/ViewProviderFemMesh.h
./free-cad/src/Mod/PartDesign/Gui/ViewProviderHole.h
./free-cad/src/Mod/PartDesign/Gui/ViewProviderChamfer.h
./free-cad/src/Mod/PartDesign/Gui/ViewProviderFillet.h
./free-cad/src/Mod/PartDesign/Gui/ViewProviderPocket.h
./free-cad/src/Mod/PartDesign/Gui/ViewProvider.h
./free-cad/src/Mod/PartDesign/Gui/ViewProviderRevolution.h
./free-cad/src/Mod/PartDesign/Gui/ViewProviderMainPart.h
./free-cad/src/Mod/PartDesign/Gui/ViewProviderPad.h
./free-cad/src/Mod/PartDesign/Gui/ViewProviderPatternRectangular.h
./free-cad/src/Mod/Drawing/Gui/ViewProviderView.h
./free-cad/src/Mod/Drawing/Gui/ViewProviderPage.h
./free-cad/src/Mod/Sketcher/Gui/ViewProviderPython.h
./free-cad/src/Mod/Sketcher/Gui/ViewProviderSketch.h
./free-cad/src/Mod/Part/Gui/ViewProviderCurveNet.h
./free-cad/src/Mod/Part/Gui/ViewProviderImport.h
./free-cad/src/Mod/Part/Gui/ViewProvider.h
./free-cad/src/Mod/Part/Gui/ViewProvider2DObject.h
./free-cad/src/Mod/Part/Gui/ViewProviderPython.h
./free-cad/src/Mod/Part/Gui/ViewProviderBoolean.h
./free-cad/src/Mod/Part/Gui/ViewProviderExtrusion.h
./free-cad/src/Mod/Part/Gui/ViewProviderMirror.h
./free-cad/src/Mod/Part/Gui/ViewProviderReference.h
./free-cad/src/Mod/Part/Gui/ViewProviderExt.h
./free-cad/src/Mod/Part/Gui/ViewProviderBox.h
./free-cad/src/Mod/Mesh/Gui/ViewProviderCurvature.h
./free-cad/src/Mod/Mesh/Gui/ViewProvider.h
./free-cad/src/Mod/Mesh/Gui/ViewProviderMeshNode.h
./free-cad/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.h
./free-cad/src/Mod/Mesh/Gui/ViewProviderPython.h
./free-cad/src/Mod/Mesh/Gui/ViewProviderTransform.h
./free-cad/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.h
./free-cad/src/Mod/Mesh/Gui/ViewProviderDefects.h
./free-cad/src/Gui/ViewProvider.h
./free-cad/src/Gui/ViewProviderPythonFeaturePy.h
./free-cad/src/Gui/ViewProviderDocumentObject.h
./free-cad/src/Gui/ViewProviderDocumentObjectPy.h
./free-cad/src/Gui/ViewProviderGeometryObject.h
./free-cad/src/Gui/ViewProviderExtern.h
./free-cad/src/Gui/ViewProviderVRMLObject.h
./free-cad/src/Gui/ViewProviderBuilder.h
./free-cad/src/Gui/ViewProviderAnnotation.h
./free-cad/src/Gui/ViewProviderPy.h
./free-cad/src/Gui/ViewProviderMeasureDistance.h
./free-cad/src/Gui/ViewProviderInventorObject.h
./free-cad/src/Gui/ViewProviderPythonFeature.h
./free-cad/src/Gui/ViewProviderDocumentObjectGroup.h
./free-cad/src/Gui/ViewProviderFeature.h
jonas@jonas-laptop:~/freecad$

I think I need to see the class declaration of ViewProviderSketch to see what gets inherited

class SketcherGuiExport ViewProviderSketch : public PartGui::ViewProvider2DObject, public Gui::SelectionObserver

A couple of thing here catch my eye here…
First off whats deal with “SketcherGuiExport”.
At first glance this doesn’t seem like a normal class definition.
It looks like SketcherGuiExport is declared in PreCompiled.h
#ifndef __PRECOMPILED_GUI__
#define __PRECOMPILED_GUI__

#include

// Importing of App classes
#ifdef FC_OS_WIN32
# define PartDesignExport __declspec(dllimport)
# define PartDesignGuiExport __declspec(dllexport)
# define PartExport __declspec(dllimport)
# define PartGuiExport __declspec(dllimport)
# define SketcherExport __declspec(dllimport)
# define SketcherGuiExport __declspec(dllimport)
#else // for Linux
# define PartDesignExport
# define PartDesignGuiExport
# define PartExport
# define PartGuiExport
# define SketcherExport
# define SketcherGuiExport
#endif
So.. In linux it’s normal C++ and in windows its got this __declspec(dllimport) ??  Ok.. So it’s a microsoft thing..

Ok… Back to business.. Some how ViewProviderSketch inherits ViewProvider.

Hopefully this doesn’t go down too many layers..
Need to look at the class declaration of ViewProvider2DObject which ViewProviderSketch inherits:

class PartGuiExport ViewProvider2DObject: public PartGui::ViewProviderPart

Which is inherited from:
#if defined(FC_USE_FAST_SHAPE_RENDERING)
class PartGuiExport ViewProviderPart : public ViewProviderPartExt
{
PROPERTY_HEADER(PartGui::ViewProviderPart);

public:
/// constructor
ViewProviderPart();
/// destructor
virtual ~ViewProviderPart();
};
#else
class PartGuiExport ViewProviderPart : public ViewProviderPartBase
{
PROPERTY_HEADER(PartGui::ViewProviderPart);

public:
/// constructor
ViewProviderPart();
/// destructor
virtual ~ViewProviderPart();
};
#endif

} // namespace PartGui
Heh.. A conditional class declaration depending on whether or not FC_USE_FAST_SHAPE_RENDERING is declared. Cool but this is starting to make my eyeballs ache. Ok.. I wonder where FC_USE_FAST_SHAPE_RENDERING is defined.

It seems to be defined in without much fanfare:


// Set this to use the fast rendering of shapes
#define FC_USE_FAST_SHAPE_RENDERING

in /home/jonas/freecad/free-cad/src/Mod/Part/Gui/ViewProvider.h
Soo.. it looks like this is path taken..

class PartGuiExport ViewProviderPartExt : public Gui::ViewProviderGeometryObject
And so on:

class GuiExport ViewProviderGeometryObject : public ViewProviderDocumentObject
And so on:

class GuiExport ViewProviderDocumentObject : public ViewProvider
{

I think we’re almost there:

class GuiExport ViewProvider : public App::PropertyContainer
There you go..
Wow that’s a lot of layers..  Ok..  Back to what I was trying to do here.

bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVec3f &point,
const SbVec3f &normal, const SoPickedPoint *pp)
{
assert(edit);

// Radius maximum to allow double click event
const int dblClickRadius = 5;

double x,y;
SbVec3f pos = point;
if (pp) {
const SoDetail *detail = pp->getDetail();
if (detail && detail->getTypeId() == SoPointDetail::getClassTypeId()) {
pos = pp->getPoint();
}
}

getCoordsOnSketchPlane(x,y,pos,normal);
snapToGrid(x, y);

// Left Mouse button ****************************************************
if (Button == 1) {
if (pressed) {
// Do things depending on the mode of the user interaction
switch (Mode) {
case STATUS_NONE:{
bool done=false;
// Double click events variables
SbTime tmp = (SbTime::getTimeOfDay() – prvClickTime);
float dci = (float) QApplication::doubleClickInterval()/1000.0f;
float length = (point – prvClickPoint).length();

if (edit->PreselectPoint != -1) {
//Base::Console().Log(“start dragging, point:%d\n”,this->DragPoint);
Mode = STATUS_SELECT_Point;
done = true;
} else if (edit->PreselectCurve != -1) {
//Base::Console().Log(“start dragging, point:%d\n”,this->DragPoint);
Mode = STATUS_SELECT_Edge;
done = true;
} else if (edit->PreselectCross != -1) {
//Base::Console().Log(“start dragging, point:%d\n”,this->DragPoint);
Mode = STATUS_SELECT_Cross;
done = true;
} else if (edit->PreselectConstraint != -1) {
//Base::Console().Log(“start dragging, point:%d\n”,this->DragPoint);
Mode = STATUS_SELECT_Constraint;
done = true;

}

if (done && length <  dblClickRadius && tmp.getValue() < dci) {
// Double Click Event Occured
editDoubleClicked();
// Reset Double Click Static Variables
prvClickTime = SbTime();
prvClickPoint = SbVec3f(0.0f, 0.0f, 0.0f);
Mode = STATUS_NONE;

} else {
prvClickTime = SbTime::getTimeOfDay();
prvClickPoint = point;
}

return done;
}
case STATUS_SKETCH_UseHandler:
return edit->sketchHandler->pressButton(Base::Vector2D(x,y));
default:
return false;
}
}
else {
// Do things depending on the mode of the user interaction
switch (Mode) {
case STATUS_SELECT_Point:
if (pp) {
//Base::Console().Log(“Select Point:%d\n”,this->DragPoint);
// Do selection
std::stringstream ss;
ss << “Vertex” << edit->PreselectPoint;

if (Gui::Selection().isSelected(getSketchObject()->getDocument()->getName()
,getSketchObject()->getNameInDocument(),ss.str().c_str()) ) {
Gui::Selection().rmvSelection(getSketchObject()->getDocument()->getName()
,getSketchObject()->getNameInDocument(), ss.str().c_str());
} else {
Gui::Selection().addSelection(getSketchObject()->getDocument()->getName()
,getSketchObject()->getNameInDocument()
,ss.str().c_str()
,pp->getPoint()[0]
,pp->getPoint()[1]
,pp->getPoint()[2]);
this->edit->DragPoint = -1;
this->edit->DragCurve = -1;
this->edit->DragConstraint = -1;
}
}
Mode = STATUS_NONE;
return true;
case STATUS_SELECT_Edge:
if (pp) {
//Base::Console().Log(“Select Point:%d\n”,this->DragPoint);
std::stringstream ss;
if (edit->PreselectCurve >= 0)
ss << “Edge” << edit->PreselectCurve;
else // external geometry
ss << “ExternalEdge” << -edit->PreselectCurve – 3;

// If edge already selected move from selection
if (Gui::Selection().isSelected(getSketchObject()->getDocument()->getName()
,getSketchObject()->getNameInDocument(),ss.str().c_str()) ) {
Gui::Selection().rmvSelection(getSketchObject()->getDocument()->getName()
,getSketchObject()->getNameInDocument(), ss.str().c_str());
} else {
// Add edge to the selection
Gui::Selection().addSelection(getSketchObject()->getDocument()->getName()
,getSketchObject()->getNameInDocument()
,ss.str().c_str()
,pp->getPoint()[0]
,pp->getPoint()[1]
,pp->getPoint()[2]);
this->edit->DragPoint = -1;
this->edit->DragCurve = -1;
this->edit->DragConstraint = -1;
}
}
Mode = STATUS_NONE;
return true;
case STATUS_SELECT_Cross:
if (pp) {
//Base::Console().Log(“Select Point:%d\n”,this->DragPoint);
std::stringstream ss;
switch(edit->PreselectCross){
case 0: ss << “RootPoint” ; break;
case 1: ss << “H_Axis”    ; break;
case 2: ss << “V_Axis”    ; break;
}

// If cross already selected move from selection
if (Gui::Selection().isSelected(getSketchObject()->getDocument()->getName()
,getSketchObject()->getNameInDocument(),ss.str().c_str()) ) {
Gui::Selection().rmvSelection(getSketchObject()->getDocument()->getName()
,getSketchObject()->getNameInDocument(), ss.str().c_str());
} else {
// Add cross to the selection
Gui::Selection().addSelection(getSketchObject()->getDocument()->getName()
,getSketchObject()->getNameInDocument()
,ss.str().c_str()
,pp->getPoint()[0]
,pp->getPoint()[1]
,pp->getPoint()[2]);
this->edit->DragPoint = -1;
this->edit->DragCurve = -1;
this->edit->DragConstraint = -1;
}
}
Mode = STATUS_NONE;
return true;
case STATUS_SELECT_Constraint:
if (pp) {

std::stringstream ss;
ss << “Constraint” << edit->PreselectConstraint;

// If the constraint already selected remove
if (Gui::Selection().isSelected(getSketchObject()->getDocument()->getName()
,getSketchObject()->getNameInDocument(),ss.str().c_str()) ) {
Gui::Selection().rmvSelection(getSketchObject()->getDocument()->getName()
,getSketchObject()->getNameInDocument(), ss.str().c_str());
} else {
// Add constraint to current selection
Gui::Selection().addSelection(getSketchObject()->getDocument()->getName()
,getSketchObject()->getNameInDocument()
,ss.str().c_str()
,pp->getPoint()[0]
,pp->getPoint()[1]
,pp->getPoint()[2]);
this->edit->DragPoint = -1;
this->edit->DragCurve = -1;
this->edit->DragConstraint = -1;
}
}
Mode = STATUS_NONE;
return true;
case STATUS_SKETCH_DragPoint:
if (edit->DragPoint != -1 && pp) {
int GeoId;
Sketcher::PointPos PosId;
getSketchObject()->getGeoVertexIndex(edit->DragPoint, GeoId, PosId);
Gui::Command::openCommand(“Drag Point”);
Gui::Command::doCommand(Gui::Command::Doc,”App.ActiveDocument.%s.movePoint(%i,%i,App.Vector(%f,%f,0),%i)”
,getObject()->getNameInDocument()
,GeoId, PosId, x-xInit, y-yInit, relative ? 1 : 0
);
Gui::Command::commitCommand();
Gui::Command::updateActive();

setPreselectPoint(edit->DragPoint);
edit->DragPoint = -1;
//updateColor();
}
resetPositionText();
Mode = STATUS_NONE;
return true;
case STATUS_SKETCH_DragCurve:
if (edit->DragCurve != -1 && pp) {
const Part::Geometry *geo = getSketchObject()->getGeometry(edit->DragCurve);
if (geo->getTypeId() == Part::GeomLineSegment::getClassTypeId() ||
geo->getTypeId() == Part::GeomArcOfCircle::getClassTypeId() ||
geo->getTypeId() == Part::GeomCircle::getClassTypeId()) {
Gui::Command::openCommand(“Drag Curve”);a
Gui::Command::doCommand(Gui::Command::Doc,”App.ActiveDocument.%s.movePoint(%i,%i,App.Vector(%f,%f,0),%i)”
,getObject()->getNameInDocument()
,edit->DragCurve, Sketcher::none, x-xInit, y-yInit, relative ? 1 : 0
);
Gui::Command::commitCommand();
Gui::Command::updateActive();
}
edit->PreselectCurve = edit->DragCurve;
edit->DragCurve = -1;
//updateColor();
}
resetPositionText();
Mode = STATUS_NONE;
return true;
case STATUS_SKETCH_DragConstraint:
if (edit->DragConstraint != -1 && pp) {
Gui::Command::openCommand(“Drag Constraint”);
moveConstraint(edit->DragConstraint, Base::Vector2D(x, y));
edit->PreselectConstraint = edit->DragConstraint;
edit->DragConstraint = -1;
//updateColor();
}
Mode = STATUS_NONE;
return true;
case STATUS_SKETCH_UseHandler:
return edit->sketchHandler->releaseButton(Base::Vector2D(x,y));
case STATUS_NONE:
default:
return false;
}
}
}
// Right mouse button ****************************************************
else if (Button == 2) {
if (!pressed) {

Ok…I need to see what goes what gets defined when I click the mouse down after the first polyline

enum SketchMode{
STATUS_NONE,              /**< enum value View provider is in neutral. */
STATUS_SELECT_Point,      /**< enum value a point was selected. */
STATUS_SELECT_Edge,       /**< enum value a edge was selected. */
STATUS_SELECT_Constraint, /**< enum value a constraint was selected. */
STATUS_SELECT_Cross,      /**< enum value the base coordinate system was selected. */
STATUS_SKETCH_DragPoint,  /**< enum value while dragging a point. */
STATUS_SKETCH_DragCurve,  /**< enum value while dragging a curve. */
STATUS_SKETCH_DragConstraint,  /**< enum value while dragging a compatible constraint. */
STATUS_SKETCH_UseHandler  /**< enum value a DrawSketchHandler is in control. */

So… When in Polyline Mode == STATUS_SKETCH_UseHandler

So Mode is a protected variable defined within class ViewProviderSketch
Ok.. I to test mode value on mouse down for a single line.

Ok.. It looks like the magic I need is associated with the mode is set to STATUS_SKETCH_UseHandler.

Look through the code I keep seeing reference to a pointer named edit which is of type EditData.  http://free-cad.sourceforge.net/SrcDocu/dd/d15/structEditData.html

 


As near as I can tell an object to this pointer gets created in bool ViewProviderSketch::setEdit(int ModNum)

It should be useful breakpoint where a NewEdit object is created.

Ok… I left off here…
Need to set break points in
class DrawSketchHandlerLineSet: public DrawSketchHandler
in function:
virtual bool releaseButton(Base::Vector2D onSketchPos)

Posted in Uncategorized | Leave a comment

updating qt-creator

So I’m using 10.04 ubuntu and there qt-creator version that down loads from synaptic is 1.3.1 based on qt 4.6.2.  According to the freecad versions the later version have better support of cmake…
Ok.. So uninstalled qtcreator from synaptic.

I suppose if I was real hard-core I download  from gitorious and compile from source.  Not today…

I  ran across this:
http://qt.nokia.com/downloads

Since running 64 bit ubuntu I went with this:
http://qt.nokia.com/downloads/sdk-linux-x11-64bit-cpp

Hm.. This think took forever to download… (DSL)  It seems like everything a lot more got downloaded than qt-creator..

Posted in Uncategorized | Leave a comment

More on studying the freecad multiline

I managed to the break points working from with the QT-creator IDE
https://sourceforge.net/apps/phpbb/free-cad/viewtopic.php?f=10&t=2237

I set the breakpoint on void ViewProviderSketch::draw(bool temp) and I was looking at the call stack after I clicked the mouse

0    SketcherGui::ViewProviderSketch::draw    ViewProviderSketch.cpp    1600    0x00007fffd1d4453a
1    SketcherGui::ViewProviderSketch::updateData    ViewProviderSketch.cpp    2639    0x00007fffd1d5045e
2    Gui::ViewProvider::update    ViewProvider.cpp    232    0x00007ffff748391c
3    Gui::Document::slotChangedObject    Document.cpp    434    0x00007ffff72242fe
4    boost::_mfi::mf2<void, Gui::Document, App::DocumentObject const&, App::Property const&>::operator()(Gui::Document*, App::DocumentObject const&, App::Property const&) const    /home/jonas/freecad/free-cad/lib/libFreeCADGui.so    0    0x00007ffff7233826
5    void boost::_bi::list3<boost::_bi::value<Gui::Document*>, boost::arg<1>, boost::arg<2> >::operator()<boost::_mfi::mf2<void, Gui::Document, App::DocumentObject const&, App::Property const&>, boost::_bi::list2<App::DocumentObject const&, App::Property const&> >(boost::_bi::type<void>, boost::_mfi::mf2<void, Gui::Document, App::DocumentObject const&, App::Property const&>&, boost::_bi::list2<App::DocumentObject const&, App::Property const&>&, int)    /home/jonas/freecad/free-cad/lib/libFreeCADGui.so    0    0x00007ffff7232cc8
6    void boost::_bi::bind_t<void, boost::_mfi::mf2<void, Gui::Document, App::DocumentObject const&, App::Property const&>, boost::_bi::list3<boost::_bi::value<Gui::Document*>, boost::arg<1>, boost::arg<2> > >::operator()<App::DocumentObject, App::Property>(App::DocumentObject const&, App::Property const&)    /home/jonas/freecad/free-cad/lib/libFreeCADGui.so    0    0x00007ffff723214e
7    boost::detail::function::void_function_obj_invoker2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, Gui::Document, App::DocumentObject const&, App::Property const&>, boost::_bi::list3<boost::_bi::value<Gui::Document*>, boost::arg<1>, boost::arg<2> > >, void, App::DocumentObject const&, App::Property const&>::invoke(boost::detail::function::function_buffer&, App::DocumentObject const&, App::Property const&)    /home/jonas/freecad/free-cad/lib/libFreeCADGui.so    0    0x00007ffff723131b
8    boost::function2<void, App::DocumentObject const&, App::Property const&>::operator()    function_template.hpp    1013    0x00007ffff6b1efce
9    boost::signals::detail::unusable boost::signals::detail::call_bound2<void>::caller<App::DocumentObject const&, App::Property const&, boost::function<void ()(App::DocumentObject const&, App::Property const&)> >::operator()<boost::signals::detail::connection_slot_pair>(boost::signals::detail::connection_slot_pair const&) const    signal_template.hpp    119    0x00007ffff6b1d95d
10    boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound2<void>::caller<App::DocumentObject const&, App::Property const&, boost::function<void ()(App::DocumentObject const&, App::Property const&)> >, boost::signals::detail::named_slot_map_iterator>::dereference() const    slot_call_iterator.hpp    61    0x00007ffff6b1c0c4
11    boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound2<void>::caller<App::DocumentObject const&, App::Property const&, boost::function<void ()(App::DocumentObject const&, App::Property const&)> >, boost::signals::detail::named_slot_map_iterator>::reference boost::iterator_core_access::dereference<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound2<void>::caller<App::DocumentObject const&, App::Property const&, boost::function<void ()(App::DocumentObject const&, App::Property const&)> >, boost::signals::detail::named_slot_map_iterator> >(boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound2<void>::caller<App::DocumentObject const&, App::Property const&, boost::function<void ()(App::DocumentObject const&, App::Property const&)> >, boost::signals::detail::named_slot_map_iterator> const&)    iterator_facade.hpp    517    0x00007ffff6b1a7a6
12    boost::iterator_facade<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound2<void>::caller<App::DocumentObject const&, App::Property const&, boost::function<void ()(App::DocumentObject const&, App::Property const&)> >, boost::signals::detail::named_slot_map_iterator>, boost::signals::detail::unusable, boost::single_pass_traversal_tag, boost::signals::detail::unusable const&, long>::operator*() const    iterator_facade.hpp    643    0x00007ffff6b17c06
13    postfix_increment_proxy    iterator_facade.hpp    145    0x00007ffff6b1416c
14    boost::detail::postfix_increment_result<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound2<void>::caller<App::DocumentObject const&, App::Property const&, boost::function<void ()(App::DocumentObject const&, App::Property const&)> >, boost::signals::detail::named_slot_map_iterator>, boost::signals::detail::unusable, boost::signals::detail::unusable const&, boost::single_pass_traversal_tag>::type boost::operator++<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound2<void>::caller<App::DocumentObject const&, App::Property const&, boost::function<void ()(App::DocumentObject const&, App::Property const&)> >, boost::signals::detail::named_slot_map_iterator>, boost::signals::detail::unusable, boost::single_pass_traversal_tag, boost::signals::detail::unusable const&, long>(boost::iterator_facade<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound2<void>::caller<App::DocumentObject const&, App::Property const&, boost::function<void ()(App::DocumentObject const&, App::Property const&)> >, boost::signals::detail::named_slot_map_iterator>, boost::signals::detail::unusable, boost::single_pass_traversal_tag, boost::signals::detail::unusable const&, long>&, int)    iterator_facade.hpp    732    0x00007ffff6b1042c
15    void boost::last_value<void>::operator()<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound2<void>::caller<App::DocumentObject const&, App::Property const&, boost::function<void ()(App::DocumentObject const&, App::Property const&)> >, boost::signals::detail::named_slot_map_iterator> >(boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound2<void>::caller<App::DocumentObject const&, App::Property const&, boost::function<void ()(App::DocumentObject const&, App::Property const&)> >, boost::signals::detail::named_slot_map_iterator>, boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound2<void>::caller<App::DocumentObject const&, App::Property const&, boost::function<void ()(App::DocumentObject const&, App::Property const&)> >, boost::signals::detail::named_slot_map_iterator>) const    last_value.hpp    49    0x00007ffff6b0c329
16    boost::signal2<void, App::DocumentObject const&, App::Property const&, boost::last_value<void>, int, std::less<int>, boost::function<void ()(App::DocumentObject const&, App::Property const&)> >::operator()(App::DocumentObject const&, App::Property const&)    signal_template.hpp    354    0x00007ffff6b08a05
17    App::Document::onChangedProperty    Document.cpp    432    0x00007ffff6afaaf7
18    App::DocumentObject::onChanged    DocumentObject.cpp    186    0x00007ffff6b21c88
19    Part::Feature::onChanged    PartFeature.cpp    112    0x00007fffd0ff9b5a
20    Sketcher::SketchObject::onChanged    SketchObject.cpp    1431    0x00007fffd19447a2
21    App::Property::hasSetValue    Property.cpp    94    0x00007ffff6b61e5f
22    Part::PropertyGeometryList::setValues    PropertyGeometryList.cpp    103    0x00007fffd1016335
23    Sketcher::SketchObject::addGeometry    SketchObject.cpp    296    0x00007fffd193d5dc
24    Sketcher::SketchObjectPy::addGeometry    SketchObjectPyImp.cpp    65    0x00007fffd19cc55b
25    Sketcher::SketchObjectPy::staticCallback_addGeometry    SketchObjectPy.cpp    272    0x00007fffd19c8823
26    PyEval_EvalFrameEx    /usr/lib/libpython2.6.so.1.0    0    0x00007ffff620a030
27    PyEval_EvalCodeEx    /usr/lib/libpython2.6.so.1.0    0    0x00007ffff620bd60
28    PyEval_EvalCode    /usr/lib/libpython2.6.so.1.0    0    0x00007ffff620be32
29    PyRun_StringFlags    /usr/lib/libpython2.6.so.1.0    0    0x00007ffff6229d1c
30    Base::InterpreterSingleton::runString    Interpreter.cpp    117    0x00007ffff66dc653
31    Gui::Command::doCommand    Command.cpp    413    0x00007ffff72635b3
32    DrawSketchHandlerLineSet::releaseButton    CommandCreateGeo.cpp    563    0x00007fffd1d12316
33    SketcherGui::ViewProviderSketch::mouseButtonPressed    ViewProviderSketch.cpp    581    0x00007fffd1d3cfa8
34    Gui::ViewProvider::eventCallback    ViewProvider.cpp    195    0x00007ffff74835ce
35    SoEventCallback::handleEvent(SoHandleEventAction*)    /usr/lib/libCoin.so.60    0    0x00007ffff4eb3e0b
36    SoNode::handleEventS(SoAction*, SoNode*)    /usr/lib/libCoin.so.60    0    0x00007ffff4eccda7
37    SoAction::traverse(SoNode*)    /usr/lib/libCoin.so.60    0    0x00007ffff4c944f7
38    SoChildList::traverse(SoAction*, int, int)    /usr/lib/libCoin.so.60    0    0x00007ffff4de8ded
39    SoGroup::doAction(SoAction*)    /usr/lib/libCoin.so.60    0    0x00007ffff4ebffbb
40    SoSeparator::doAction(SoAction*)    /usr/lib/libCoin.so.60    0    0x00007ffff4ee393f
41    Gui::SoFCUnifiedSelection::handleEvent    SoFCUnifiedSelection.cpp    322    0x00007ffff73db639
42    SoNode::handleEventS(SoAction*, SoNode*)    /usr/lib/libCoin.so.60    0    0x00007ffff4eccda7
43    SoAction::traverse(SoNode*)    /usr/lib/libCoin.so.60    0    0x00007ffff4c944f7
44    SoChildList::traverse(SoAction*, int, int)    /usr/lib/libCoin.so.60    0    0x00007ffff4de8ded
45    SoGroup::doAction(SoAction*)    /usr/lib/libCoin.so.60    0    0x00007ffff4ebffbb
46    SoSeparator::doAction(SoAction*)    /usr/lib/libCoin.so.60    0    0x00007ffff4ee393f
47    SoNode::handleEventS(SoAction*, SoNode*)    /usr/lib/libCoin.so.60    0    0x00007ffff4eccda7
48    SoAction::traverse(SoNode*)    /usr/lib/libCoin.so.60    0    0x00007ffff4c944f7
49    SoChildList::traverse(SoAction*, int, int)    /usr/lib/libCoin.so.60    0    0x00007ffff4de8ded
50    SoGroup::doAction(SoAction*)    /usr/lib/libCoin.so.60    0    0x00007ffff4ebffbb
51    SoSeparator::doAction(SoAction*)    /usr/lib/libCoin.so.60    0    0x00007ffff4ee393f
52    SoNode::handleEventS(SoAction*, SoNode*)    /usr/lib/libCoin.so.60    0    0x00007ffff4eccda7
53    SoAction::traverse(SoNode*)    /usr/lib/libCoin.so.60    0    0x00007ffff4c944f7
54    SoHandleEventAction::beginTraversal(SoNode*)    /usr/lib/libCoin.so.60    0    0x00007ffff4c9f91a
55    SoAction::apply(SoNode*)    /usr/lib/libCoin.so.60    0    0x00007ffff4c94b72
56    SoEventManager::actuallyProcessEvent(SoEvent const*)    /usr/lib/libCoin.so.60    0    0x00007ffff4e742d9
57    SoQtRenderArea::processSoEvent(SoEvent const*)    /usr/lib/libSoQt4.so.20    0    0x00007ffff47b5efe
58    SoQtViewer::processSoEvent(SoEvent const*)    /usr/lib/libSoQt4.so.20    0    0x00007ffff47ee1bb
59    Gui::View3DInventorViewer::processSoEventBase    View3DInventorViewer.cpp    1111    0x00007ffff7463b89
60    Gui::NavigationStyle::processSoEvent    NavigationStyle.cpp    1086    0x00007ffff74497f3
61    Gui::CADNavigationStyle::processSoEvent    CADNavigationStyle.cpp    445    0x00007ffff744df44
62    Gui::NavigationStyle::processEvent    NavigationStyle.cpp    1069    0x00007ffff7449746
63    Gui::View3DInventorViewer::processSoEvent    View3DInventorViewer.cpp    1106    0x00007ffff7463b5f
64    SoQtRenderArea::processEvent(QEvent*)    /usr/lib/libSoQt4.so.20    0    0x00007ffff47b9329
65    Gui::View3DInventorViewer::processEvent    View3DInventorViewer.cpp    1045    0x00007ffff746366d
66    SoQtGLWidgetP::eventFilter(QObject*, QEvent*)    /usr/lib/libSoQt4.so.20    0    0x00007ffff47b2a8f
67    QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*)    /usr/lib/libQtCore.so.4    0    0x00007ffff12cf487
68    QApplicationPrivate::notify_helper(QObject*, QEvent*)    /usr/lib/libQtGui.so.4    0    0x00007ffff238c1fc
69    QApplication::notify(QObject*, QEvent*)    /usr/lib/libQtGui.so.4    0    0x00007ffff2392ecb
70    Gui::GUIApplication::notify    Application.cpp    1444    0x00007ffff7204c05
71    QCoreApplication::notifyInternal(QObject*, QEvent*)    /usr/lib/libQtCore.so.4    0    0x00007ffff12d006c
72    QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool)    /usr/lib/libQtGui.so.4    0    0x00007ffff23920ae
73    ??    /usr/lib/libQtGui.so.4    0    0x00007ffff2411f65
74    QApplication::x11ProcessEvent(_XEvent*)    /usr/lib/libQtGui.so.4    0    0x00007ffff24108ac
75    ??    /usr/lib/libQtGui.so.4    0    0x00007ffff243c882
76    g_main_context_dispatch    /lib/libglib-2.0.so.0    0    0x00007fffeb58e8c2
77    ??    /lib/libglib-2.0.so.0    0    0x00007fffeb592748
78    g_main_context_iteration    /lib/libglib-2.0.so.0    0    0x00007fffeb5928fc
79    QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)    /usr/lib/libQtCore.so.4    0    0x00007ffff12f9513
80    ??    /usr/lib/libQtGui.so.4    0    0x00007ffff243c46e
81    QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)    /usr/lib/libQtCore.so.4    0    0x00007ffff12ce992
82    QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)    /usr/lib/libQtCore.so.4    0    0x00007ffff12ced6c
83    QCoreApplication::exec()    /usr/lib/libQtCore.so.4    0    0x00007ffff12d2aab
84    Gui::Application::runApplication    Application.cpp    1660    0x00007ffff7200fc7
85    main    MainGui.cpp    349    0x00000000004078e4

 

I think level 34 looks interesting.  I need to put the break point on Gui::ViewProvider::eventCallback ViewProvider.cpp and single step my way to see whats going on.  But that’s enough for tonight.

Posted in Uncategorized | Leave a comment

Integrating an A arc into the freecad polyline.

I’m starting to take a look at how the freeCad code is put together.   It is pretty massive.   At first glance the naming conventions don’t have the same naming discipline, that heekscad has, but from what I’m seeing the seems to be a far greater trail of documentation bread crumbs..

I was playing around with Freecad and I was impressed by how stable the constraints seem to be with the sketcher.  Redo/Undo all seem to be working.  But…. It is irritating that you can’t turn a polyline segment into an arc (as you can in heekscad)…
Ok.. So I asked the question, http://sourceforge.net/apps/phpbb/free-cad/viewtopic.php?f=10&t=2097&start=20#p16358

I guess I volunteered myself to do this.    No problem for the moment.  I like having a certain amount of coding in my life.   There are times when I’m involved with heavy coding at work, that’s the last thing I want to look at when I get home.  At moment, I seem to be uber busy at work with work work that I’ve don’t have the time to do hardly any coding ;(  So this is fun and nice way for me to unwind.

I suppose that’s enough whining, time to start to attempt some coding at least…
Ok.. Here are the goals I’m trying to accomplish.
I need to isolate the code for the polyline events:

Looking at the behaviour of heeks err freecad. (I need to stop doing that), it looks like a new line segment gets created during a mouse up event.   So what I need to figure out where that mouse up event occurs.. (how hard can that be?).
Once I figure out the polyline mouseup event occurs I need to test for a keydown event an that’s where the real fun begins.  Something tells me the wife will be working on chores before I get to that point ;(

Arrg…. the rest of the house just woke up…
I was starting to narrow in on the break points yesterday night but I didn’t note where the breakpoints where.

(Ok.. So I cooked breakfast, that’ll give me a short reprieve and a little playtime.)

I’m thinking a good place to stick a break point is on: DrawSketchHandlerLine, which is located in /free-cad/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp

Here is some reference info.

http://freecad.sourcearchive.com/documentation/0.10.3247.dfsg-2/classDrawSketchHandlerLine.html

Ok.. I guess its not called mouseup… it’s called releaseButton… So I guess it stands to reason, I need to find something called releasekey?

On a side note… I’ve never run across this XPM stuff before..Basically, map a small image using ascii characters… cool.  I digress but I just ran past this in the code.

So here the code from

virtual bool releaseButton(Base::Vector2D onSketchPos)
{
if (Mode==STATUS_End){
unsetCursor();
resetPositionText();
Gui::Command::openCommand(“Add sketch box”);
int firstCurve = getHighestCurveIndex() + 1;
// add the four line geos
Gui::Command::doCommand(Gui::Command::Doc,”App.ActiveDocument.%s.addGeometry(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)))”,
sketchgui->getObject()->getNameInDocument(),
EditCurve[0].fX,EditCurve[0].fY,EditCurve[1].fX,EditCurve[1].fY);
Gui::Command::doCommand(Gui::Command::Doc,”App.ActiveDocument.%s.addGeometry(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)))”,
sketchgui->getObject()->getNameInDocument(),
EditCurve[1].fX,EditCurve[1].fY,EditCurve[2].fX,EditCurve[2].fY);
Gui::Command::doCommand(Gui::Command::Doc,”App.ActiveDocument.%s.addGeometry(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)))”,
sketchgui->getObject()->getNameInDocument(),
EditCurve[2].fX,EditCurve[2].fY,EditCurve[3].fX,EditCurve[3].fY);
Gui::Command::doCommand(Gui::Command::Doc,”App.ActiveDocument.%s.addGeometry(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)))”,
sketchgui->getObject()->getNameInDocument(),
EditCurve[3].fX,EditCurve[3].fY,EditCurve[0].fX,EditCurve[0].fY);
// add the four coincidents to ty them together
Gui::Command::doCommand(Gui::Command::Doc,”App.ActiveDocument.%s.addConstraint(Sketcher.Constraint(‘Coincident’,%i,2,%i,1)) ”
,sketchgui->getObject()->getNameInDocument()
,firstCurve,firstCurve+1);
Gui::Command::doCommand(Gui::Command::Doc,”App.ActiveDocument.%s.addConstraint(Sketcher.Constraint(‘Coincident’,%i,2,%i,1)) ”
,sketchgui->getObject()->getNameInDocument()
,firstCurve+1,firstCurve+2);
Gui::Command::doCommand(Gui::Command::Doc,”App.ActiveDocument.%s.addConstraint(Sketcher.Constraint(‘Coincident’,%i,2,%i,1)) ”
,sketchgui->getObject()->getNameInDocument()
,firstCurve+2,firstCurve+3);
Gui::Command::doCommand(Gui::Command::Doc,”App.ActiveDocument.%s.addConstraint(Sketcher.Constraint(‘Coincident’,%i,2,%i,1)) ”
,sketchgui->getObject()->getNameInDocument()
,firstCurve+3,firstCurve);
// add the horizontal constraints
Gui::Command::doCommand(Gui::Command::Doc,”App.ActiveDocument.%s.addConstraint(Sketcher.Constraint(‘Horizontal’,%i)) ”
,sketchgui->getObject()->getNameInDocument()
,firstCurve);
Gui::Command::doCommand(Gui::Command::Doc,”App.ActiveDocument.%s.addConstraint(Sketcher.Constraint(‘Horizontal’,%i)) ”
,sketchgui->getObject()->getNameInDocument()
,firstCurve+2);
// add the vertical constraints
Gui::Command::doCommand(Gui::Command::Doc,”App.ActiveDocument.%s.addConstraint(Sketcher.Constraint(‘Vertical’,%i)) ”
,sketchgui->getObject()->getNameInDocument()
,firstCurve+1);
Gui::Command::doCommand(Gui::Command::Doc,”App.ActiveDocument.%s.addConstraint(Sketcher.Constraint(‘Vertical’,%i)) ”
,sketchgui->getObject()->getNameInDocument()
,firstCurve+3);

Gui::Command::commitCommand();
Gui::Command::updateActive();

// add auto constraints at the start of the first side
if (sugConstr1.size() > 0) {
createAutoConstraints(sugConstr1, getHighestCurveIndex() – 3 , Sketcher::start);
sugConstr1.clear();
}

// add auto constraints at the end of the second side
if (sugConstr2.size() > 0) {
createAutoConstraints(sugConstr2, getHighestCurveIndex() – 2, Sketcher::end);
sugConstr2.clear();
}

EditCurve.clear();
sketchgui->drawEdit(EditCurve);
sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider
}
return true;
}
protected:
BoxMode Mode;
std::vector<Base::Vector2D> EditCurve;
std::vector<AutoConstraint> sugConstr1, sugConstr2;
};

 

I think if I set a break point along line 342 in /home/jonas/freecad/free-cad/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp and see if I can make sense of this… (Just a side note… The code here makes it feel like I’m looking more at C# rather than C++. It seems like the class declaration an implementation are in the same file. If memory, serves me correctly will cause things to slow down when you compiling. It seems that some files are split into cpp and h but others are not. I’m curious to know what the deal is on that…

Big Hmmmm.. I thought I had the point to set the break point when you release the mouse while drawing a polyline, but that doesn’t seem to be it.. Go figure.
I’ve got breakpoints setting up all over the point..
I’m wondering if I need to hack up Cmakelists.txt somehow to create a debug libary for freeCad.

Ok… Things have gone to from bad to worse..
I cleaned the project and re-built it.
When I attempt to run, I get this error:

make[2]: Entering directory /home/jonas/freecad/free-cad'
cd /home/jonas/freecad/free-cad && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jonas/freecad/free-cad /home/jonas/freecad/free-cad/data/examples /home/jonas/freecad/free-cad /home/jonas/freecad/free-cad/data/examples /home/jonas/freecad/free-cad/data/examples/CMakeFiles/Example_data.dir/DependInfo.cmake --color=
make[2]: Leaving directory
/home/jonas/freecad/free-cad’
/usr/bin/make -f data/examples/CMakeFiles/Example_data.dir/build.make data/examples/CMakeFiles/Example_data.dir/build
make[2]: Entering directory /home/jonas/freecad/free-cad'
make[2]: Circular data/examples/Schenkel.stp <- data/examples/Schenkel.stp dependency dropped. /usr/bin/cmake -E cmake_progress_report /home/jonas/freecad/free-cad/CMakeFiles [100%] Generating Schenkel.stp cd /home/jonas/freecad/free-cad/data/examples && /usr/bin/cmake -E copy /home/jonas/freecad/free-cad/data/examples/Schenkel.stp /home/jonas/freecad/free-cad/data/examples/Schenkel.stp Error copying file "/home/jonas/freecad/free-cad/data/examples/Schenkel.stp" to "/home/jonas/freecad/free-cad/data/examples/Schenkel.stp". make[2]: Leaving directory
/home/jonas/freecad/free-cad'
make[2]: *** [data/examples/Schenkel.stp] Error 1
make[1]: *** [data/examples/CMakeFiles/Example_data.dir/all] Error 2
make[1]: Leaving directory `/home/jonas/freecad/free-cad'
make: *** [all] Error 2
Exited with code 2.
Error while building project FreeCAD_trunk
When executing build step 'Make'

Arggg.. I'm not sure why this isn't working....I think something is hosing up because sort and destination are the same...

Posted in Uncategorized | Leave a comment

how to view the call stack for qt-creator using 10.04 ubuntu

I spent  more than a few minutes of googling and the search engine never did give me the answer I was seeking.   Most the of the hits for the search terms I was using seem to indicate the solution involved navigating window > views.   This is irritating since I don’t have that option available in the version of qt-creator that I’m using.  Qt creator 1.3.1

The call stack can be revealed by navigating towards debug > views > stack.

Looking at this, its obvious..   (I wound up finding my answer with out a google search just by running through the menu permutations) I find it ironic that googling to answer the simplest questions are often the most difficult to find.

Ok.. Back to Freecad.

 

 

Posted in Uncategorized | Leave a comment

creating a qt-creator project file for freeCad in ubuntu 10.04

I really like code::blocks.. and it made sense for me to use it with heekcad since both where based on wxwidget technology, but I wonder if it would be less pain for me to use qt-creator.    I’m running 64 bit 10.04 ubuntu and I had some pain getting the dependencies installed (sorry.. I normally block the pain, but just blasted my way through  on that one…

Anyway… A while bad I was making a code::blocks projects from Cmakelists.txt.  Sure enough the can be done with qt-creator….
To get the source downloaded and and compiled initially this is what I did:

923  ls
924  mkdir freecad
925  cd freecad
926  git clone git://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad
927  ls
928  cd free-cad
929  cmake .
930  make
931  history

I got qt-creator from the synaptic.  I loaded qtcreator.   I was reading here that you could use cmake to generate a code::blocks project file and from there you could load the code blocks project file into qt-creator.
Searching qt-creator help I ran across this:

 

 

 

 

 

 

 

Ok, the way I was reading this was that, if I simply open a file and the wizard takes over.. If I just open the file, the file just opens…
Hmmm. Let me try opening the open to open a file or project option…. That does it… Now I got the wizard:

 

 

 

 

 

 

 

 

 

 

 

 

 

Ok… I guess I do need to make code::blocks project file…

 

jonas@jonas-laptop:~/freecad/free-cad$ cmake .. -G “CodeBlocks – Unix Makefiles”
CMake Error: The source directory “/home/jonas/freecad” does not appear to contain CMakeLists.txt.
Specify –help for usage, or press the help button on the CMake GUI.
jonas@jonas-laptop:~/freecad/free-cad$ cd free-cad
bash: cd: free-cad: No such file or directory
jonas@jonas-laptop:~/freecad/free-cad$ cmake .. -G “CodeBlocks – Unix Makefiles”
CMake Error: The source directory “/home/jonas/freecad” does not appear to contain CMakeLists.txt.
Specify –help for usage, or press the help button on the CMake GUI.
jonas@jonas-laptop:~/freecad/free-cad$ cmake -G “CodeBlocks – Unix Makefiles”
— Found Xerces-C: /usr/lib/libxerces-c.so
CMake Warning at CMakeLists.txt:172 (find_package):
Could not find module FindOCE.cmake or a configuration file for package
OCE.

Adjust CMAKE_MODULE_PATH to find FindOCE.cmake or set OCE_DIR to the
directory containing a CMake configuration file for OCE.  The file will
have one of the following names:

OCEConfig.cmake
oce-config.cmake

— OpenCASCADE include directory:
— OpenCASCADE shared libraries directory:
— Could NOT find Spnav  (missing:  SPNAV_LIBRARY SPNAV_INCLUDE_DIR)
— Platform is 64-bit, set -D_OCC64
— DEBUG: -g -DFC_DEBUG
svn: ‘/home/jonas/freecad/free-cad’ is not a working copy
sh: bzr: not found
git
/home/jonas/freecad/free-cad/src/Build/Version.h written
— Boost found: TRUE
— Build 64bit
— Coin3D doc is installed
—   Found /usr/share/doc/libcoin60-doc/html/coin.tag.gz
—   You should uncompress this file if you want to use it for source doc generation
— Configuring done
— Generating done
— Build files have been written to: /home/jonas/freecad/free-cad
jonas@jonas-laptop:~/freecad/free-cad$

So I wanted to keep the cbp out of the code trunk but I didn’t manage it:

I think I”m almost there:

 

 

 

 

 

 

I looks like I just need to click finish.
It seems to have worked.
This is strange though, I thought this process would have create a .pro file, but apparently not.  When I choose open recent project it points to the CMakeLists.txt file.  Go figure.

Posted in Uncategorized | Leave a comment

FreeCAD and the inch.

FreeCAD is really intriguing to me.    The bummer is that it’s designed around metric.   My work place is inch based and most of my tools and stock at home are inch based also.   I remember in heekscad they made an inch conversion keeping the underlying metric.   I’m not sure that was the best approach.   I’ve run into situations where converting  toleranced dimension from metric to inch would do some weird things.

Anyway, It seems like there was quite a bit work done on trying have imperial units, but it doesn’t seem to be a focus at this point.

http://sourceforge.net/apps/phpbb/free-cad/viewtopic.php?f=3&t=2018&p=14233&hilit=INCH#p14233

 

 

Posted in Uncategorized | 6 Comments