Output while moving

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Output while moving

Postby Mindustrys » Wed Jul 19, 2023 4:50 pm

Hi everyone, I have a project to carry out and I wanted the advice of you experts.

I have to activate an output while I'm executing a movement, that is, I need that while I'm executing a movement (example G1A360) a laser turns on every X degrees, without however going to stop the engine and restart it.
I'll try to explain myself even better:
I have to make small markings on discs with a diameter of about 300mm but the processing must be very fast and I have to find a way to turn on the laser while the axis is rotating

the processes will not always be the same, the diameters, the length of the markings and the number of markings will change.
I wrote a macro to do it but the result is still too slow.
do you have any suggestions for me?

Code:


string raggio = AS3.Getfield(10001);
double Raggio = Convert.ToDouble(raggio);

string angle = AS3.Getfield(10002);
double Angle = Convert.ToDouble(angle);

string feed = AS3.Getfield(10004);
double Feed = Convert.ToDouble(feed);

string delay = AS3.Getfield(10003);
int Delay = Convert.ToInt32(delay);

double Rotary = 0;

int Chuckopenport = 1;
int Chuckopenpin = 17;

exec.Code("G00Y"+ Raggio +"Z0");

exec.AddStatusmessage("Start");

int FeedStart = 1;

if (FeedStart == 1)
{
exec.Code("F" + Feed);
FeedStart = 0;
}

while (Rotary < 359)
{
exec.Code("A" + Rotary);
exec.Setoutpin(Chuckopenport, Chuckopenpin);
exec.Wait(Delay);
exec.Clroutpin(Chuckopenport, Chuckopenpin);
Rotary = Rotary + Angle;

}
exec.AddStatusmessage("finish");
exec.Code("G00A0");
Rotary = 0 ;
Mindustrys
 
Posts: 19
Joined: Sat Aug 21, 2021 3:47 pm

Return to Macros

Who is online

Users browsing this forum: No registered users and 4 guests