Author Topic: Gentle crash 2 - its not me this time  (Read 28243 times)

Offline Wrinklespot

  • Droid
  • **
  • Posts: 81
    • View Profile
Gentle crash 2 - its not me this time
« on: May 28, 2008, 22:09:53 pm »
Hello again Andy,
I managed to get another crash similar to the last one.
I traced a school logo from a bitmap in Corel Draw 11 (manually) to a vector format and saved it as a .dxf using AutoCad14 format. Then I imported it into CB and tweaked it a bit further and added an engrave mop.
But when I try to generate gcodes, it crashes.
I found the offending item is Wings spline 47. I deleted this and all is now well.
The error is probably mine and Corel draw's but the crash was Cambam's, so maybe it will help if you see what went on.
CBplus crashes, whilst good old CB just seems to hang
Cheers
Steve

Offline EAC

  • Storm Trooper
  • ***
  • Posts: 179
    • View Profile
    • Eureka Airctraft
Re: Gentle crash 2 - its not me this time
« Reply #1 on: May 29, 2008, 02:05:05 am »
Andy is trying to get splines to work as native entities, but as far as I know, you need to convert splines to polylines before doing anything with them.   I converted the splines to polylines onyour CB file, and all worked perfectly. Do <ctrl>A then <ctrl>P.   If you are working with closed entities, <ctrl>J will join the polylines.

The bright side is that CamBam is the only affordable cam program that actually load splines, instead of expecting you to degrade your cad file by reverting to Acad ver 12, like the rest do.  Lines instead of curves... eeeewwww >:(

Don 

Offline Wrinklespot

  • Droid
  • **
  • Posts: 81
    • View Profile
Re: Gentle crash 2 - its not me this time
« Reply #2 on: May 29, 2008, 16:39:30 pm »
Thanks Don.
So I highlighted a tiny failing in part of a powerful feature, that CamBam competitors can't even start to handle, and despite it still being a work in progess, it did 99% of my job and anyway there are at least 2 easy workarounds for the last bit.
Clearly not a problem.

But can someone help me understand what is going on with these CAD entities.
I think I understand that splines are 3 point curves as per M. Bezier (nice diagrams on Wikipedia, too) but what is a polyline?  Why do I have to convert a pair of concentric circles into polylines(?) before I can create a region?
This issue and any similar ones (like your workaround) leave me bemused. I can generally stagger through, but I've little idea why I'm making the necessary changes. Is there any background reading somewhere so I can better understand it all?
Steve

Offline EAC

  • Storm Trooper
  • ***
  • Posts: 179
    • View Profile
    • Eureka Airctraft
Re: Gentle crash 2 - its not me this time
« Reply #3 on: May 29, 2008, 19:28:26 pm »
This gets beyond the scope of CB, but splines are much more complicated math entities than simple Bezier curves.  They are based on nurbs and knots that mysteriously shape the curve.  Each knot affects the curve at multiple locations, along the whole length  ???

Bezier curves simply have two end points and two 'control points', which directly have no affect on the adjacent curve, although points on the next curve can have a relationship to the points on the previous curve.

A polyline is a series of connected entities (lines and arcs) than constitute a continuous path.  I think (and can feel free to correct me) that CamBam's internal toolpath generator works at a polyline level for the time being.

Those of us that have been around CB from the beginning know to convert all entities to polylines before you start working.  (I have suggested to Andy that the conversion should be done automatically when a file is loaded, or an object created in CB, to shield the user from such things.)

I don't consider the conversion a work-around, simply the way things are done in CB. It sure beats files not loading or loading incorrectly, as in LazyCam or Sheetcam  :P

Andy, as I said, fell free to correct everything I said, but I think I am basically right  :-[

Don

Offline 10bulls

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 2163
  • Coding Jedi
    • View Profile
    • www.cambam.info
Re: Gentle crash 2 - its not me this time
« Reply #4 on: May 29, 2008, 20:04:06 pm »
Hello Steve,

Firstly thank you for the spline file.  I have fixed that crash in the current development release (not long now till I release it) and it behaves much better.
The main focus of coming development now is to sort out any crashes, bugs, glitches and usability issues so I really appreciate all and any bug reports like this.

Splines are actually NURBS (beziers are a subset of these).  They are very versatile and can be used to store and approximate many mathematical curves and also natural shapes.
The ultimate problem we face for CNC is that typical gcode only supports straight lines and circular (or helical) arcs.
So to convert splines to gcode you must either digitize them to lines with many small segments (a common approach), or try to fit arc and line segments to it (as I try to do in CamBam).
A Polyline is simply a linked line with straight or circular segments which corresponds nicely to the gcode requirement...this is why all the drawing objects ultimately end up as polylines before generating toolpaths from them.

Fitting polylines to splines can not be done precisely.  Under Tools->Options, there is a parameter called
SplineToPolylineTolerance.  The default 0.001.  For many spline files (especially when using mm), this is much too small and something like 0.1 may be more appropriate.  Basically this is the maximum error allowable when trying to fit a line or arc into the spline.  Smaller tolerances result in many more smaller segments needed.
There is another setting in Tools->Options called SplineCurveSteps.  This is used for displaying splines only.  If you reduce this number you will see the splines appear more jagged.  However, when you convert them to polylines they will use the tolerance value and regain their curviness.

In the later free versions, a bug crept in that used the general tolerance for SplineToPolylineTolerance, which is why the free version appears to hang with splines.  It is basically trying to fit circular arcs to a ludicrous precision.

Like you, I think there are too many drawing entities to confuse things.  My future plan is to make lines, arcs, circles, rectangles and splines all just types of polylines.  The way you edit the polylines would vary (center+diameter for cirlce, control points for splines etc).  There would be no need to do conversions to polylines as this would be done when needed by the program to a set tolerance.

Lastly a bit about regions...

Regions, like a number of other features, currently only work from polylines.  As polylines are so fundamental to gcode and CamBam, I usually get routines working with those then go back and add code to do any conversion from other types.
Sometimes I get distracted and these internal conversions remain on the todo list.  This is another good example of the type of issues I am now concentrating on ticking off.


The need to use Regions has now been greatly reduced.
In CamBam plus, you can now just select 2 (or more) concentric circles (or closed polylines, rectanges or splines), insert a pocket and it will auto detect any regions needed.
The only real need for Regions at the moment, is for profiles, so that CamBam knows whether it should be swapping the inside/outside cuts for inside shapes.

I hope that explains things a little.
Hopefully some of the more dumber and crashier parts of CamBam will start disappear soon. :)