• entries
    16
  • comments
    36
  • views
    28001

more features

Sign in to follow this  

369 views

I think this is becoming a pretty useful and cool tool (I mean the CNC editor). I guess there are some features that are not very common.

The Mechanics may be a bit strange. The selection is based on a "starting point" (from now: "sp") and an "end point" ("ep"). So only a continuous sequence can be selected. I don't know if I'll alter it in the future to be able to select multiple sequences. For some features like delete and move it would be useful, but a CNC code is a sequence after all. For example: how/where would I copy/paste multiple sequences? Anyway, the "sp" can be selected with left click, the "ep" with shift+left click. The selection remains, until another point is clicked or esc is pressed. (so no "deselection" on every clicks, it's just like in most CAD software).

Some features behave differently if only the "sp" or only the "ep" or both/neither of them are selected. Most of the time the place of the effect varies. Before "starting point", after "end point", between them, or after the last point.

Features:
(the different effects will be listed like this: only the "sp", only the "ep", both, neither of them)
  • basic constrains: when moving stuff and pressing 'shift', the movement will be constrained in a vertical/horizontal line depending on the mouse position.
  • adding a point: before "sp", after "ep", after "sp", after last point. Snapping to grid (0.01 mm step) can be toggled. The adding feature has the basic constrains and
  • tangential constrain: collinear with first segment after "sp", collinear with last segment before "ep", collinear with first segment before "sp", collinear with last segment. And
  • cross constrain: the point will be placed at the intersection of the two lines that are the neighbours of the segment where the point is inserted
  • reverse direction of selected sequence
  • reduce point count on selected sequence
  • set feed rates: only "sp" selected: simply inserts a F... command at that point, both selected: inserts a F.. command at "sp", clears all other F... commands from the sequence, inserts a F.... with the appropriate value after "ep" (the last feed rate change before "ep")
  • remove close points: removes all points that are too close to each other (in the sequence, not in absolute coordinates)
  • round all points: al points are rounded (floor/ceil/to closest) to a certain value (this will be used to test the interference between the precision of the machine and the CNC file's values)
  • Clipboarding features: paste before "sp", after "ep", replace selection, paste after last point
  • Copy with base point/paste at mouse position
  • can start from an empty project: add points with the add command
  • Some eye candy features:
    • the direction of the sequence is displayed when selected: a small arrow. This arrow implies the line for the tangential constrain too
    • the segment where the new point will be inserted is highlighted
    • a little ruler with the measure is displayed
    • legend with feedrates (my favourite)
      These are pretty much everything I needed. There's a main issue though: it's very slow. So much string parsing/reparsing/seeking all the time. Sometimes the application needs to parse 20000 points, that can be 25000 lines of code. Just a regular CNC program. But I don't think that's too much. But it takes about 4-5 seconds just to parse the whole text. Not to mention other operations: parsing+manipulating+reparsing etc etc. I need to do something about this, because it's more than annoying unfortunately. The problem is that the lines in the text vary in length (a line is between two '\n' characters). Maybe I will drop the original idea to just store the whole file in a one dimension array. I think I have to use 2 dimensions, flags pointers and other shit to avoid parsing if possible.

      But at least I can work with it. Except for the speed issue it's very good and fast to work with. I could make a program in 15 minutes with it, before that it took a whole day in stressed attention. Just to put together the final program from the pieces. Of course the time to draw the lines with CAD isn't affected. Making a CAD software would be too great job (well, not that great just a lot of time). But I can even make simple programs from starch without the need to make the stuff in some vector editor first.


      Anyway, [size="4"]Here it ising
Sign in to follow this  


4 Comments


Recommended Comments

I stumbled across this from your recent thread resurrection and I actually tried your program. No clue about CNC, it looks nice though. But something really bothers me: If you're not using really old hardware parsing time sounds pretty heavy - and off. I'm just connecting dots here, because I remember a thread "blowing your mind" which was about string parsing with regular expression. The format looks simple enough to do with regular expressions and I doubt it would even closely take 5 seconds (the big file in the download approx needs this load time here, on a 2 GHz Intel). How do you parse ? Handwritten ?

Share this comment


Link to comment
At the moment, I load the file into a string (that's lightning fast) then I parse the string. I'm using [i]sscanf[/i] ATM (yay!). I think a hand written parser would be more sufficient, because the expression[i] is[/i] special. I'll look into that "blowing your mind" thing, thank you.
Another issue is that it's one big string, so every time I insert a little text, I have to manipulate the whole string and sometimes re-parse it. I will change the string to a 2 dimensional array, maybe pointers to strings with some index array, so the whole thing becomes just playing with indices. I will make this change in the weekend.

Share this comment


Link to comment
Hmmm, yes, operating on the structure instead of a detour with reparsing sounds like a good idea. And certainly a handwritten parser can be faster, but it also gets tedious and error-prone fast.

Anyway: Good luck.

PS: I hope I did not sound sort of patronizing, I sometimes suspect I appear this way because English is not my first language. But you probably know the feeling when you see something running slow you know it shouldn't. It hurts ;) And I like to procrastinate with stuff I find on gamedev.

Share this comment


Link to comment
No problem, you didn't sound anything to me, I don't speak English too well either

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now