Author Topic: How to create a MOP inserting G-Code by script (Python) ?  (Read 1691 times)

Offline gmoo

  • Storm Trooper
  • ***
  • Posts: 152
  • Jam it !
    • View Profile
How to create a MOP inserting G-Code by script (Python) ?
« on: March 16, 2019, 11:03:30 am »
Dear CAMBAM-Jedis,

(maybe I´m not asking the correct question or I´m not using the correct terms.)

I try to make a MOP doing nothing except inserting a script-generated G-Code,
f.e. moving to a specific position or start tool length mesurent, moving home, bring a beer ...

Manually I tried this :
- Fill MOP´s G-Code header and clear the Primitives ID-List => Error
- using a NC MOP, but this wants to read an existing file

Any ideas out there in CAMBAM world ?

Best regards

Berhard
best regards

Bernhard

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1322
    • View Profile
Re: How to create a MOP inserting G-Code by script (Python) ?
« Reply #1 on: March 16, 2019, 11:51:09 am »
Hi Bernhard
You could use Eddy's Relocate Plugin.
Dave

Offline dwc

  • CNC Jedi
  • *****
  • Posts: 545
    • View Profile
    • corson.ch
Re: How to create a MOP inserting G-Code by script (Python) ?
« Reply #2 on: March 16, 2019, 14:11:18 pm »
It sounds to me like the simplest way would be to make text files of the output of each of your scripts and to then include them using the NC MOP.
Don

Offline Garyhlucas

  • CNC Jedi
  • *****
  • Posts: 1366
    • View Profile
Re: How to create a MOP inserting G-Code by script (Python) ?
« Reply #3 on: March 16, 2019, 14:14:07 pm »
Don,
You beat me to it! Those files could then be reused just by calling them and you could edit them without editing the script that generated them.
Gary H. Lucas

Have you read my blog?
 http://a-little-business.blogspot.com/

Offline gmoo

  • Storm Trooper
  • ***
  • Posts: 152
  • Jam it !
    • View Profile
Re: How to create a MOP inserting G-Code by script (Python) ?
« Reply #4 on: March 16, 2019, 19:31:33 pm »
Creating textfiles and loading into an NC MOP will shurely work ... but this is really not elegant !

best regards

Bernhard

Offline gmoo

  • Storm Trooper
  • ***
  • Posts: 152
  • Jam it !
    • View Profile
Re: How to create a MOP inserting G-Code by script (Python) ?
« Reply #5 on: March 18, 2019, 07:21:22 am »
Thank you all !

Not the best way, but this does what I want :

Just sending the text to following MOP´s CustomMOPHeader.
best regards

Bernhard

Offline gmoo

  • Storm Trooper
  • ***
  • Posts: 152
  • Jam it !
    • View Profile
Re: How to create a MOP inserting G-Code by script (Python) ?
« Reply #6 on: February 25, 2020, 13:46:54 pm »
I found a better solution :

I use an Import G-Code MOP, loading an empty (but existing!) file.
This MOP also has a Header property, which can be filled by script.

best regards

Bernhard