Giving ArgoUml a whirl

Ok.. So tried umbrello from the synaptic repository and It seems like I was getting some segmentation faults on my first little try… Sort of like a bad first date… Later…

Well lets see what first impression are with

ArgoUml

When to http://argouml.tigris.org/ and downloaded at tar ball.

Hmm.. nice front end on the web page..  Seems like she may have depth and intelligence.  Perhaps its time to say hello.

Unloaded the tarball.  Extracted and started up from the command line.

So far so good.

jonas@jonas5:~/ArgoUml$ cd argouml-0.30.2
jonas@jonas5:~/ArgoUml/argouml-0.30.2$ java -jar argouml.jar

Ok… Now to the manual.
http://argouml-downloads.tigris.org/nonav/argouml-0.30/manual-0.30.pdf

Yikes…. 403 pages… The stuff I’m interested in is around page 369.
This is depressing.

http://www.argouml-users.net/forum/viewtopic.php?f=18&t=81

The software seems to go from Uml design =>code. Not the otherway around.
Ok maybe that was too much to expect.
Maybe one more try for umbrello.

Posted in Uncategorized | Leave a comment

Uml tools some basic research

I’ve been playing around trying to develop a tool to identify bad-contraints within HeeksCAD.  Well, I was reflecting to myself that this was trying to work out an electrical problem without have a circuit diagram.

The thought occurred to me that perhaps there is software out there that will automatically generate UML diagram from existing code.

http://plg.uwaterloo.ca/~migod/uml.html

http://en.wikipedia.org/wiki/List_of_Unified_Modeling_Language_tools

http://forums.codeblocks.org/index.php?topic=9769.0

http://zahidirfan.blogspot.com/2010/05/harnessing-uml-in-ubuntu.html

http://ubuntuforums.org/showthread.php?t=945715&highlight=uml

http://ubuntuforums.org/showthread.php?t=1593868&highlight=uml

http://ubuntuforums.org/showthread.php?t=1453436&highlight=uml

Ok.. So after all this..
These look the the ones to try.

umbrello (Although this requires KDE and I’m running Ubuntu (From synaptic its not loading too many dependencies so I think)
dia-gnome (This is more of a sketcher, although I saw a  Dia2code… (just not the other way around 🙁
ArgoUml(This looks like a strong possiblity)

I installed umbrello via synaptic, ran it from a terminal prompt. Seems a little grumpy since I’m not running KDE.

I wish I took better notes here, but I did something like select c++ project and I clicked my HeeksCAD folder where it installed.  (I’m not sure I should have done that).   It hasn’t crashed yet, but its been running for a while near 100 CPU.

Posted in Uncategorized | Leave a comment

Is a heekscad Constraint valid?

A friend of my was telling me a story about a programmer who worked on software he uses.
Apparently, this guy was brilliant but a bit eccentric.  I guess he would program for a couple of hours and take a nap. Wake and repeat this cycle immediately.
There must be something to this.  I woke up this morning, hopped in the shower and had an idea come to me how identify bad constraints.

Ok… I’m almost a point where I become dangerous with this C++ stuff. ie,  the point at which you think you know what your doing.  I’m not quite there yet, but getting there.

The problem that needs to be solved is that there are bugs in heekscad which are created invalid constraints which results in segmentation faults.

But… I think the you should be able to ask the Constraint itself hey are you valid?     Ok… I think that should be easy enough to do.  Build a member function within  “class Constraint”  called isValid  which will check to make sure that nothing is hosed up.

Now, what I have in mind is some type of global routine called ValidateAllConstraints.   Basically, I would iterate through all the constraints and check if they’re valid.   Sounds simple enough.  Looking at the code, I’m still a little fuzzy on how to do this.
I think my path lies here:

// SolveSketch.cpp
// Copyright (c) 2009, Dan Heeks
// This program is released under the BSD license. See the file COPYING for details.

#include “stdafx.h”
#include “Sketch.h”
#include “../interface/ObjList.h”
#include “SolveSketch.h”
#include “ConstrainedObject.h”
#include “EndedObject.h”
#include “HArc.h”
#include “HCircle.h”
#include “HEllipse.h”
#include “../sketchsolve/src/solve.h”
#include “HDimension.h”

//This file traverses the tree associated with a sketch and creates and linear
//data structure suitable for use by sketch solve. If the solver is succesful,
//the new points are written into the corresponding heeksobj’s.

arc GetArc(HArc* a);
circle GetCircle(HCircle* a);
ellipse GetEllipse(HEllipse* a);
line GetLineFromEndedObject(EndedObject* eobj);
point GetPoint(HPoint* point);
void AddPointConstraints(HPoint* point);
int solvewpoints(double  **parms,int nparms, constraint * cons, int consLength, std::set<double*> fixed, int isFine);

std::vector<double*> params;
std::set<double*> paramset;
std::set<double*> fixedset;
std::vector<constraint> constraints;
std::set<Constraint*> cons;
std::map<HeeksObj*,HeeksObj*> pointonpoint;

I’m  very tempted to pop a pointer into class constraint of
class constraint
{
public:

Constraint * HeeksContraint // Tempted to add this. To be able to valididate that everything jives.
constraint(){parameter = 0;}
constraintType type;
point point1;
point point2;
line line1;
line line2;
line SymLine;
circle circle1;
circle circle2;
ellipse ellipse1;
ellipse ellipse2;
arc arc1;
arc arc2;
double *parameter; //radius, length, angle etc…
};

I need to think on this a bit..

Posted in Uncategorized | Leave a comment

First heekscad code contribution, and working on figuring what to do on the second

Well, I submitted what I consider actually coding contribution to Heekscad
http://code.google.com/p/heekscad/source/detail?r=1332
It’s not really a address the root cause of why these constraint errors are happening, but at least it catches some of them on a file load and blocks them so they don’t create segmentation faults.

I’m thinking that eventual this could be used on file save as well as file load. I was playing around with my pop-up card project and it seemed to be filtering the contraint bugs pretty well… If I ran into a critter, I might loose a constraint, but a least the program wouldn’t crash.

Than I start getting some segmentation faults, which I think are being caused by duplicate constraints. Man is this irritating….

So…. I think the next thing to investigate is if there is a checkForDuplicateContraint function within Heekscad and if not, write one.

After that, I suppose we need to comeup with a routine to validate the constraints within memory and if someone goofy shows up, pop up a message box. I think that might be useful to zero in on what ever is creating these problems and hopefully fix it.

So..
First step I think is poking around src/ConstraintObject.h

// ConstrainedObject.h
// Copyright (c) 2009, Dan Heeks
// This program is released under the BSD license. See the file COPYING for details.

#pragma once

class Constraint;

#include “../interface/HeeksObj.h”
#include “Constraint.h”
class HPoint;

class ConstrainedObject: public ObjList{
public:
std::list constraints;

ConstrainedObject();
~ConstrainedObject(void);

const ConstrainedObject& operator=(const ConstrainedObject &b);

virtual void LoadToDoubles();
virtual void LoadFromDoubles();

void SetAbsoluteAngleConstraint(EnumAbsoluteAngle angle);
bool SetPerpendicularConstraint(ConstrainedObject* obj);
bool SetParallelConstraint(ConstrainedObject* obj);
bool SetEqualLengthConstraint(ConstrainedObject* obj);
bool SetColinearConstraint(ConstrainedObject* obj);
bool SetConcentricConstraint(ConstrainedObject* obj);
bool SetEqualRadiusConstraint(ConstrainedObject* obj);
void glCommands(HeeksColor color, gp_Ax1 mid_point);
bool RemoveExisting(HeeksObj* obj, EnumConstraintType type);
Constraint* GetExisting(EnumConstraintType type);
bool HasConstraints();
void ReloadPointers();
void SetCoincidentPoint(ConstrainedObject* obj, bool remove);
bool HasPointConstraint(ConstrainedObject* obj);
void SetLineLengthConstraint(double length);
void SetLineVerticalLengthConstraint(double length);
void SetLineHorizontalLengthConstraint(double length);
void SetRadiusConstraint(double radius);
void SetLineLength(double length);
void SetLineVerticalLength(double length);
void SetLineHorizontalLength(double length);
void SetRadius(double radius);
void SetTangentConstraint(ConstrainedObject* obj);
void SetPointOnLineConstraint(HPoint* obj);
void SetPointOnLineMidpointConstraint(HPoint* obj);
void SetPointOnArcConstraint(HPoint* obj);
void SetPointOnArcMidpointConstraint(HPoint* obj);
void SetPointOnCircleConstraint(HPoint* obj);
void SetPointFixedConstraint();
};

Hmm… This looks real promising here:
I think poking around the implementation of these functions could give me an idea of what I need to do.
bool RemoveExisting(HeeksObj* obj, EnumConstraintType type);
Constraint* GetExisting(EnumConstraintType type);
bool HasConstraints();

So… I was looking at these implementations:
bool ConstrainedObject::HasConstraints()
{
return !constraints.empty();
}

bool ConstrainedObject::HasPointConstraint(ConstrainedObject* obj)
{
std::list::iterator it;
for(it = constraints.begin(); it!=constraints.end(); ++it)
{
Constraint* c = *it;
if(c->m_type == CoincidantPointConstraint)
{
if(c->m_obj1 == this && c->m_obj2 == obj)
return true;
if(c->m_obj2 == this && c->m_obj1 == obj)
return true;
}
}
return false;
So… I think I could hack up HasPointConstraint to see if I can turn it into something that has a duplicate constraint… I need to think about this some more.
What I don’t understand at the moment… Is how “constrains” falls into this…  Lets see:

class constraint
{
public:
constraint(){parameter = 0;}
constraintType type;
point point1;
point point2;
line line1;
line line2;
line SymLine;
circle circle1;
circle circle2;
ellipse ellipse1;
ellipse ellipse2;
arc arc1;
arc arc2;
double *parameter; //radius, length, angle etc…
};

Ok.. I wasn’t expecting this. So… We have a vector which defines arcs and line… and when you go into the definition of those things… Point for example there is a pointer..

class point
{
public:
point(){x = 0; y = 0;}
double * x;
double * y;
};

So x, y are pointers… So does that me they are pointers to the heeksobj?? Don’t know yet…. There be a lot of weird stuff going on here….
What the… there is a “class Constraint” and a

c

lass constraint”

Oh… that’s not confusing..

class Constraint : public HeeksObj{
public:
ConstrainedObject* m_obj1;
ConstrainedObject* m_obj2;

EnumConstraintType m_type;
EnumAbsoluteAngle m_angle;

double m_length;

Constraint();
Constraint(const Constraint* obj);
Constraint(EnumConstraintType,EnumAbsoluteAngle,ConstrainedObject* obj);
Constraint(EnumConstraintType,double length,ConstrainedObject* obj);
Constraint(EnumConstraintType,ConstrainedObject* obj);
Constraint(EnumConstraintType,ConstrainedObject* obj1, ConstrainedObject* obj2);
Constraint(EnumConstraintType,EnumAbsoluteAngle,double length,ConstrainedObject* obj1, ConstrainedObject* obj2);

~Constraint(void);

void ReloadPointers();
bool IsTransient(){return true;}
HeeksObj *MakeACopy(void)const;
int GetType()const{return ConstraintType;}
const wxChar* GetTypeString(void)const{return _(“Constraint”);}
void Disconnect(std::list parents);
void WriteXML(TiXmlNode *root);
static HeeksObj* ReadFromXMLElement(TiXmlElement* pElem);
static void BeginSave();
static void EndSave(TiXmlNode *root);
bool IsDifferent(HeeksObj* other);

bool operator==(const Constraint &other) const {
return m_type == other.m_type && m_angle==other.m_angle && m_obj1 == other.m_obj1 && m_obj2 == other.m_obj2 && m_length == other.m_length;
}

const Constraint& operator=(const Constraint &b);

void glCommands(HeeksColor color, gp_Ax1 mid_point);
void render_text(const wxChar* str);

};

So… The big “C”onstraint is a HeeksObj and the little “c”onstraint is a object is in a vector.

I suppose that makes sense… I’m thinking that the pointer in the constraint is probably looking at that location in the heeksobj. Maybe? The thing that does make sense is how would this setup work with multiple sketches…
Hmm.
Time for a quick test.
Ok… Id’s are unique to lines and points but it looks like they done renumber in sketches.. In other works sketch 1 has lines 1-5 and sketch 2 lines 6-7… etch…

So… I did a little experiment here… I set a break point on the Constraint constructor that would fire for a horizontal line and fired up the code::blocks debugger and stepped into until I got here.

#0 ( ObjList::Add(this=0x87bbdd0, object=0x885c1e0, prev_object=0x0) (/home/jonas/HeeksCAD/interface/ObjList.cpp:224)
#1 0x80b6b40 Constraint(this=0x885c1e0, type=AbsoluteAngleConstraint, angle=AbsoluteAngleHorizontal, obj=0x87bbdd0) (/home/jonas/HeeksCAD/src/Constraint.cpp:61)
#2 0x80b56ac ConstrainedObject::SetAbsoluteAngleConstraint(this=0x87bbdd0, angle=AbsoluteAngleHorizontal) (/home/jonas/HeeksCAD/src/ConstrainedObject.cpp:149)
#3 0x812d279 SetLineHorizontal::Run(this=0x83838c4) (/home/jonas/HeeksCAD/src/HLine.cpp:42)
#4 0x8144fa2 HeeksCADapp::on_menu_event(this=0x84af4d8, event=…) (/home/jonas/HeeksCAD/src/HeeksCAD.cpp:1982)
#5 0x810a8d4 CGraphicsCanvas::OnMenuEvent(this=0x85e0488, event=…) (/home/jonas/HeeksCAD/src/GraphicsCanvas.cpp:396)
#6 0xb77bfa9f wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&) (/usr/lib/libwx_baseu-2.8.so.0:??)
#7 0xb785e209 wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () (/usr/lib/libwx_baseu-2.8.so.0:??)
#8 0xb785f2d4 wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () (/usr/lib/libwx_baseu-2.8.so.0:??)
#9 0xb785f3d3 wxEvtHandler::ProcessEvent(wxEvent&) () (/usr/lib/libwx_baseu-2.8.so.0:??)
#10 0xb7b281dd wxMenuBase::SendEvent(int, int) () (/usr/lib/libwx_gtk2u_core-2.8.so.0:??)
#11 0xb7aabdf0 ??() (/usr/lib/libwx_gtk2u_core-2.8.so.0:??)
#12 0xb3446dcc g_cclosure_marshal_VOID__VOID() (/usr/lib/libgobject-2.0.so.0:??)
#13 0xb3439252 g_closure_invoke() (/usr/lib/libgobject-2.0.so.0:??)
#14 0xb344d99d ??() (/usr/lib/libgobject-2.0.so.0:??)
#15 0xb344edb4 g_signal_emit_valist() (/usr/lib/libgobject-2.0.so.0:??)
#16 0xb344f256 g_signal_emit() (/usr/lib/libgobject-2.0.so.0:??)
#17 0xb39563e5 gtk_widget_activate() (/usr/lib/libgtk-x11-2.0.so.0:??)
#18 0xb38349a0 gtk_menu_shell_activate_item() (/usr/lib/libgtk-x11-2.0.so.0:??)
#19 0xb383631f ??() (/usr/lib/libgtk-x11-2.0.so.0:??)
#20 0xb382bc64 ??() (/usr/lib/libgtk-x11-2.0.so.0:??)
#21 0xb3825424 ??() (/usr/lib/libgtk-x11-2.0.so.0:??)
#22 0xb34378b9 ??() (/usr/lib/libgobject-2.0.so.0:??)
#23 0xb3439252 g_closure_invoke() (/usr/lib/libgobject-2.0.so.0:??)
#24 0xb344d5e6 ??() (/usr/lib/libgobject-2.0.so.0:??)
#25 0xb344ec33 g_signal_emit_valist() (/usr/lib/libgobject-2.0.so.0:??)
#26 0xb344f256 g_signal_emit() (/usr/lib/libgobject-2.0.so.0:??)
#27 0xb3952636 ??() (/usr/lib/libgtk-x11-2.0.so.0:??)
#28 0xb381da5d gtk_propagate_event() (/usr/lib/libgtk-x11-2.0.so.0:??)
#29 0xb381ee07 gtk_main_do_event() (/usr/lib/libgtk-x11-2.0.so.0:??)

Ok… I got to say this code blocks debugger is way cool.

This is cool:

void ConstrainedObject::SetAbsoluteAngleConstraint(EnumAbsoluteAngle angle)
{
Constraint* c = GetExisting(AbsoluteAngleConstraint);
if(c)
{
if(c->m_angle == angle)
{
constraints.remove(c);
delete c;
}
else
c->m_angle = angle;

}
else
constraints.push_back(new Constraint(AbsoluteAngleConstraint,angle,this));
}

Ok… and this…

bool ObjList::Add(HeeksObj* object, HeeksObj* prev_object)
{
if (object==NULL) return false;
if (!CanAdd(object)) return false;
if (m_objects.size()==0 || prev_object==NULL)
{
m_objects.push_back(object);
LoopIt = m_objects.end();
LoopIt–;
}
else
{
for(LoopIt = m_objects.begin(); LoopIt != m_objects.end(); LoopIt++) { if (*LoopIt==prev_object) break; }
m_objects.insert(LoopIt, object);
}
m_index_list_valid = false;
HeeksObj::Add(object, prev_object);

#ifdef HEEKSCAD
if((!wxGetApp().m_in_OpenFile || wxGetApp().m_file_open_or_import_type != FileOpenTypeHeeks) && object->UsesID() && (object->m_id == 0 || (wxGetApp().m_file_open_or_import_type == FileImportTypeHeeks && wxGetApp().m_in_OpenFile)))
{
object->SetID(wxGetApp().GetNextID(object->GetIDGroupType()));
}
#else
if(!heeksCAD->InOpenFile() && object->UsesID() && object->m_id == 0)
{
object->SetID(heeksCAD->GetNextID(object->GetIDGroupType()));
}
#endif

return true;
}

So this is scary.. this sort almost makes sense whats going on.   I need to look at whats going on with bool ObjList::Add(HeeksObj* object, HeeksObj* prev_object)  a little more in detail.
Something for a another day.

Posted in Uncategorized | Leave a comment

Yet another heekscad constraint critter… Go figure… Time to build a fly swatter

I think I’m running into a unimplemented function or something…

I’m getting the segmentation fault in this routine:

line GetLineFromEndedObject(EndedObject* eobj)
{

eobj->LoadToDoubles();
point p;
p.x = &eobj->A->mx; p.y = &eobj->A->my;
PushBack(p.x);
PushBack(p.y);
point p2;
p2.x = &eobj->B->mx; p2.y = &eobj->B->my;
PushBack(p2.x);
PushBack(p2.y);

line l;
l.p1 = p;
l.p2 = p2;

return l;
}

Sort of hard to dump xml into this post. Oh well.

I think the issue is with eobj->LoadToDoubles();

……
Ok… so I’ve must have been thinking about this in my sleep.  It looks to me that for whatever reason, bogus constraints are being saved into the XML file and then being read back into Heekscad.     I don’t think(could be wrong here) that the solver initially fires up when a drawing is loaded.    So when the solver is fires it runs into one of these constraints that is pointing  to bogusness it croaks.   From what I see the code is written in such a way that these is no qc checks being made when the XML is being written out or read.
So…
Defining the problem:
The are bogus constraints being written out/read into a heeksfile.
The bogus constraint needs to be identified.

Once identified, I suppose we need some type of option to either:
block it (for those of use who just want to get on with our lives)
flag it (for those of use who want to know the critter is getting into the xml file prior to reloading it)

So..  I think there needs to be a generic function called CheckForValidConstraint
which take the constraint.
I was going to find an example here of what I think might be an error:
Constraint type=”CoincidantPointConstraint” angle=”AbsoluteAngleHorizontal” length=”0″ obj1_id=”2″ obj1_type=”2″ obj2_id=”5″ obj2_type=”2″ id=”0″ /

Ok.. Unless this has some funky stuff that I don’t understand yet going on with dimensional constraints, this looks to me as if it’s a bug. (perhaps not, but I’m thinking that AbsoluteAngleHorizontal would only have a single line as a member within a constraint.

Thinking about this some more, I suppose there should be errors and warnings.
Errors:
If there is a constraint ID called out where the object doesn’t exist in memory would be at the error level. That do me is an all out bug. Redo/undo, mergecommonobjects, or something else has really housed something up the constraints.
I think this would be useful to block these on a file save, so it doesn’t crash the solver on a re-load but also, if you saved after doing something… You have a better idea of what hosed things up.
Warnings:
Thinking about some more, I’ve run into instances what appears to be the wrong number of constraints are being written/read into where the Id’s appear to be valid. I would like to selectively allow these to go through or not through depending on whether they are considered to be errors or not. I suppose this could be used a vetting process. Once a particular constraint has been sufficiently beat up on, and proven to be worthy, it it on the good kids list and let it pass.

These segmentation faults are beyond irritating.

Posted in Uncategorized | Leave a comment

Trying to get back to the cylindrical popup project but these bugs related to heekscad constraints keep taunting me

I’ve been playing around with the dimensional constraints and they’re pretty cool. The insidious thing is that there are a bunch of critters in the code that seems to be causing either segmentation faults or cause the constraints on the dimensions to somehow to be disassociated.

It seems that these bug[s] seem to occurring when object[s] are being moved. Segmentation faults seem to be occurring when I move something with a fixed point, or a dimensional length constraint. The frustrating part of all this, is that this is only occurring when my model gets sufficiently complex and I have a lot of work into it. These critters have been elusive in my attempt to isolate them in the simplest of models. In a more complex model, I’ve attempted to work around by disabling the constraint prior to moving the object. But… you sort of need to rely on the memory system since. These bugs are sufficiently irritating that they really should be irradiated.

On a side note, would be nice if heekscad provided a little more information on the constraint, currently all you get is ? constraint and nothing in the properties window. It’s hard to now what your dealing with.

Anyway.. I gonna try this one more time and see if I can avoid my little critters..

Posted in Uncategorized | Leave a comment

Taking a wack at fixing my first heekscad bug.

I have the need to adjust a line to exactly 1″ in heekscad… (I just can’t get into that thar metric stuff just yet).

Anyway.. I’m suspect that since I running inch.. Some thing is hosed up in the code. I think the quickest way to isolate the code is to see where the green check icon loads up.

I was just chatting with Dan Heeks and Jon Pry
Apparently there are two ways to set a length to exactly 1″.. One is to set a fixed length constraint and the other is through a dimensional constraint.

I guess the fixed point constraint is deprecated in favor of the dimension constraint (which is also having issues in inch), but I think it might be easier to figure out rather then the dimensional… The fixed point constraint always displays metric even when inch
So I thought I’d give it a go.
The first thing I wanted to do is to see if I can isolate the section of code that applies changes to adjusted properties. If I can find that way… I should be able to single step myself into the other sections of code where the dimensions are display… That’s the theory anyway…

So… I’m looking at the

I poke around a bit and I think i found the section of code that I need to fix.

void Constraint::glCommands(HeeksColor color, gp_Ax1 axis)
{
double mag = sqrt(axis.Direction().X() * axis.Direction().X() + axis.Direction().Y() * axis.Direction().Y());
float rot = (float)atan2(axis.Direction().Y()/mag,axis.Direction().X()/mag);

glPushMatrix();
glTranslatef((float)axis.Location().X(),(float)axis.Location().Y(),(float)axis.Location().Z());
glRotatef(rot*180/(float)Pi,0,0,1);
glTranslatef(0,ANGLE_OFFSET_FROM_LINE,0);

switch(m_type)
{
case AbsoluteAngleConstraint:
switch(m_angle)
{
case AbsoluteAngleHorizontal:
render_text(_(“H”));
break;
case AbsoluteAngleVertical:
glRotatef(90,0,0,1);
render_text(_(“V”));
break;
}
break;
case LineLengthConstraint:
wxChar str[100];
wxSprintf(str,_T(“%f”),m_length);
render_text(str);
break;
case ParallelLineConstraint:
render_text(_(“L”));
break;
case PerpendicularLineConstraint:
render_text(_(“P”));
break;
default:
break;
}

glPopMatrix();
}

Ok… Something tells me that mlength is in mm… I need to convert… soo. the dimension are converting over correctly… I just need need to find that being displayed.
Lets see if I can find the dimensions.
Ok…. I think I found it..

wxString HDimension::MakeText()
{
wxString text;

double units_factor = wxGetApp().m_view_units;
switch(m_units)
{
case DimensionUnitsInches:
units_factor = 25.4;
break;
case DimensionUnitsMM:
units_factor = 1.0;
break;
case DimensionUnitsGlobal:
units_factor = wxGetApp().m_view_units;
break;
}

wxString units_str(_T(“”));
if(fabs(units_factor – 1.0) < 0.0000000001)units_str += wxString(_T(" ")) + _("mm"); else if(fabs(units_factor - 25.4) < 0.000000001)units_str += wxString(_T(" ")) + _("inch"); switch(m_text_mode) { case PythagoreanDimensionTextMode: text = wxString::Format(_T("%lg %s"), A->m_p.Distance(B->m_p)/units_factor, units_str.c_str());
break;
case HorizontalDimensionTextMode:
text = wxString::Format(_T(“%lg %s H”), fabs(A->m_p.X() – B->m_p.X())/units_factor, units_str.c_str());
break;
case VerticalDimensionTextMode:
text = wxString::Format(_T(“%lg %s V”), fabs(A->m_p.Y() – B->m_p.Y())/units_factor, units_str.c_str());
break;
}

return text;
}

Ok… So here’s my first c++ code change to heekscad. Scary..
http://code.google.com/p/heekscad/source/detail?r=1325
(Darn it… I didn’t do the indent.) I guess I’ll fix that next rev.. 😉

Posted in Uncategorized | Leave a comment

Rapidsvn frustrations solved for heekscad

My heekscad adventure lately has been a bit disappointing.  I had gotten by diagonal pop-up box design made and I was elated.  I thought test out the rest of the constraints and make a parametric model of a pop-out cylinder.  I seems I’m getting far more segmentations faults than I should be lately.
There has been a flurry of development activity lately in heekscad.  So I’m not sure if these segmentation faults I’m experience are the result of “new” bugs or “old” bugs.   Thinking about this I suppose I could download a load a revision to where things seem to have been working well and give it a whirl.  I have this silly notion that I should allways run to the latest.

Heekscad is interesting to me because it brings together many of my interests.  I’m interested in learning C++ which compared to my beloved VB6 is hard.   Anyway, getting to the topic at hand.  I’ve been using RapidSVN to download the heekscad source.   There where some changes that where made to the heekscad that didn’t make it into codeblocks project file that I tried to commit.  For what ever reason it didn’t work.  Since I haven’t had anything to commit it hasn’t been that big of an issue.

Anyway, going back through my notes… I don’t think I ever did get a commit going.

I just to commit a code::blocks project file and I got this error:

Error while performing action: Commit failed (details follow):
Server sent unexpected return value (500 Internal Server Error) in response to MKACTIVITY request for ‘/svn/!svn/…..

Researching  RapidSVN documentation it looks like development has trickled to a halt.   I don’t know why that is… Is it that good that its done. or something better out there that the ship has been abandoned…    I was all set to deep 6 RapidSvn, but I suppose I should try reading the install part of the manual at least before I do that…  http://www.rapidsvn.org/index.php/Documentation

Ok… lets see.

Programs

The ‘Programs’ tab must be filled with the paths pointing to the programs that perform Edit, Explore, Diff and Merge functions.

The suggested programs are:

Function Windows Linux Mac OS/X
Editor Scintilla/SciTE
Programmer’s Notepad
notepad.exe
Scintilla/SciTE
/usr/bin/xdg-open (to handle other file types)
TextEdit
GVim
Explorer explorer.exe nautilus /usr/bin/open
Diff KDiff3 WinMerge KDiff3 Meld (to install Meld on ubuntu, apt-get install meld) KDiff3 DiffMerge
FileMerge (via opendiff) NOTE: Requires Mac OS X Developer Tools
Merge KDiff3 DiffMerge KDiff3 KDiff3 DiffMerge

So I’ve been using code::blocks as my IDE as my editor and been very happy with that.  So I don’t think I need to worry about that… The issues I’ve been having is with Diff and Merge…
So according to the this manual, what I need to worry about is KDiff3 and Meld…  Well lets fire up synaptic and see if those are installed.
It seems that I had neither of this installed.  Meld is a single file, KDiff3 carries with it a huge amount of Kde stuff, but well, I give it a go.

Ok… Lets see View Preferences.  Sticking in your preferences.

Standard Editor: gedit
Standard Explorer:nautilus
Diff ToolLMeld
Merge Tool: KDiff3

I’m thinking that since I installed via synpatic, I can just put the program name in and not worry about the absolute path to the actual program… (Hopefullly that doesn’t bite me).
I’m thinking that I can leave program arguments blank now.  I think the program stuff mentioned in the tutorial is for the mac and the documentation indentation is screwed up.

Lets… See Dan Heeks added these tools to the visual studio project file,
SolidTools.cpp”
SolidTools.h”

This seems to be bombing when I do this in code blocks… So I guess I should add them:
That worked.. Now I saved all in code::blocks and lets see if I can to an update.

So… Here’s where I’m at in the tutorial:

  1. Using the repository bookmark created in the prior step, browse to the parent directory (or higher) that contains the file to be worked with.
  2. In the Bookmark browser, right-mouse click the desired parent directory and select Checkout New Working Copy… from the context menu.
  3. The URL will already be filled out (make sure it’s just the directory and doesn’t contain the filename (a bug), if you don’t remove the filename you’ll get an error).
  4. Enter your local path in the “Destination Directory” and click OK. This will populate your hard disk with the files and create a bookmark.
  5. Browse the bookmark in RapidSVN to the file to be edited and double-click the file.
  6. After editing and saving the file, reactivate the RapidSVN window. The status for the file should now indicate “modified”.
  7. In the right-hand window, right-mouse click on the modified file and select Update… to update your file with any changes by other members of your team. If the status of the file remains “modified” it is safe to proceed to the commit step. If the file status shows “conflicted” you should resolve the conflicts before committing.
  8. In the right-hand window, right-mouse click on the modified file and select Commit…
  9. Enter a log message that briefly describes your changes and click OK.

So…

Step 6…  Ok… I just discovered something in code blocks… If you save all files in code blocks it doesn’t save the project…. That’s good to know.  You need to save the project by itself… So  Check….
Step 7) Did the update… Everthing looks good.
Step 8) Now the big moment::: right click to commit.
Step 9) Add the password stuff…..
Hot Darn it worked….  I just did my first commit….
I guess it pays to RTFM 😉

Posted in Uncategorized | Leave a comment

Recording a tutorial

This is not a fully developed thought… I just did some quick search and wanted preserve the link.

I found pyvnc2swf in the ubuntu synpatic repositories.  I thought it would be sort of cool to record a video of stuff I’m doing with constraints.  I thought something along the lines of a poor man’s kinematic linkage synthesis… Just a thought

http://www.linux.com/archive/articles/57196

Posted in Uncategorized | Leave a comment

Parametric modeling of a popup cylinder

The diagonal box constraint that I did a few days back didn’t missed a few of the contraints in heekscad.
I thought I’d try a cylinder, which probably test out a few that I haven’t done yet.

There’s a post on the web for  pop-up cylinder as well as a few other objects here.

http://www.popularkinetics.com/volume_cylinder_page.htm

My initial plan was to:

  • Open up the PDF image Alt print screen to save it into a png file
  • load png image into heekscad. where I can import the image.
  • Once imported, I’m going to trace it out  it out using heekscam.
  • Set up some parametric constraints to create a generalized cylindrical model.

Seemed like a good idea at the time I couldn’t figure out how to that with the sketcher.  It seems like that can not be done directly.
Oh my I thought this would be a quicky to test out the rest of the constraints…. Not so easy..

What I need to do is to

enum constraintType
{
pointOnPoint,
pointToLine,
pointOnLine,
horizontal,
vertical,
internalAngle,
radiusValue,
tangentToArc,
tangentToArcStart,
tangentToArcEnd,
tangentToCircle,
arcRules,
P2PDistance,
P2PDistanceVert,
P2PDistanceHorz,
P2LDistance,
P2LDistanceVert,
P2LDistanceHorz,
lineLength,
equalLegnth,
arcRadius,
equalRadiusArcs,
equalRadiusCircles,
equalRadiusCircArc,
concentricArcs,
concentricCircles,
concentricCircArc,
circleRadius,
externalAngle,
parallel,
perpendicular,
colinear,
pointOnCircle,
pointOnArc,
pointOnLineMidpoint,
pointOnArcMidpoint,
pointOnCircleQuad,
symmetricPoints,
symmetricLines,
symmetricCircles,
symmetricArcs,
pointOnArcStart,
pointOnArcEnd,
arcStartToArcEnd,
arcStartToArcStart,
arcEndToArcEnd,
arcTangentToArc,
circleTangentToCircle,
circleTangentToArc,
tangentToEllipse
};

Ok… I was de-constructing this mechanism and its sort of cool.  Basically all this thing is is two four bar linkages put together in a unique way.    Anyway…  I need to be off to work..   Just a quick thought here.  The way the mechanism works is that you should be able to stack a smaller cylinder on top of a bigger cylinder….  I can see the crafters getting into this one… Birthday cake..

Posted in Uncategorized | Leave a comment