Hello Guest it is April 24, 2024, 10:01:23 PM

Author Topic: Parametric Programming  (Read 12952 times)

0 Members and 1 Guest are viewing this topic.

Offline Tarak

*
  •  229 229
    • View Profile
Parametric Programming
« on: December 19, 2006, 01:55:54 PM »
Any chance of being able to use IF, THEN, GOTO, DOWHILE etc etc?
Does anyone else have any uses for these or is it just me??
Re: Parametric Programming
« Reply #1 on: December 19, 2006, 11:28:05 PM »
That is a major job and will not happen... There is VB and I can help you with that ;)
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com

Offline Tarak

*
  •  229 229
    • View Profile
Re: Parametric Programming
« Reply #2 on: December 21, 2006, 12:00:08 AM »
Hi Brian,
Thanks for the reply, I'm really keen to be able to use parametric programming. Where should I start to be able to use it?
The main one I would use is as follows.

#100=4 (No. of Repetitions)
N10
 IF[#100 EQ 0] GOTO10
PROGRAM
#100=[#100-1]
GOTO10
N20

And also DOWHILE as per below.

#100=4 (NO OF REPEPTITIONS)
WHILE [#100 GT 0] DO1
G01 X100. F1000
#100=[#100-1]
END1

Thanks.
Darc

Offline Graham Waterworth

*
  • *
  •  2,673 2,673
  • Yorkshire Dales, England
    • View Profile
Re: Parametric Programming
« Reply #3 on: December 21, 2006, 04:28:40 AM »
You can do that this way :-

O1000
(MAIN PROGRAM)
G00 X0 Y0 Z0
M98 P1001 L4 (JUMP TO SUB PROG 4 TIMES)
M30

O1001
(SUB PROGRAM)
G01 X100. F1000.
.... Etc
M99

Graham.


Without engineers the world stops

Offline Tarak

*
  •  229 229
    • View Profile
Re: Parametric Programming
« Reply #4 on: December 22, 2006, 04:40:21 PM »
I was hoping to use the IF or the DOWHILE function, so I can have calculations inside the program, so it's smart enough to work out various things and jump backwards and forwards when neccesary with the GOTO command.
Re: Parametric Programming
« Reply #5 on: December 22, 2006, 08:59:24 PM »
Use the Force! (VB)

It is not as bad as you think... For example

Code"X" & Xpos & " Y" & Ypos

This will output a line of Gcode with whatever you have Xpos and Ypos set to


Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com

Offline Tarak

*
  •  229 229
    • View Profile
Re: Parametric Programming
« Reply #6 on: January 15, 2007, 07:08:28 AM »
Sorry for the slow response, I've been away on holidays.
BTW, it would be used for a cut off machine.

I was thinking of having a program much like below, is it possible to have it attached to a button?
e.g when I push the button with 20mm on it, it will run the below program?
e.g when I push the button with 16mm on it, it will run the below program but with 16.0 in the variable #1?

;Y0.0 is always the centerline of the bar of steel
#1=20.0   ;Variable Bar Ø
#2=[#1/2]
G90 G55 G21
G00 Y[#2+1.0] ;Rapid into 1.0 away from job
G01 Y[#2-[#2*2]-1.0] F300 ;Cuts in to -11.0 (½Ø + 1.0 further)
G00 Y300.0 ;Pulls away from the job
M30

If the answer is no, please feel free to explain how I would go about using VB scripts instead.
Thanks.
Darc
Re: Parametric Programming
« Reply #7 on: January 15, 2007, 11:42:28 AM »
Darc,
You can do this, its simple.
I can think of two ways.

1. If you are always using the same diameters (for example 10 different diameters), do a screen (or wizard) with 10 buttons, each with the VB code for each diameter, so you will have a button for 20mm, a button for 16mm, and so on and so forth. You will have to use the sintax required to run a gcode in VB.

2. If you have a large number of diameters and it is prohibitive to have a button for each, make a screen (or wizard) , with a DRO in which you can input the diameter of the bar you want to cut. then Just have a button that reads that DRO and inserts it in the #1 variable you proposed.

Hope that gets you started.
Regards
Fernando

Offline Tarak

*
  •  229 229
    • View Profile
Re: Parametric Programming
« Reply #8 on: January 16, 2007, 06:56:10 PM »
Thanks fer mayrl, I just made up a quick screen, I placed multiple buttons on it, with different sizes on each of them.
Could you please give me an example of the syntax I would need to run an G code program from VB?
Thanks
Re: Parametric Programming
« Reply #9 on: January 16, 2007, 07:08:34 PM »
From the top of my head I beleive its like the following:
for a 20mm bar following the program you posted

CODE "G90 G55 G21"
CODE "G00 Y11" ;Rapid into 1.0 away from job
CODE "G01 Y-11 F300" ;Cuts in to -11.0 (½Ø + 1.0 further)
CODE "G00 Y300.0" ;Pulls away from the job
CODE "M30"

basically the syntax is the following:

CODE "whatever Gcode you want"

You can add variables to this syntax like this

#1=GetOEMDRO( DRO number) ;whatever DRO you put in the screen, lets say you put a 10 in that DRO
FEED=GetOEMDRO( DRO number); whatever DRO you pout on screen for inputing the feed rate, let say you put a 300 in that DRO
CODE "G01 y" & #1 "F" & FEED

this woudl simulate the following line
G01 y10 F300

Hope that gets you started
Fernando