Starting to chew.. on the HeeksCAD code.

Ok… My main goal in looking at Heekscad is to gain and understand on how opencascade goes from the OCC code to a OpenGl graphics window.  It has been very frustrating to me to see a simple makebottle example OCC provides with no explanation on how to get it drawn on the screen.  Well if there is a explanation  I haven’t run across it.  I guess it might be rudimentary to guys who have degrees in this stuff, but it’s not to me(not yet anyway).  I would like to make a heavily documented how to on how get that darn makebottle working… anyway that’s the goal anyway I guess we’ll see if I get there.  But first we need to just have some fun and poke and prode a little under the hood of heeks cad to figure out how it interacts with opencascade libraries.

The heeksCad source code had be found here.

Heekcad being a Wxwidgets project, doesn’t have a main(not one that you’ll see in your source anyway)   As explained here , the magic terms you need to look for to figure out the starting point are the macro called IMPLEMENT_APP and the then OnInit

src/HeeksCAD.cpp|77|IMPLEMENT_APP(HeeksCADapp)|

src/HeeksCAD.cpp|172|bool HeeksCADapp::OnInit()|
src/HeeksCAD.h|151|virtual bool OnInit();|
src/propgrid.cpp|604|virtual bool OnInit() { wxPGGlobalVars = new wxPGGlobalVarsClass(); return true; }|

I’m not sure what the deal is with the propgrid.cpp but what I’m looking for is the HeeksCAD.cpp and HeeksCAD.h

Ok… Time to start poking around..
One thing that caught my mind was:HeeksConfig config;
HeeksConfig is object declared here

// HeeksConfig.h
// Copyright (c) 2009, Dan Heeks
// This program is released under the BSD license. See the file COPYING for details.
#include <wx/config.h>
#include <wx/confbase.h>
#include <wx/fileconf.h>

class HeeksConfig: public wxConfig
{
public:
HeeksConfig():wxConfig(_T(“HeeksCAD”)){}
~HeeksConfig(){}
};

This sort of takes care of program variable automatically for you depending on which OS your in.
It will stick setting in the registry or an INI (in windows) or could be /etc or the home directory..
I found my in jonas@Ubuntu4:~$ locate .HeeksCAD
/home/jonas/.HeeksCAD

Takeing a look inside the file looks like this:

MainFrameWidth=1279
MainFrameHeight=725
MainFramePosX=1
MainFramePosY=49
AuiPerspective=layout2|name=ToolBar;caption=General Tools;state=2108156;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=328;besth=40;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=GeomBar;caption=Geometry Tools;state=2108156;dir=1;layer=10;row=0;pos=339;prop=100000;bestw=292;besth=40;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=520;floaty=288;floatw=309;floath=64|name=SolidBar;caption=Solid Tools;state=2108156;dir=1;layer=10;row=1;pos=1;prop=100000;bestw=392;besth=40;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=736;floaty=259;floatw=345;floath=64|name=ViewingBar;caption=Viewing Tools;state=2108156;dir=1;layer=10;row=1;pos=404;prop=100000;bestw=292;besth=40;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=679;floaty=334;floatw=309;floath=64|name=TransformBar;caption=Transformation Tools;state=2108159;dir=1;layer=10;row=0;pos=52;prop=100000;bestw=256;besth=40;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=618;floaty=411;floatw=273;floath=64|name=Graphics;caption=Graphics;state=768;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=800;besth=600;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=Objects;caption=Objects;state=2099196;dir=4;layer=1;row=0;pos=0;prop=100000;bestw=300;besth=400;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=Options;caption=Options;state=2099196;dir=4;layer=1;row=0;pos=1;prop=100000;bestw=300;besth=200;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=Input;caption=Input;state=2099196;dir=4;layer=1;row=0;pos=2;prop=100000;bestw=300;besth=200;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=Properties;caption=Properties;state=2099196;dir=4;layer=1;row=0;pos=3;prop=100000;bestw=300;besth=200;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(5,0,0)=504|dock_size(4,1,0)=234|dock_size(1,10,0)=42|dock_size(1,10,1)=42|
ToolImageSize=24
Perspective=0
DrawEnd=0
DrawInters=0
DrawCentre=0
DrawMidpoint=0
DrawNearest=0
DrawTangent=0
DrawCoords=1
DrawScreen=0
DrawToGrid=1
DrawGrid=1
DrawRadius=5
BackgroundColor=242 204 162
CurrentColor=0 0 0
ConstructionColor=0 0 255
RotateMode=0
Antialiasing=0
GridMode=3
m_light_push_matrix=1
WheelForwardAway=1
ZoomingReversed=0
CtrlDoesRotate=0
DrawDatum=1
DrawDatumSolid=1
DatumSize=30
DatumSizeIsPixels=1
DrawRuler=0
RegularShapesMode=0
RegularShapesNSides=6
RegularShapesRectRad=0
RegularShapesObRad=2
ExtrudeRemovesSketches=1
LoftRemovesSketches=1
GraphicsTextMode=2
DxfMakeSketch=1
FaceToSketchDeviation=0.1
RecentFilePath0=/home/jonas/Desktop/heekscaddata/bridge.dxf
RecentFilePath1=
RecentFilePath2=
RecentFilePath3=
RecentFilePath4=
RecentFilePath5=
RecentFilePath6=
RecentFilePath7=
RecentFilePath8=
RecentFilePath9=
RecentFilePath10=
RecentFilePath11=
RecentFilePath12=
RecentFilePath13=
RecentFilePath14=
RecentFilePath15=
RecentFilePath16=
RecentFilePath17=
RecentFilePath18=
RecentFilePath19=

heekscad todo: Seems like view should pop up as last one saved.  I suppose that will show up.. one day..

Hmm… What next. In the heekscad.H I found some very interesting function definitions that look interesting to me.
void OpenXMLFile(const wxChar *filepath, bool undoably = false, HeeksObj* paste_into = NULL);
void OpenSVGFile(const wxChar *filepath, bool undoably = false);
void OpenSTLFile(const wxChar *filepath, bool undoably = false);
void OpenDXFFile(const wxChar *filepath, bool undoably = false);
bool OpenImageFile(const wxChar *filepath, bool undoably = false);
bool OpenFile(const wxChar *filepath, bool import_not_open = false, HeeksObj* paste_into = NULL);

Playing around I opened a filed called Bridge.dxf that I downed loaded somwhere off the net.  See if I can follow how all this is happening.. I think that’s something for tomorrow morning..

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

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