fbpx

CS-Lab Support Forum for CNC Community

Help to run this brand-new forum and stay with us.
Ask your questions, we are here to help! 

 

Please or Register to create posts and topics.

Background script in python

Hi,

i need to have background script loaded with screen and running in background if it's possible and also how to use some general variables shared between scripts and SIMCNC?

I have tested Pyactions with timer pooling but if i initialize script every time that was loos of time.

Please is there any advice for problem?

Thanks in advance  

Hello,

>> i need to have background script loaded with screen and running in background if it's possible

I don't understand this, try to explain what you mean.

>> and also how to use some general variables shared between scripts and SIMCNC?

Use machine parameters. There are 4000 parameters for a user, where the first 1000 are permanently saved. Machine parameters are present practically everywhere in simCNC (it's something similar to  userDRO in Mach3 but better):

- GUI

Most GUI objects can use machine parameters to write entered or read presented values.

 

- Gcode

Notation: #100 = 40

Reading: G1 X[#100] F200

Assignment: #100 = #101

Subtraction: #99 = #100 - #101

And other arithmetic operations.

 

- Python

d.setMachineParam( int paramNumber, float value )

d.getMachineParam( int paramNumber )

 

- Parameter table

The value of individual machine parameters can be read and (some) saved from the parameter table.

>>       I have tested Pyactions with timer pooling but if i initialize script every time that was loos of time.

Use a While loop in the macro, this way the macro will never end and the response time will be very short.

Remember to use a small delay in the while loop because it will overload the core.

 

PARTNERS:

 

USA

Germany

Slovenia / Bosnia

Spain

South Africa

UNI-CAM

The Netherlands

Portugal

Greece

  Distrib milionis logo

Hungary

Distrib logot

Bulgaria

Master

Kenya

Proteq Automation

Egypt

Germanelectronix

China

Jun Ma

Serbia

ALCO

Italy

LVL tech r

Denmark

Varntoft Dania

Finland

×

Hello!

Click one of our contacts below to chat on WhatsApp

× How can I help you?