Matty-Downing2169 / opencamlib

Automatically exported from code.google.com/p/opencamlib
GNU General Public License v3.0
0 stars 0 forks source link

Path Input, Path Output #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Make functions to input a path of lines ( arcs too, if possible ).
Calculate the 3D path, joining tangent spans to within a tolerance.
Make functions to get the final path.

Original issue reported on code.google.com by danhe...@gmail.com on 19 Mar 2010 at 1:18

GoogleCodeExporter commented 9 years ago
I would like to do this, if this is OK. I will need to add new classes Line and 
Arc.

Original comment by danhe...@gmail.com on 19 Mar 2010 at 1:24

GoogleCodeExporter commented 9 years ago
do you mean something like this (Python):
path = Path()
path.append( Line(p1,p2) )
path.append( Arc(p2,p3,radius) )

dcf = PathDropCutterFinish()
dcf.setSurface(mySTLSurf)
dcf.setCutter(myCutter)
dcf.initSurf()  # builds kd-tree
dcf.setPath(path)
fcf.setTolerance(0.001)
dcf.run()
clpoints = dcf.getCLPoints()
# do whatever you want with your clpoints after this

Output:
Ultimately the output from the CAM-library should probably pretty closely copy 
the
structure of G-code.
That means there would be objects for G0, G1, G2/3, mist/flood, tool-changes, 
etc.
The toolpath would be a list of object corresponding to moves (G0, G1, G2/3)
There could be an "operation" object in addition which would also include
tool-changes, mist/flood etc.

Original comment by anders.e...@gmail.com on 19 Mar 2010 at 1:42

GoogleCodeExporter commented 9 years ago
Thanks for the example code. I am basing my classes on it;
Line, Arc, Path, PathDropCutterFinish.

Original comment by danhe...@gmail.com on 19 Mar 2010 at 11:54

GoogleCodeExporter commented 9 years ago
some more thoughts on this.

I think we want a (abstract?) base class called DropCutterFinish
this is the base class for all drop-cutter type finishing toolpaths. The class
contains a list of CL-points, a cutter, an STL-surface, and methods for 
building a
kd-tree and running drop-cutter on the CL-points.

This base-class should then have sub-classes:

- PointDropCutterFinish. Here the user must first generate the CL-point(s) and 
push
the manually to the object. Then run(), then extract CL-points

- GridDropCutterFinish. Here the user specifies a grid of CL-points in some 
suitable
format. Perhaps the starting point, one vector for the "forward" 
step-direction, and
one vector from an "across" step direction. The algorithm then generates the
CL-points and runs drop-cutter on them.

- SpiralDropCutterFinish. Similar to the above, but the user specifies a 
center-point
for a spiral finish operation and the step-over and final radius of the spiral.

- PathDropCutterFinish. What Dan was suggesting above. The user can push an 
arbitrary
sequence of Lines and Arcs to the object, and it interpolates with a given 
tolerance
and runs drop-cutter.

Original comment by anders.e...@gmail.com on 20 Mar 2010 at 4:56

GoogleCodeExporter commented 9 years ago
Maybe we could have only PathDropCutterFinish and then some new Path 
constructors to
make different shaped paths from points, grids, spirals?

Original comment by danhe...@gmail.com on 20 Mar 2010 at 6:05

GoogleCodeExporter commented 9 years ago
Path-constructors is probably an equally good way to do this.

Think about what needs to be in C++ and what is more readable/hackable if it is 
in
Python.

I would think that Path construtors for "zigzig" "zigzag" "spiral" etc. can 
just as
well be done in Python. In HeeksCNC, these snippets of code could be default
machining operations, but also kind of "operation prototypes" that an advanced 
user
can take and hack to suit their needs.

I have been thinking about a ProbeCutter class which could be used to probe the
extents of the STL surface. Now we more or less need to know in advance where to
create our zigzag path, but with the Probe you could say "my surface lies 
somewhere
within 100 units from (0,0), go find the extents". Then those extents could be 
used
by the Path generator.

Original comment by anders.e...@gmail.com on 20 Mar 2010 at 9:04

GoogleCodeExporter commented 9 years ago
I have done this now.
The input is a Path, but I changed the output to be a list of Points.
I now have a lot fewer lines in the NC code.

Original comment by danhe...@gmail.com on 22 Mar 2010 at 1:08

GoogleCodeExporter commented 9 years ago
maybe you could provide a few Python examples of how to use the new feature.

maybe we should have an examples-directory in SVN?

Original comment by anders.e...@gmail.com on 22 Mar 2010 at 1:20