Entries Tagged as 'Ubuntu'

GTDification continues.

I just finished reading David Allen’s “Getting Things Done” this weekend.  I have to say that’s it had a very profound effect on me.   I’d not sure I can recall any book that I’ve read that has made so much sense.
A friend I work with calls me Born Again.  I guess I have become a bit of my zealot.  I gaze upon my office and look at what I need to sort into reference, trash and actionable items….. Yikes what a pile.

One of the things that I’ve been looking at is trying create a cross-platform database on a thumb drive that I could use either at home (ubuntu) or at work (xp).  Yah know you’d think this would be easy… but its not.  My weapon of choice would be MSaccess, since I use that all the time at work and am very familiar wiith this.  Unfortunately, from my research so far, it seems open source drivers/software etc.. are basically available to suck information out access but not put it back in.

I had also got the suggestion to try sqlite.  Basic research there is that it would work fine on Linux sight but would need to get drivers installed at work, which lets just say might be bit of a challenge.

Then someone suggested this tiddlywiki technology. This is very interesting stuff, that I’m not that familiar with.  This is stuff  cool stuff.   You can have your own personal wiki on a stick.
The main issue that I had with this is what are the security implications with this stuff.
From the wikipedia link they talk about how tiddlywiki is a combination of html, css and javascript.

So..  javascript security page talks about how in theory, scripts are run in a sandbox and have same orgin policy.   I theory I guess it’s secure.  You keep reading and you here about all these exceptions to it.  Oh… joy… So.. I’m not sure..  Need to get some second opinions from people I trust.  Man this is a headache.

So… At the moment I’m looking at two Gtd tiddlywiki based organizers.

http://nathanbowers.com/gtdtw/

http://www.dcubed.ca/Welcome_to_d-cubed.html

http://monkeygtd.tiddlyspot.com/#MonkeyGTD

At first tries d3 seems to be the way to go.  But…. mGtd seems sort of advanced.
This is interesting an comment

(Part 1)Exploring zetcode wxwidget tutorial on Layout Management:

I’ve already have add a smattering of sizers already. I guess this part of the zetcode wxWidget tutorial goes through that..
Lets see what surprises are in store for Absolute Positioning.
The first example shows absolute positioning. The author of the tutorial makes it point, that almost no one in a production environment would use absolute positioning. Everyone would use sizers. In my vb6 code I like to use the Resize event to hard code the resizing of components to a window… I guess wxwidgets takes care of that automatically..
Any way… lets see the Absolute Position example…
The code basically shows how absolute positioning such on a re-size event.
Only other thing is that I believe this is the first use of the wxTextCtrl. The only thing is we’re doing nothing interesting with it.
I suppose what would be cool would be to figure out how to turn on the word wrap…. How hard can that be??
Ok… time to surf the documentation
Lets see msw and gtk can be changed dynamically…That’s interesting…
This is easy.. Just need to add as follows.

textctrl = new wxTextCtrl(panel, -1, wxT(“”), wxPoint(-1, -1),
wxSize(250, 150),wxTE_MULTILINE );

Ok… Enough of this tutorial.  Now I’m on to “Using Sizers”.
This is an interesting example… Normally you stick stuff into a panel and put the panel into the wxframe.  According to the tutorial wxframe as a sizer build in that can accommodate one widget…,
Time to download the code and see what happens if I put in two…
On widget you get the sizer works and with two it doesn’t there you go…

Next to the WxBoxSizer
The sample looks like this:

It looks sort of cool.. Here is border.cpp with appropriate links to the documentation:

#include “border.h”

Border::Border(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 200))
{

wxColour col1, col2;
col1.Set(wxT(“#4f5049″));
col2.Set(wxT(“#ededed”));

wxPanel *panel = new wxPanel(this, -1);
panel->SetBackgroundColour(col1);
wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);

wxPanel *midPan = new wxPanel(panel, wxID_ANY);
midPan->SetBackgroundColour(col2);

vbox->Add(midPan, 1, wxEXPAND | wxALL, 20);
panel->SetSizer(vbox);

Centre();
}

It’s getting a little late an this stuff isn’t making that much sense to me at the moment…
In this example we basicallly have , a panel within a panel within a frame.
On the vbox->Add…

wxSizerItem* Add(wxWindow* window, int proportion = 0,int flag = 0, int border = 0, wxObject* userData = NULL)
I’m a little unclear on the proportion… Documentation is a follows:

proportion

Although the meaning of this parameter is undefined in wxSizer, it is used in wxBoxSizer to indicate if a child of a sizer can change its size in the main orientation of the wxBoxSizer – where 0 stands for not changeable and a value of more than zero is interpreted relative to the value of other children of the same wxBoxSizer. For example, you might have a horizontal wxBoxSizer with three children, two of which are supposed to change their size with the sizer. Then the two stretchable windows would get a value of 1 each to make them grow and shrink equally with the sizer’s horizontal dimension.

The author than gets into the alignment of widgets. This section is untitled but explores some of the flag options

wxTOP
wxBOTTOM
wxLEFT
wxRIGHT
wxALL
These flags are used to specify which side(s) of the sizer item the border width will apply to.
wxEXPAND The item will be expanded to fill the space assigned to the item.
wxSHAPED The item will be expanded as much as possible while also maintaining its aspect ratio
wxFIXED_MINSIZE Normally wxSizers will use GetAdjustedBestSize to determine what the minimal size of window items should be, and will use that size to calculate the layout. This allows layouts to adjust when an item changes and its best size becomes different. If you would rather have a window item stay the size it started with then use wxFIXED_MINSIZE.
wxRESERVE_SPACE_EVEN_IF_HIDDEN Normally wxSizers don’t allocate space for hidden windows or other items. This flag overrides this behavior so that sufficient space is allocated for the window even if it isn’t visible. This makes it possible to dynamically show and hide controls without resizing parent dialog, for example. This function is new since wxWidgets version 2.8.8
wxALIGN_CENTER wxALIGN_CENTRE
wxALIGN_LEFT
wxALIGN_RIGHT
wxALIGN_TOP
wxALIGN_BOTTOM
wxALIGN_CENTER_VERTICAL wxALIGN_CENTRE_VERTICAL
wxALIGN_CENTER_HORIZONTAL wxALIGN_CENTRE_HORIZONTAL
The wxALIGN flags allow you to specify the alignment of the item within the space allotted to it by the sizer, adjusted for the border if any.

Giving that a go, I guess we’ll see if there is anything worth commenting about.

Ok.. I have to confess this is sort of cool.. In vb6 I would basically avoid laying out a form like this. Typically I would layout a command err… button whatever on the left and or top of a form err…. frame. Unless I never discovered some functionality, this would take a bit of coding to do.. Anyway back to business at hand.

#include “align.h”

Align::Align(const wxString& title)
: wxFrame(NULL, -1, title, wxPoint(-1, -1), wxSize(300, 200))
{

wxPanel *panel = new wxPanel(this, -1);

wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *hbox1 = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer *hbox2 = new wxBoxSizer(wxHORIZONTAL);

wxButton *ok = new wxButton(panel, -1, wxT(“Ok”));
wxButton *cancel = new wxButton(panel, -1, wxT(“Cancel”));

hbox1->Add(new wxPanel(panel, -1));
vbox->Add(hbox1, 1, wxEXPAND);

hbox2->Add(ok);
hbox2->Add(cancel);

vbox->Add(hbox2, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 10);
panel->SetSizer(vbox);

Centre();
}

One thing I’m noticing is the “-1″‘s showing up everywhere for the identifier
I pulled this out wxpanel documentation. I’m assuming it applies all over.

id

An identifier for the panel. A value of -1 is taken to mean a default.

Ok… At first glance this has got me confused. The author of the tutorial is making some important points here. I should focus on what he’s saying.
This is not going to be a concise as what’s in the tutorial but here is my understanding of whats going on.
We start out with a frame and a panel (panel) inside of it. I’m thinking of that as a magnetic board. On that magnetic board were sticking two buttons “Ok” and “Cancel”. For fun at this point I’m going to rem err…. comment out all the box sizers and see what happens…

#include “align.h”

Align::Align(const wxString& title)
: wxFrame(NULL, -1, title, wxPoint(-1, -1), wxSize(300, 200))
{

wxPanel *panel = new wxPanel(this, -1);

// wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
// wxBoxSizer *hbox1 = new wxBoxSizer(wxHORIZONTAL);
// wxBoxSizer *hbox2 = new wxBoxSizer(wxHORIZONTAL);

wxButton *ok = new wxButton(panel, -1, wxT(“Ok”));
wxButton *cancel = new wxButton(panel, -1, wxT(“Cancel”));

// hbox1->Add(new wxPanel(panel, -1));
// vbox->Add(hbox1, 1, wxEXPAND);
//
//
// hbox2->Add(ok);
// hbox2->Add(cancel);
//
// vbox->Add(hbox2, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 10);
// panel->SetSizer(vbox);

Centre();
}

This is actually sort of cool… It looks if one button is on top of the other as only Cancel shows… which is sort of cool… I’m going to confirm this by adding:

cancel->Show(false);

Yep that’s exactly whats going on. Ok now I took that out… I’m going to uncomment out hbox2 with a minor modification to setsizer to see what happens.

#include “align.h”

Align::Align(const wxString& title)
: wxFrame(NULL, -1, title, wxPoint(-1, -1), wxSize(300, 200))
{

wxPanel *panel = new wxPanel(this, -1);

// wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
// wxBoxSizer *hbox1 = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer *hbox2 = new wxBoxSizer(wxHORIZONTAL);

wxButton *ok = new wxButton(panel, -1, wxT(“Ok”));
wxButton *cancel = new wxButton(panel, -1, wxT(“Cancel”));

// hbox1->Add(new wxPanel(panel, -1));
// vbox->Add(hbox1, 1, wxEXPAND);
//
//
hbox2->Add(ok);
hbox2->Add(cancel);
//
// vbox->Add(hbox2, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 10);
// panel->SetSizer(vbox);
panel->SetSizer(hbox2);
Centre();
}

Ok… now we basically have two buttons next to each other in the upper left hand corner.

Next experiment is to turn on the vertical boxsizer and return the setsizer to original.

#include “align.h”

Align::Align(const wxString& title)
: wxFrame(NULL, -1, title, wxPoint(-1, -1), wxSize(300, 200))
{

wxPanel *panel = new wxPanel(this, -1);

wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
// wxBoxSizer *hbox1 = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer *hbox2 = new wxBoxSizer(wxHORIZONTAL);

wxButton *ok = new wxButton(panel, -1, wxT(“Ok”));
wxButton *cancel = new wxButton(panel, -1, wxT(“Cancel”));

// hbox1->Add(new wxPanel(panel, -1));
// vbox->Add(hbox1, 1, wxEXPAND);
//
//
hbox2->Add(ok);
hbox2->Add(cancel);
//
vbox->Add(hbox2, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 10);
panel->SetSizer(vbox);

Centre();
}

Interesting now I’m going to turn everything back on an make this modification.
And mess around with this to see what changes
vbox->Add(hbox2, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 10);
Change:

vbox->Add(hbox2, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 20);

The border gets bigger on the bottom and right

Change:

vbox->Add(hbox2, 0, wxBOTTOM, 10);

buttons go to the bottom and align from the left.

Change:

vbox->Add(hbox2, 0, wxALIGN_RIGHT, 10);

Now this is curious. Apparently the border gets disabled when you do this..

Change:

vbox->Add(hbox2, 0, wxRIGHT, 10);

Now this is even more curious. Buttons show up on the bottom left with no border go figure.
I guess I should take a quick look at the documentation… Oh cool… This makes perfect sense…
I told it to apply the border with to the right hand side and since I had no alignment pushed it to the left with no border.
So If I wanted to put it in the center with a little border from the bottom I would do this.

vbox->Add(hbox2, 0,   wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 20);

Ok… Enough of this fun… I’m starting to get a lag for updating this page… Time to start another one.

More on taking another crack at putting it all together..

Ok… I think I’m so close to putting it all together. Whether or not it works, well that’s another matter.
Just a note to myself here but for I start.
I added these notes to src/Makefile.am:

AM_CXXFLAGS =-DHAVE_IOSTREAM -DHAVE_LIMITS
AM_CPPFLAGS = -I/usr/include/opencascade/

It seemed to work, but I wonder if they where meant to go in the configure.ac Quick check to my favorite tutorial.. I seem to be using AM_CPPFLAGS correctly, but there is no reference to AM_CXXFLAGS in this tutorial…
Ok… there are references appearing to AM_CXXFLAGS on the net so….. I think I need to did deeper….
This is not what I intended to do this morning but….
I found some interesting info here:http://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.htm

27.6.1 Compile Flag Variables

This section attempts to answer all the above questions. We will mostly discuss CPPFLAGS in our examples, but actually the answer holds for all the compile flags used in Automake: CCASFLAGS, CFLAGS, CPPFLAGS, CXXFLAGS, FCFLAGS, FFLAGS, GCJFLAGS, LDFLAGS, LFLAGS, LIBTOOLFLAGS, OBJCFLAGS, RFLAGS, UPCFLAGS, and YFLAGS.

CPPFLAGS, AM_CPPFLAGS, and mumble_CPPFLAGS are three variables that can be used to pass flags to the C preprocessor (actually these variables are also used for other languages like C++ or preprocessed Fortran). CPPFLAGS is the user variable (see User Variables), AM_CPPFLAGS is the Automake variable, and mumble_CPPFLAGS is the variable specific to the mumble target (we call this a per-target variable, see Program and Library Variables).

Ok… I think i found my answer here: 8.4 Program and Library Variables

maude_CCASFLAGS
maude_CFLAGS
maude_CPPFLAGS
maude_CXXFLAGS
maude_FFLAGS
maude_GCJFLAGS
maude_LFLAGS
maude_OBJCFLAGS
maude_RFLAGS
maude_UPCFLAGS
maude_YFLAGS
Automake allows you to set compilation flags on a per-program (or per-library) basis. A single source file can be included in several programs, and it will potentially be compiled with different flags for each program. This works for any language directly supported by Automake. These per-target compilation flags are ‘_CCASFLAGS’, ‘_CFLAGS’, ‘_CPPFLAGS’, ‘_CXXFLAGS’, ‘_FFLAGS’, ‘_GCJFLAGS’, ‘_LFLAGS’, ‘_OBJCFLAGS’, ‘_RFLAGS’, ‘_UPCFLAGS’, and ‘_YFLAGS’.

When using a per-target compilation flag, Automake will choose a different name for the intermediate object files. Ordinarily a file like sample.c will be compiled to produce sample.o. However, if the program’s _CFLAGS variable is set, then the object file will be named, for instance, maude-sample.o. (See also renamed objects.) The use of per-target compilation flags with C sources requires that the macro AM_PROG_CC_C_O be called from configure.ac.

In compilations with per-target flags, the ordinary ‘AM_’ form of the flags variable is not automatically included in the compilation (however, the user form of the variable is included). So for instance, if you want the hypothetical maude compilations to also use the value of AM_CFLAGS, you would need to write:

Oh… I wish I hadn’t run out of coffee yesterday…. tea is just not enough…
This is what my directory looks like.

jonas@Ubuntu4:~/gtkmmocascade/src$ ls
gtkmmocascade.cpp gtkmmocascade-main.o MakeBottle.cpp Makefile.am Makefile.old
gtkmmocascade.h main.cpp Makefile Makefile.in

It make no sense to me, why I put a AM_CXXFLAGS there… (I think I may have gotten it from the OCC_forum…
Ok… I fixed a few things up…
and here’s what happens when I run make:

jonas@Ubuntu4:~/gtkmmocascade$ make
make all-recursive
make[1]: Entering directory `/home/jonas/gtkmmocascade’
Making all in src
make[2]: Entering directory `/home/jonas/gtkmmocascade/src’
make[2]: *** No rule to make target `gtmmocascade.cpp’, needed by `gtkmmocascade-gtmmocascade.o’. Stop.
make[2]: Leaving directory `/home/jonas/gtkmmocascade/src’
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/jonas/gtkmmocascade’
make: *** [all] Error 2
jonas@Ubuntu4:~/gtkmmocascade$

Ok… This is pretty much what happened before my corrections…
So… googling 668000 hits.. on “*** No rule to make target” that’s comforting at least to I’m not a alone with this issue.  One of the first hits has a good line. “Wo ist der Hund begraben? Where is the dog buried… ;)
(I’m going to use that one)
If found another reference on :http://www.opencascade.org/org/forum/thread_4018/
Hmm… running out of time here… Going to need to look at this at lunch….
So… here is what my src/Makefile.am currently looks like…

LIB_OCC= -Luser/lib -lTKernel -lTKMath -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo \

-lTKPrim -lTKBool -lTKFeat -lTKFillet -lTKOffset -lTKHLR \

-lTKService -lTKV2d -lTKV3d -lTKMesh -lTKPCAF -lTKLCAF -lTKPLCAF -lTKCDF -lTKCAF \

-lPTKernel -lTKIGES -lTKSTEP -lTKSTEPBase -lTKSTEPAttr -lTKSTEP209 -lTKSTL -lTKVRML -lTKShHealing \

-lTKXSBase -lTKPShape -lTKShapeSchema -lTKOpenGl

AM_CPPFLAGS = -I/usr/include/opencascade/ -DHAVE_IOSTREAM -DHAVE_LIMITS
bin_PROGRAMS = gtkmmocascade
gtkmmocascade_SOURCES = gtmmocascade.h main.cpp gtmmocascade.cpp MakeBottle.cpp
gtkmmocascade_CPPFLAGS = $(GTKMM_CFLAGS) $(GTKGLEXTMM_CFLAGS)
gtkmmocascade_LDADD = $(GTKMM_LIBS) $(GTKGLEXTMM_LIBS) $(LIB_OCC)

I ran across a couple interesting links at lunch…
http://www.gamedev.net/community/forums/topic.asp?topic_id=510468
This link also points to a make tutorial that code my eye.. I need to check  this out also…

http://www.hsrl.rutgers.edu/ug/make_help.html

A side note… I ran across a interesting link on cross platform IDE’s
http://www.gamedev.net/community/forums/topic.asp?topic_id=296922

I added these two line to my configure.ac
AC_PROG_LIBTOOL        # add libtool to autotools suite
AC_SUBST(LIBTOOL_DEPS) # force regeneration of libtool  if necessary

I got rid of that error but that gave me some more…

jonas@Ubuntu4:~/gtkmmocascade$
jonas@Ubuntu4:~/gtkmmocascade$ make
make all-recursive
make[1]: Entering directory `/home/jonas/gtkmmocascade’
Making all in src
make[2]: Entering directory `/home/jonas/gtkmmocascade/src’
if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/gtkmm-2.4 -I/usr/lib/gtkmm-2.4/include -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/gdkmm-2.4 -I/usr/lib/gdkmm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/include/atkmm-1.6 -I/usr/include/gtk-2.0 -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include -I/usr/include/cairomm-1.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/pixman-1 -I/usr/include/atk-1.0 -I/usr/include/gtkglextmm-1.2 -I/usr/lib/gtkglextmm-1.2/include -I/usr/include/gtkglext-1.0 -I/usr/include/gtkmm-2.4 -I/usr/lib/gtkmm-2.4/include -I/usr/lib/gtkglext-1.0/include -I/usr/include/gdkmm-2.4 -I/usr/lib/gdkmm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/pixman-1 -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/cairomm-1.0 -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/atk-1.0 -I/usr/include/atkmm-1.6 -g -O2 -MT gtkmmocascade-main.o -MD -MP -MF “.deps/gtkmmocascade-main.Tpo” -c -o gtkmmocascade-main.o `test -f ‘main.cpp’ || echo ‘./’`main.cpp; \
then mv -f “.deps/gtkmmocascade-main.Tpo” “.deps/gtkmmocascade-main.Po”; else rm -f “.deps/gtkmmocascade-main.Tpo”; exit 1; fi
In file included from main.cpp:2:
./gtkmmocascade.h:12:38: error: AIS_InteractiveContext.hxx: No such file or directory
./gtkmmocascade.h:14:24: error: V3d_View.hxx: No such file or directory
./gtkmmocascade.h:15:26: error: V3d_Viewer.hxx: No such file or directory
./gtkmmocascade.h:17:35: error: Geom_BSplineSurface.hxx: No such file or directory
./gtkmmocascade.h:19:37: error: AIS_InteractiveObject.hxx: No such file or directory
./gtkmmocascade.h:20:40: error: Graphic3d_NameOfMaterial.hxx: No such file or directory

Opp’s I seem to have regressed…

jonas@Ubuntu4:~/gtkmmocascade$ locate AIS_InteractiveContext.hxx
/usr/include/opencascade/AIS_InteractiveContext.hxx

The issue would be with the src/Makefile.am. I make a couple of tweeks. I seems to be back to my orginal issue.
Now…. I’m back this this message

jonas@Ubuntu4:~/gtkmmocascade$ cd src
jonas@Ubuntu4:~/gtkmmocascade/src$ ls
gtkmmocascade.cpp  gtkmmocascade-main.o  MakeBottle.cpp  Makefile.am   Makefile.in
gtkmmocascade.h    main.cpp              Makefile        Makefile.am~  Makefile.old
jonas@Ubuntu4:~/gtkmmocascade/src$ cd ..
jonas@Ubuntu4:~/gtkmmocascade$ make
make  all-recursive
make[1]: Entering directory `/home/jonas/gtkmmocascade’
Making all in src
make[2]: Entering directory `/home/jonas/gtkmmocascade/src’
make[2]: *** No rule to make target `gtmmocascade.cpp’, needed by `gtkmmocascade-gtmmocascade.o’.  Stop.
make[2]: Leaving directory `/home/jonas/gtkmmocascade/src’
make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/home/jonas/gtkmmocascade’
make: *** [all] Error 2
jonas@Ubuntu4:~/gtkmmocascade$
Man this is frustrating….
Ok… I’m going retrace my steps and think about this…
I download some source from here…http://edwin.iband.net/opencascade/gtkmmocascade.tar.bz2
Some thing was screwed up with the tar ball. I believe I manually extracted each file via google source..
Now the problem the package is with the makefiles. I’m using opencascade from a .deb files where everythings is in a standard location….
I tried doing two things at once, fix the locations and use automake…. I think I’m missing something very very obvious…
Perhaps… I could just try to fix the makefiles with out using automake and see where that gets me…
Ok… Since, my version of opencascade was made from a .deb I needed change the some of the specified locations.
The makefile as downloaded looked like this:
CC=g++

TARGET=makebottle

OBJS= main.o \
MakeBottle.o \
gtkmmocascade.o

GTK_INCLUDES=`pkg-config gtkmm-2.4  gtkglextmm-1.2 –cflags `
GTK_LDFLAGS=`pkg-config  gtkmm-2.4  gtkglextmm-1.2 –libs`

OCC_INCLUDES_OLD=-DCSFDB -DNO_CXX_EXCEPTION -DNo_Exception  \
-DHAVE_CONFIG_H -DHAVE_WOK_CONFIG_H -DLIN -DLININTEL \
-I/opt/OpenCASCADE5.2/ros/inc  \
-I/opt/OpenCASCADE5.2/ros/src/WOKTclLib

OCC_INCLUDES=-DCSFDB \
-DHAVE_CONFIG_H -DHAVE_WOK_CONFIG_H -DLIN -DLININTEL \
-I/opt/OpenCASCADE5.2/ros/inc  \
-I/opt/OpenCASCADE5.2/ros/src/WOKTclLib

OCC_LDFLAGS=-L/opt/OpenCASCADE5.2/ros/Linux/lib

LIB_OCC= -lTKernel -lTKMath -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo \
-lTKPrim -lTKBool -lTKFeat -lTKFillet -lTKOffset -lTKHLR \
-lTKService -lTKV2d -lTKV3d -lTKPCAF -lTKCDF -lTKCAF \
-lPTKernel -lTKIGES -lTKSTEP -lTKSTL -lTKVRML -lTKShHealing \
-lTKXSBase -lTKPShape -lTKShapeSchema -lTKOpenGl  -lTKBO  \
-lTKBool -lTKTopAlgo -lTKPrim -lTKOffset -lTKFillet -lTKBO

CPPFLAGS= -Wno-deprecated -I./ $(GTK_INCLUDES) $(OCC_INCLUDES)
CFLAGS=$(CPPFLAGS)

LDFLAGS=$(GTK_LDFLAGS) $(OCC_LDFLAGS) $(LIB_OCC)

$(TARGET):$(OBJS)
$(CC) -o $@ $^ $(LDFLAGS)

.PHONY: clean distclean

clean:
-rm -f $(OBJS)

distclean:
-rm -f $(TARGET)

.SUFFIXES: .cpp .o

.cpp.o:
$(CC) $(CPPFLAGS) -c $< -o $@

main.o          : main.cpp gtkmmocascade.h
MakeBottle.o    : MakeBottle.cpp
gtkmmocascade.o : gtkmmocascade.cpp gtkmmocascade.h

I had to tweek it to look like this:

CC=g++

TARGET=makebottle

OBJS= main.o \
MakeBottle.o \
gtkmmocascade.o

GTK_INCLUDES=`pkg-config gtkmm-2.4  gtkglextmm-1.2 –cflags `
GTK_LDFLAGS=`pkg-config  gtkmm-2.4  gtkglextmm-1.2 –libs`

OCC_INCLUDES_OLD=-DCSFDB -DNO_CXX_EXCEPTION -DNo_Exception  \
-DHAVE_CONFIG_H -DHAVE_WOK_CONFIG_H -DLIN -DLININTEL \
-I/usr/include/opencascade
#-I/opt/OpenCASCADE5.2/ros/src/WOKTclLib this directory doesn’t exist

OCC_INCLUDES=-DCSFDB \
-DHAVE_CONFIG_H -DHAVE_WOK_CONFIG_H -DLIN -DLININTEL \
-I/usr/include/opencascade
#  \
#             -I/opt/OpenCASCADE5.2/ros/src/WOKTclLib

OCC_LDFLAGS=-L/usr/lib

LIB_OCC= -lTKernel -lTKMath -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo \
-lTKPrim -lTKBool -lTKFeat -lTKFillet -lTKOffset -lTKHLR \
-lTKService -lTKV2d -lTKV3d -lTKPCAF -lTKCDF -lTKCAF \
-lPTKernel -lTKIGES -lTKSTEP -lTKSTL -lTKVRML -lTKShHealing \
-lTKXSBase -lTKPShape -lTKShapeSchema -lTKOpenGl  -lTKBO  \
-lTKBool -lTKTopAlgo -lTKPrim -lTKOffset -lTKFillet -lTKBO

CPPFLAGS= -Wno-deprecated -I./ $(GTK_INCLUDES) $(OCC_INCLUDES)
CFLAGS=$(CPPFLAGS)

LDFLAGS=$(GTK_LDFLAGS) $(OCC_LDFLAGS) $(LIB_OCC)

$(TARGET):$(OBJS)
$(CC) -o $@ $^ $(LDFLAGS)

.PHONY: clean distclean

clean:
-rm -f $(OBJS)

distclean:
-rm -f $(TARGET)

.SUFFIXES: .cpp .o

.cpp.o:
$(CC) $(CPPFLAGS) -c $< -o $@

main.o          : main.cpp gtkmmocascade.h
MakeBottle.o    : MakeBottle.cpp
gtkmmocascade.o : gtkmmocascade.cpp gtkmmocascade.h

This actually worked :)
I actually have an image that I’d like to post here. But for some reason I can’t get it to upload at the moment :(
Hmmm… It seems to be a problem related to Adobe Flash (which I did download a while back…)

http://wordpress.org/support/topic/177127 I’m not in the mood to explore this one for now, so I guess they’ll be no pictures till wordpress 2.7 which is still in beta, comes out.

Working through the gtkmm tutorial (Part 4)

Ok… The elections have been over for a few days but its been kind of hard to get back into my morning groove of study before work… Anyway lets see what we can do here. I’ve been sort of stuck the last couple of days around Hello World in gtkmm in the tutorial. There’s alot of good content in this tutorial, but someone I’m a different wavelength so far so I’m having a hard time staying focused on it. This sort of got me sort of unfocused browsing mode in all things gtkmm in my pc at the moment. For example… I installed gtkmm on my Ubuntu Linux box and there very interesting image of the gtkmm object hierarchy located locally on you machine… at /usr/share/doc/gtkmm-2.4/docs/reference/widget_hierarchy.png  .  I wanted to post a link but I could really find this quickly with google images.

I noticed there was a html file showing the widget hierarchy.  I thought I could just past that into this post, put that isn’t going to work… But… I just discovered something very useful.   The whole thing is interactive.  Click on the object and you go to the documentation.  I see at the bottom this was generated by Doxygen…

Actually what got me curious in the main.cc of the hello world tutorial

#include <gtkmm/main.h> #include “helloworld.h” int main (int argc, char *argv[]) { Gtk::Main kit(argc, argv); HelloWorld helloworld; //Shows the window and returns when it is closed. Gtk::Main::run(helloworld); return 0; }

The tutorial states that any time you use gtkmm you need this in your main function call: Gtk::Main kit(argc, argv); and it follows that if you have that you need this also #include <gtkmm/main.h> . I was looking at the “/usr/include/gtkmm-2.4/gtkmm/main.h”.  There is so much going on there, I’m not going to get myself off track there.  Very interesting stuff, but I think I found just doing to  add that  to my  to do list.. Studying how the gtkmm wrapper is designed to go around gtkmm.  But as they say that’s for another day..  Hmm… That’s an idea… adding  a todo list to my blog… Ehh… So this project has the following files the project

  • helloworld.cc
  • helloworld.h
  • main.cc

Looking through main.cc nothing really confuses… I suppose lets look at the header file helloworld.h

#ifndef GTKMM_EXAMPLE_HELLOWORLD_H
#define GTKMM_EXAMPLE_HELLOWORLD_H

#include <gtkmm/button.h>
#include <gtkmm/window.h>

class HelloWorld : public Gtk::Window
{

public:
HelloWorld();
virtual ~HelloWorld();

protected:
//Signal handlers:
virtual void on_button_clicked();

//Member widgets:
Gtk::Button m_button;
};

#endif // GTKMM_EXAMPLE_HELLOWORLD_H

Ok.. Lets see… I understand whats going on with

class HelloWorld : public Gtk::Window

But its not burned into memory on how to describe it..  Let me check… Hmm.  The site I had in mind isn’t book marked in my favorites yet…. I think I have hard copy somewhere buried on my desk………… Not under the cat…. Ok… Here it is … Published by Juan Soulie…. No hyperlink on the printout… Lil google and here’s the link: http://www.cplusplus.com/doc/tutorial/ I haven’t looked at this since I first started this endeavor.  As I recall, it was so concise you needed it was giving me brain overload…. Well I sort of understand this stuff again and lets give it a try. Bother time for work..  Ok…. I’m back from work and nice and quite in the morning.
Yikes, I just re-read my post.  It required a bunch of editing…  Oopps.
Anyway… Working from the inside out.
The “::” is known as the scoping operator. Quote from the tutorial:classes(I)

The scope operator (::) specifies the class to which the member being declared belongs, granting exactly the same scope properties as if this function definition was directly included within the class definition.

That seems straight forward enough..
Refering to tutorial(inheritance) Now the “:” is the mechanism by which the derived class “Helloworld” inherits all the public member functions of the base class.
So as far as the “Class”, at this point I get it…

At this point, I feel like I have a pretty good grasp has far as whats going on with the constructor

HelloWorld();

and the destructor sort of makes sense to me, but I’m still a little fuzzy on the term virtual….

virtual ~HelloWorld();

The going through the tutorial reference of polymorphism to understand this.
I ran through the tutorial and I understand what virtual does but not well enough to explain it. So… I’m going to quote from the tutorial:

Therefore, what the virtual keyword does is to allow a member of a derived class with the same name as one in the base class to be appropriately called from a pointer, and more precisely when the type of the pointer is a pointer to the base class but is pointing to an object of the derived class, as in the above example.

A class that declares or inherits a virtual function is called a polymorphic class.

I see this virtual constantly, with destructors in source code I’ve been perusing I did a quick google search and found some a nice explanation on why it’s done.
http://www.ehow.com/how_2156256_use-c-virtual-destructors.html
I guess the purpose to this prevent memory leaks.

On the rest of stuff in the helloworld.h seems fairly clear to me, but I’m sure I’ll have some issues when I dig into actual function definitions in helloworld.cc. Well lets see:

#include “helloworld.h”
#include

HelloWorld::HelloWorld()
: m_button(“Hello World”) // creates a new button with label “Hello World”.
{
// Sets the border width of the window.
set_border_width(10);

// When the button receives the “clicked” signal, it will call the
// on_button_clicked() method defined below.
m_button.signal_clicked().connect(sigc::mem_fun(*this,
&HelloWorld::on_button_clicked));

// This packs the button into the Window (a container).
add(m_button);

// The final step is to display this newly created widget…
m_button.show();
}

HelloWorld::~HelloWorld()
{
}

void HelloWorld::on_button_clicked()
{
std::cout << “Hello World” << std::endl;
}

I was just thinking I don’t even think I got this thing to run yet..
Lets see….

jonas@Ubuntu4:~/gtkmm_examples/book/helloworld$ ls
helloworld.cc helloworld.h main.cc
jonas@Ubuntu4:~/gtkmm_examples/book/helloworld$ g++ main.cc -o helloworld `pkg-config gtkmm-2.4 –cflags –libs`
/tmp/ccwMhi0L.o: In function `main’:
main.cc:(.text+0×143): undefined reference to `HelloWorld::HelloWorld()’
main.cc:(.text+0×160): undefined reference to `HelloWorld::~HelloWorld()’
main.cc:(.text+0×173): undefined reference to `HelloWorld::~HelloWorld()’
collect2: ld returned 1 exit status
jonas@Ubuntu4:~/gtkmm_examples/book/helloworld$

Now that is strange….
Doh….. I found my this exact error on a Polish ubuntu site….. I wish I could read Polish (it looks like they gave the guy who made the post a little grief, but it gave me the clue to the now obvious mistake I made. Me bad… Let me try this…

jonas@Ubuntu4:~/gtkmm_examples/book/helloworld$ ls
helloworld.cc helloworld.h main.cc
jonas@Ubuntu4:~/gtkmm_examples/book/helloworld$ g++ main.cc helloworld.cc -o helloworld `pkg-config gtkmm-2.4 –cflags –libs`
jonas@Ubuntu4:~/gtkmm_examples/book/helloworld$ ls
helloworld helloworld.cc helloworld.h main.cc
jonas@Ubuntu4:~/gtkmm_examples/book/helloworld$ ./helloworld
Hello World

Much Much better :)
Ok… So much for the quiet Saturday morning…. The whole family from the Wife down to the dogs are coming in to say good morning…..
Ok… The wife is surfing the daughter is working on a computer game… so onward to helloworld.cc
Soo the code section looks like:

#include “helloworld.h”
#include <iostream>

HelloWorld::HelloWorld()
: m_button(“Hello World”)   // creates a new button with label “Hello World”.
{
// Sets the border width of the window.
set_border_width(10);

// When the button receives the “clicked” signal, it will call the
// on_button_clicked() method defined below.
m_button.signal_clicked().connect(sigc::mem_fun(*this,
&HelloWorld::on_button_clicked));

// This packs the button into the Window (a container).
add(m_button);

// The final step is to display this newly created widget…
m_button.show();
}

HelloWorld::~HelloWorld()
{
}

void HelloWorld::on_button_clicked()
{
std::cout << “Hello World” << std::endl;
}

The first thing I need to refresh on is the use of the initialiser [ or is an initializer] statement.

HelloWorld::HelloWorld()
: m_button(“Hello World”) // creates a new button with label “Hello World”.
{

I vaguely remember running across this in the Kuntz course. Lets see if I can find a better explanation..
Hmm. I was googling to see if what I could find and I just ran past an interesting post on the ubuntu forum:looking for a _sane_ way to use GTK with C++

One of the links points to: Gtk::builder
And yet another tutorial on how to use it:
GTK+ and Glade3 GUI Programming Tutorial – Part 1
This also led me to: VB Programmer’s Intro to Linux Programming with GTK+
Ohhh boy this guy has a lot of cool stuff how about this:
Using Your PC Sound Card As an Oscilloscope in Linux

Ok…. This has got me very intrigued. Working through this gtkmm hasn’t been exactly what I call results orientated.
This direct gtkmm coding approach is somewhat tedious…. I think I’m going to give this glade a look.

Running through the autotools tutorial

Picking up from my last post:
http://www.lrde.epita.fr/~adl/autotools.html
Hm…. Page 95 of the tutorial gets interesting with a hello world example…

This make, autotools stuff is really confusing to me and the way I look at it is that I’m better offer getting a handle on this sooner rather than later.

Btw.. This pdf tutorial works much nicer with an adobe reader(which I downloaded from Medibuntu rather than Evince document viewer.  Carriage return works with adobe and the pages will page rather than scroll.   You need to flip through the pages to understand whats going on since its drawn like a cartoon.
Anyway back to business.
I’m starting out around page 95 of this tutorial..
I created a main.c program which I copied from the text (which by the way everything had spacing between the letters(I too figure out why one day)).
So….. Things look like this..

jonas@Ubuntu4:~/Hello_world_gnu$ ls -R
.:
src

./src:
main.c  main.c~
jonas@Ubuntu4:~/Hello_world_gnu$

Now.. Now the page that interests me is the slide titled: “‘autoreconf’ is Your Friend” on page 143.
Friends are a good thing…. Supposedly to get started you need to use “autoreconf –install” to setup the package initially… Well…. Lets see what happens for me.

jonas@Ubuntu4:~/Hello_world_gnu$ autoreconf –install
autoreconf: `configure.ac’ or `configure.in’ is required
jonas@Ubuntu4:~/Hello_world_gnu$

You know, I kind of thought that was going to happen… Really I did…
I haven’t run across the configure.in in the tutorial  I just did a search through the document… Nada…. I have seen a bunch with this configure.ac though. (178 hits to be exact).

Now pages 97-106 seems to be the meat and potatoes of what I’m looking for.  In particular:

  • configure.ac,
  • Makefile.am,
  • src/Makefile.am

It looks like these are the three critical files to get the Autotools to work(I think but do not know at this point).
I’m getting the impression that I’m on the hook to compose these manually myself..
@#%, I’m running out of time here…. Need to get to work…
I want to first try making the configure.ac and see what happens:

jonas@Ubuntu4:~/Hello_world_gnu$ autoreconf –install
configure:1987: error: possibly undefined macro: AC_PACKAGE_TARNAME
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure:1988: error: possibly undefined macro: AC_PACKAGE_VERSION
autoreconf: /usr/bin/autoconf failed with exit status: 1
jonas@Ubuntu4:~/Hello_world_gnu$ ls -R
.:
aclocal.m4  autom4te.cache  configure  configure.ac  configure.ac~  src

./autom4te.cache:
output.0  output.1  requests  traces.0  traces.1

./src:
main.c  main.c~
jonas@Ubuntu4:~/Hello_world_gnu$

I’m not sure I like where this is heading… I’m going to delete everything that got auto created and add the

  • Makefile.am,
  • src/Makefile.am

Per the tutorial instructions and see if I get an altered result..

jonas@Ubuntu4:~/amhello$ ls
configure.ac  Makefile.am  src
jonas@Ubuntu4:~/amhello$ autoreconf –install
configure:1987: error: possibly undefined macro: AC_PACKAGE_TARNAME
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure:1988: error: possibly undefined macro: AC_PACKAGE_VERSION
autoreconf: /usr/bin/autoconf failed with exit status: 1
jonas@Ubuntu4:~/amhello$ ls -R
.:
aclocal.m4  autom4te.cache  configure  configure.ac  Makefile.am  src

./autom4te.cache:
output.0  output.1  requests  traces.0  traces.1

./src:
main.c  Makefile.am
jonas@Ubuntu4:~/amhello$

Not exactly whats in the tutorial….(So what else is new.)
Ok.. So nothing in the tutorial on the following terms:
I make a bunch of silly mistakes setting up config.ac
Just ran accross another nice ref site.. http://www.cppreference.com/

Part 5) Trying to ge MakeBottle.cxx to compile.

Ok.. The original OCC download contained MakeBottle.cxx.  I copied
and rename the file an wanted to see if I can get one line to compile
at a time.  I also added a main() callout to give it some values
Anyway here it is:

#include <BRep_Tool.hxx>

#include <BRepAlgoAPI_Fuse.hxx>

#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_Transform.hxx>

#include <BRepFilletAPI_MakeFillet.hxx>

#include <BRepLib.hxx>

#include <BRepOffsetAPI_MakeThickSolid.hxx>
#include <BRepOffsetAPI_ThruSections.hxx>

#include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepPrimAPI_MakePrism.hxx>

#include <GC_MakeArcOfCircle.hxx>
#include <GC_MakeSegment.hxx>

#include <GCE2d_MakeSegment.hxx>

#include <gp.hxx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax2d.hxx>
#include <gp_Dir.hxx>
#include <gp_Dir2d.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>

#include <Geom_CylindricalSurface.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Surface.hxx>
#include <Geom_TrimmedCurve.hxx>

#include <Geom2d_Ellipse.hxx>
#include <Geom2d_TrimmedCurve.hxx>

#include <TopExp_Explorer.hxx>

#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Compound.hxx>
#include <TopTools_ListOfShape.hxx>

TopoDS_Shape
MakeBottle(const Standard_Real myWidth , const Standard_Real myHeight ,
const Standard_Real myThickness)
{
//Profile : Define Support Points
gp_Pnt aPnt1(-myWidth / 2. , 0 , 0);
/*
gp_Pnt aPnt2(-myWidth / 2. , -myThickness / 4. , 0);
gp_Pnt aPnt3(0 , -myThickness / 2. , 0);
gp_Pnt aPnt4(myWidth / 2. , -myThickness / 4. , 0);
gp_Pnt aPnt5(myWidth / 2. , 0 , 0);

//Profile : Define the Geometry
Handle(Geom_TrimmedCurve) aArcOfCircle = GC_MakeArcOfCircle(aPnt2,aPnt3 ,aPnt4);
Handle(Geom_TrimmedCurve) aSegment1       = GC_MakeSegment(aPnt1 , aPnt2);
Handle(Geom_TrimmedCurve) aSegment2       = GC_MakeSegment(aPnt4 , aPnt5);

//Profile : Define the Topology
TopoDS_Edge aEdge1 = BRepBuilderAPI_MakeEdge(aSegment1);
TopoDS_Edge aEdge2 = BRepBuilderAPI_MakeEdge(aArcOfCircle);
TopoDS_Edge aEdge3 = BRepBuilderAPI_MakeEdge(aSegment2);
TopoDS_Wire aWire  = BRepBuilderAPI_MakeWire(aEdge1 , aEdge2 , aEdge3);

//Complete Profile
gp_Ax1 xAxis = gp::OX();
gp_Trsf aTrsf;

aTrsf.SetMirror(xAxis);

BRepBuilderAPI_Transform aBRepTrsf(aWire , aTrsf);
TopoDS_Shape aMirroredShape = aBRepTrsf.Shape();
TopoDS_Wire aMirroredWire = TopoDS::Wire(aMirroredShape);

BRepBuilderAPI_MakeWire mkWire;

mkWire.Add(aWire);
mkWire.Add(aMirroredWire);

TopoDS_Wire myWireProfile = mkWire.Wire();

//Body : Prism the Profile
TopoDS_Face myFaceProfile = BRepBuilderAPI_MakeFace(myWireProfile);
gp_Vec        aPrismVec(0 , 0 , myHeight);

TopoDS_Shape myBody = BRepPrimAPI_MakePrism(myFaceProfile , aPrismVec);

//Body : Apply Fillets
BRepFilletAPI_MakeFillet mkFillet(myBody);
TopExp_Explorer             aEdgeExplorer(myBody , TopAbs_EDGE);

while(aEdgeExplorer.More()){

TopoDS_Edge aEdge = TopoDS::Edge(aEdgeExplorer.Current());

//Add edge to fillet algorithm
mkFillet.Add(myThickness / 12. , aEdge);

aEdgeExplorer.Next();
}

myBody = mkFillet.Shape();

//Body : Add the Neck
gp_Pnt neckLocation(0 , 0 , myHeight);
gp_Dir neckNormal = gp::DZ();
gp_Ax2 neckAx2(neckLocation , neckNormal);

Standard_Real myNeckRadius = myThickness / 4.;
Standard_Real myNeckHeight = myHeight / 10;

BRepPrimAPI_MakeCylinder MKCylinder(neckAx2 , myNeckRadius , myNeckHeight);
TopoDS_Shape myNeck = MKCylinder.Shape();

myBody = BRepAlgoAPI_Fuse(myBody , myNeck);

//Body : Create a Hollowed Solid
TopoDS_Face   faceToRemove;
Standard_Real zMax = -1;

for(TopExp_Explorer aFaceExplorer(myBody , TopAbs_FACE) ; aFaceExplorer.More() ; aFaceExplorer.Next()){

TopoDS_Face aFace = TopoDS::Face(aFaceExplorer.Current());

//Check if <aFace> is the top face of the bottle’s neck
Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace);

if(aSurface->DynamicType() == STANDARD_TYPE(Geom_Plane)){

Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aSurface);

gp_Pnt          aPnt = aPlane->Location();
Standard_Real aZ   = aPnt.Z();

if(aZ > zMax){

zMax         = aZ;
faceToRemove = aFace;
}
}
}

TopTools_ListOfShape facesToRemove;

facesToRemove.Append(faceToRemove);

myBody = BRepOffsetAPI_MakeThickSolid(myBody , facesToRemove , -myThickness / 50 , 1.e-3);

//return myBody;
//Threading : Create Surfaces
Handle(Geom_CylindricalSurface) aCyl1 = new Geom_CylindricalSurface(neckAx2 , myNeckRadius * 0.99);
Handle(Geom_CylindricalSurface) aCyl2 = new Geom_CylindricalSurface(neckAx2 , myNeckRadius * 1.05);

//Threading : Define 2D Curves
gp_Pnt2d aPnt(2. * PI , myNeckHeight / 2.);
gp_Dir2d aDir(2. * PI , myNeckHeight / 4.);
gp_Ax2d aAx2d(aPnt , aDir);

Standard_Real aMajor = 2. * PI;
Standard_Real aMinor = myNeckHeight / 10;

Handle(Geom2d_Ellipse) anEllipse1 = new Geom2d_Ellipse(aAx2d , aMajor , aMinor);
Handle(Geom2d_Ellipse) anEllipse2 = new Geom2d_Ellipse(aAx2d , aMajor , aMinor / 4);

Handle(Geom2d_TrimmedCurve) aArc1 = new Geom2d_TrimmedCurve(anEllipse1 , 0 , PI);
Handle(Geom2d_TrimmedCurve) aArc2 = new Geom2d_TrimmedCurve(anEllipse2 , 0 , PI);

gp_Pnt2d anEllipsePnt1 = anEllipse1->Value(0);
gp_Pnt2d anEllipsePnt2 = anEllipse1->Value(PI);

Handle(Geom2d_TrimmedCurve) aSegment = GCE2d_MakeSegment(anEllipsePnt1 , anEllipsePnt2);

//Threading : Build Edges and Wires
TopoDS_Edge aEdge1OnSurf1 = BRepBuilderAPI_MakeEdge(aArc1 , aCyl1);
TopoDS_Edge aEdge2OnSurf1 = BRepBuilderAPI_MakeEdge(aSegment , aCyl1);
TopoDS_Edge aEdge1OnSurf2 = BRepBuilderAPI_MakeEdge(aArc2 , aCyl2);
TopoDS_Edge aEdge2OnSurf2 = BRepBuilderAPI_MakeEdge(aSegment , aCyl2);

TopoDS_Wire threadingWire1 = BRepBuilderAPI_MakeWire(aEdge1OnSurf1 , aEdge2OnSurf1);
TopoDS_Wire threadingWire2 = BRepBuilderAPI_MakeWire(aEdge1OnSurf2 , aEdge2OnSurf2);

BRepLib::BuildCurves3d(threadingWire1);
BRepLib::BuildCurves3d(threadingWire2);

//Create Threading
BRepOffsetAPI_ThruSections aTool(Standard_True);

aTool.AddWire(threadingWire1);
aTool.AddWire(threadingWire2);
aTool.CheckCompatibility(Standard_False);

TopoDS_Shape myThreading = aTool.Shape();

//Building the resulting compound
TopoDS_Compound aRes;
BRep_Builder aBuilder;
aBuilder.MakeCompound (aRes);

aBuilder.Add (aRes, myBody);
aBuilder.Add (aRes, myThreading);

return aRes;
*/
}
int main () {
MakeBottle(100 , 200 ,1);
}

This is pretty much the baseline code that comes OCC  to the first line of code.

Trying: g++  -I/usr/include/opencascade -DHAVE_CONFIG_H -DHAVE_IOSTREAM -DHAVE_FSTREAM -DMAVE_LIMITS_H MakeBottle_JT.cxx
Lead to:

/tmp/ccPBD47w.o: In function `Handle_Standard_Transient::~Handle_Standard_Transient()’:
MakeBottle_JT.cxx:(.text._ZN25Handle_Standard_TransientD2Ev[Handle_Standard_Transient::~Handle_Standard_Transient()]+0xd):
undefined reference to `Handle_Standard_Transient::EndScope()’
/tmp/ccPBD47w.o: In function `TopLoc_SListOfItemLocation::~TopLoc_SListOfItemLocation()’:
MakeBottle_JT.cxx:(.text._ZN26TopLoc_SListOfItemLocationD1Ev[TopLoc_SListOfItemLocation::~TopLoc_SListOfItemLocation()]+0xe):
undefined reference to `TopLoc_SListOfItemLocation::Clear()’
collect2: ld returned 1 exit status
jonas@Ubuntu4:~/OCC_bottle$

I was starting to research error message which led me to this link:
http://www.opencascade.org/org/forum/thread_11990/

I need to digest this a little bit.

Installing gnu C++ compiler in Ubuntu Linux for Open Cascade OCC

Spring has just about sprung…. Got home tonight and worked a little on the back yard with the family….. While dumping out the thawed compost in the garden, and moving the compost bin, I was thinking…. Wouldn’t it be cool to have a small rotary composter, powered by a little direct drive wind turbine with a huge honking reduction 1000:1 or something. Boss lady tells me, I got to get the rocks moved first :(
Years ago. I was an Application Engineer for gearbox company who worked on a project on a gear reduction unite for a converted cement kiln used on a Rotary Digester. My understanding was the technology was pioneered by some german brewmaster and the thing was going to used in Dolly Parton’s Dollywood. Don’t know if Dolly still has her digester but here’s so info on the topic: Rotary Digesters.
Ok.. one more comment on Rotary kilns and we’re going back on topic. The gear boxes that drive these things typically have huge reductions, because the rotating drum rotates heavy loads very slowly. The thing to watch out for is if there is a imbalance that causes the drive to be back driven. Typically these drives (if I remember correctly) have to laid out with some type of centrifugal brake that keeps the motor from over speeding and blowing up…
Anyway back to install the GNU C++ compiler. In my last post, I talked about the synaptic package manager for installing games. So if you have no idea what I’m talking about, go back a couple of days in my blog posts.
When I first searched Synaptic, nothing came up when I searched for C++. It took me a while figure out the trick is you need to search for G++ not C++. I suppose this sense to someone somewhere. You’ll notice that there a bunch of versions of the compiler. Rather than just picking the latest version, I thought I do a little research here:
Open cascade system requirements
Oh great… looks like none gcc versions match Synaptic (if I’m reading this correctly).
Time to do a little more research here. This looks promising:
Installing Opencascade on Debian Linux This link points to:
Compilation on Fedora Core 5.0 (Not sure about version but this looks critical to fix system once OCC installed.

Ok… This looks promising. There’s a MIT guy named Adam Powell who seems to have his game on… Some links to investigate:

OpenCASCADE .deb package: call for testing!
OpenCASCADE .deb packages
http://lists.debian.org/debian-science/2008/01/threads.html
Ok…. No compiler install tonight… Time for bed.