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)

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

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.
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.
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.
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.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

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