CamBam
News:
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 14, 2019, 22:14:26 pm


Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Insert spindle speed as Qx  (Read 989 times)
Mark81
Wookie
****
Offline Offline

Posts: 305


View Profile
« on: February 23, 2019, 12:57:18 pm »

My new machine controller has a dedicated laser macro: M10 Qx, where x is the PWM settings 0..255.
I usually set the spindle speed to decide the power of my laser for each MOP, but now I need to place this value after Q, instead of S like $s would do.

I didn't find anything in the post-processor documentation. Is it possible to do it?
Logged
lloydsp
CNC Jedi
*****
Offline Offline

Posts: 8085



View Profile
« Reply #1 on: February 23, 2019, 14:58:37 pm »

Yup, but I'll be tied up with a legal matter for three or four hours.  If someone else doesn't get back to you on it, I'll describe how later.

Lloyd
Logged

"Pyro for Fun and Profit for More Than Fifty Years"
lloydsp
CNC Jedi
*****
Offline Offline

Posts: 8085



View Profile
« Reply #2 on: February 24, 2019, 01:51:00 am »

Just try this:

Instead of <$spindle><$s>, try,
Q<$s)

Lloyd
Logged

"Pyro for Fun and Profit for More Than Fifty Years"
Mark81
Wookie
****
Offline Offline

Posts: 305


View Profile
« Reply #3 on: February 24, 2019, 08:20:40 am »

Q<$s)

Unfortunately, It says "Unexpected token '<' at line 5" and it exports it literally in the g-code.
Logged
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 4079



View Profile
« Reply #4 on: February 24, 2019, 09:17:52 am »

I think Lloyd made a typo and meant this;

{$spindle} Q{$s}


Unfortunately the $s macro also adds an 'S' character in front of the speed number which produces;

e.g. QS1000

It looks like a post build processor is required to change the S into Q
« Last Edit: February 24, 2019, 09:30:46 am by EddyCurrent » Logged

Made in England
Mark81
Wookie
****
Offline Offline

Posts: 305


View Profile
« Reply #5 on: February 24, 2019, 09:32:39 am »

Hi Eddy,
yer, perhaps my question wasn't so clear. I meant exactly how to rid the 'S' char that {$s} prints out.

"It looks like a post build processor is required to change the S into Q". Is something built-in in CamBam or I have to write my own? It's just to understand, because it's something very easy to do in any programming language.

Right now I ended up with just:

Code:
M10 {$s}

and than I replace "M10 S" with "M10 Q".
Logged
Mark81
Wookie
****
Offline Offline

Posts: 305


View Profile
« Reply #6 on: February 24, 2019, 10:04:07 am »

Done.
I've just wrote a simple application "PostBuildReplace":

https://drive.google.com/open?id=18-zrTLDg-J6_aVBenjyifkNjAngwNqIn

It needs three arguments: "filename" "before" "after".
Here what it does:
  • opens the "filename" file
  • reads the contents and replace "before" with "after"
  • writes again the same file with the new contents

You have to configure CamBam PP as follow:

Post-Build Command: path/to/PostBuildReplace.exe
Post-Build Command Args: "{$outfile}" "M10 S" "M10 Q"

That's it.
Extremely simple, without much error handling (it just checks if you passed 3 args and if it cannot open the file exits), but it does what I need. Right now it reads all the content in RAM. For very big files it will be better to read line-by-line, replace and write in another file. I will do it next time :-)
« Last Edit: February 24, 2019, 10:05:48 am by Mark81 » Logged
Mark81
Wookie
****
Offline Offline

Posts: 305


View Profile
« Reply #7 on: February 24, 2019, 10:31:01 am »

Right now it reads all the content in RAM. For very big files it will be better to read line-by-line, replace and write in another file. I will do it next time :-)

Ok this version does what I suggested above:

https://drive.google.com/open?id=1xTIyz7675QnDEGTWkdNaPO2GnbfBkU3N
Logged
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 4079



View Profile
« Reply #8 on: February 24, 2019, 10:43:34 am »

Excellent job !
Logged

Made in England
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.101 seconds with 19 queries.

Copyright © 2018 HexRay Ltd. | Sitemap