Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Reducing code within 3D surface finish flowline?


brussell
 Share

Recommended Posts

On many occasions I have chosen to 3d mill countersink features with a ball end mill. This works great if there aren't a ton of features in a single program; this quickly adds up to thousands of lines of code going point to point.

Using surface finish flowline  we are diving in the hole cutting bottom to top with a spiral cutting method. (.01 stepover)

In this toolpath the Arc filter/ smoothing tolerance only adds more code no matter how I set the parameters. If I were to do this within a cylindrical toolpath (helix bore) rather than countersink conical shape, the code comes out exactly as needed with G2 or G3 moves.  

Haas standard 1,000,000 bytes of memory is nothing compared to some lengths of programs. I haven't got around to try drip feeding on this which is likely my solution.

Point being, is there any way to reduce this amount of code? Is it not possible due to the constant conical shaped toolpath?

Thanks

cs.PNG

Link to comment
Share on other sites

Why use 3d at all? Perfect application for 2d Swept. The 2d toolpaths in my experience give the cleanest motion with least input and code.

It also looks like you're doing a spiral toolpath which is probably gonna require alot more code as opposed to  one way.

  • Like 4
Link to comment
Share on other sites
56 minutes ago, rgrin said:

Why use 3d at all? Perfect application for 2d Swept. The 2d toolpaths in my experience give the cleanest motion with least input and code.

It also looks like you're doing a spiral toolpath which is probably gonna require alot more code as opposed to  one way.

Sometimes keeping it simple is best!

  • Like 1
Link to comment
Share on other sites
1 hour ago, neurosis said:

It looks like they might be using spiral as the cutting method?

If so, it doesn't filter very well.

I was wondering when someone would mention that? If all the features are the same then to reduce file size in this case the only way is to make that a sub program and call it on all the other features using transform, or make a custom drill cycle that calls a sub program.

  • Like 1
Link to comment
Share on other sites
16 minutes ago, brussell said:

@neurosisI changed the method from spiral to one way. This reduced the code down to around 400 lines. 

This is exactly what i needed. So simple

Thank you for replying back a solution to your issue. I still think that could be reduced much smaller with a macro program. You would write a macro with a the major starting diameter. The angle of the change you are cutting. The make the while do loop work until the depth past with the tool is needed.Maybe 10 lines of code to cut it all.

Next fastest and most reduction of line of code would be but a custom angle chamfer mill to cut with an arc move in one or two passes and call it a day. I use to surface machine complete mold section with 10 to 20 lines of code with a macro. I wrote my own threadmillng Macro 30+ years ago that could cut any size thread with any pitch using a single point threadmill less that 10 lines of code.

Link to comment
Share on other sites
2 hours ago, crazy^millman said:

Thank you for replying back a solution to your issue. I still think that could be reduced much smaller with a macro program. You would write a macro with a the major starting diameter. The angle of the change you are cutting. The make the while do loop work until the depth past with the tool is needed.Maybe 10 lines of code to cut it all.

Next fastest and most reduction of line of code would be but a custom angle chamfer mill to cut with an arc move in one or two passes and call it a day. I use to surface machine complete mold section with 10 to 20 lines of code with a macro. I wrote my own threadmillng Macro 30+ years ago that could cut any size thread with any pitch using a single point threadmill less that 10 lines of code.

That's actually so awesome.

I'm looking to learn something here, I don't have a lot of experience with macro variable programming so please excuse me if the syntax is terrible. I'm guessing one of these macro surfacing programs would look something like this?

G0 X0 Y0
G1 Z0 F20.
Y1.
#222 = 0
#223 = 0
N105
#222 = #222 - .02
#223 = #223 - .02
X-1.
[Y.99 - #224] [Z-.01 - #222]
X0
[Y.98 - #224] [Z-.02 - #222]
IF [#222 LT 1.0] GOTO N105
Y0
G0 Z1.

If the above is somewhat correct, is this something you have setup in your post to automatically post out? Because just this simple example would reduce about 200 lines of code down to 10. I am already daydreaming about how many lines of code I could save with this setup properly.

Link to comment
Share on other sites

You would want to make the first Y and X variables. The process will stay in a constant loop of (.-97 and Z -.03 for the first line in Brackets and as such with the 2nd line in brackets. I would change macro into this.  I like everything defined and labeled in my Macros. Let the Variables do all the math. Notice not a single number for a X-Y-Z position they are all variables.
 

#217 = 0.0 (X Start Value)
#218 = 0.0 (Y Start Value)
#219 = 0.0 (Z Start Value)
#220 = 1.0 (Y Start Shift From Value)
#221 = 1.0 (X End Value)
#226 = 0.0 (Shift end value)
#227 = 1.0 (Z End Position)
G0 X#218 Y#210
G1 Z#219 F20.
Y#220
#222 = .02 (Shift Amount)
#223 = .02 (Shift Amount)
N105
#224 = [#220 - #222]
#225 = [#221 - #223]
X#221
Y#224 Z#225
X#217
#224 = [#220 - #222]
#225 = [#221 - #223]
Y#224 Z#225
IF [#224 GT #226] GOTO N105
Y#218
G0 Z#227 

Peter Smid has great books on Macro Programming along with some others. Been 25+ years since i wrote Macros so take that example as I have no clue how it will run on a machine.

  • Thanks 1
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...