On Thursday 16 August 2007, [EMAIL PROTECTED] wrote:
>Hi,
>
>While I have been playing around with EMC since its invention, I have
>only recently started to use it seriously as I've only recently finished
>(as though it will ever be 'finished') a little cnc milling machine for
>making parts for the antique watches I restore and other miniature
>parts. I have been trying to work out a 'universal' script to allow me
>to mill tiny pinions but I've hit a problem in that it is giving me an
>error message I don't understand - I do wish that the developers of EMC
>would address the understandability of the various error messages to we
>simple users....
>
>The machine is set up to use axes XYZA in metric with the 'A' axis set
>parallel to the 'Y' axis in this case so that the end of the work is
>clearly visible. The finished pinion OD is 1.40mm and it has 5 leaves of
>cycloidal profile - radial flanks with semicircular tips. The intention
>of the script is to use a miniature slitting saw 0.09mm thick to cut
>first one flank of each leaf, then the other flank and then to round
>over each side of the tips by taking cuts at 10 degree increments. I
>would ideally have liked to work out a way to make the tips continuously
>rounded but I don't seem to be able to find a way to do this over the
>length of the pinion - i.e. I could do it by sending the X, Z and A axes
>to a finishing point simultaneously and produce a rounded surface at one
>point on the length of the pinion but this would then have to be
>repeated many times to get a continuous edge. Anyway, here is the
>script... the error message I am getting is "near line 2 .... unknown
>word where unary operation could be" - does this refer to line 2 of the
>script i.e. a problem amongst the variables, or is it a problem with
>line 0200 of the part of the script that runs and why does it say that a
>'unary operation 'could' be there'? Any help would be very much
>appreciated.... Ian
>
>#D = 1.4 ( o.d )
>#R = 0.38 (root dia)
>#C = [[[#D] - [#R]] / 2] (cut depth)
>#N = 5 (number of teeth)
>#L = 4 (lenght of cut)
>#A = [360/[#N#]] (angular increment)
>#V = 0.09 (cutter thickness)
>#Q = 1 (counter)
>#T = 1 (tooth counter)
>#S = 10 (step angle for rounding)
>#r = [[#D]/2] (radius of work)
>#I = 10 (increment for rounding steps)
>#F = 90 (final arc angle)
>
>o100 sub (cuts one slot in blank)
>G1 X[[#C]/2] F4
>Y[#L]
>Y-[#L]
>X[#C]
>Y[#L]
>Y-[#L]
>endsub
>
>o200 sub (rounds half top of pinion leaf in several steps)
>do
>Z[[sin[#S]/[#r]] X[[cos[#S]/[#r]]
>G1 Y[#L] F4
>G0 Y-[L]
>A[#I]
>#S = [[#S]+[#I]]
>while [#S] LT [#F]
>endsub
>
>o300 sub (rounds other half top of pinion leaf in several steps)
>do
>Z-[[sin[#S]/[#r]] X[[cos[#S]/[#r]]
>G1 Y[#L] F4
>G0 Y-[L]
>A-[#I]
>#S = [[#S]+[#I]]
>while [#S] LT [#F]
>endsub
>
>N0100 G92 X0 Y0 Z0 (set axes to zero)
>N0200 G21 G91 (metric units, incremental moves)
>
>N0300 do (first cut of pinion leaves)
>N0400 o100 call
>N0500 #Q = [#Q] + 1 (increment counter)
>N0600 A[360/[#N]] (rotate work one tooth distance)
>N0700 while #Q LT 5 (should this be 6?)
>
>N0800 #Q = 1 (set counter back to 1)
>N0900 A-[[#A]/3] (rotate by thickness of pinion leaf and)
>N1000 Z[#V] (move cutter - saw - to other side of leaf)
>N1100 do (cut other side of pinion leaves)
>N1200 o100 call
>N1300 #Q = [#Q] + 1
>N1400 A-[360/[#N]]
>N1500 while #Q LT 5
>
>N1600 #Q = 1 (set counter back to 1)
>N1700 A[[#A]/6] (move cutter to centre of leaf)
>N1800 Z-[[#V]/2] ( )
>N1900 do (round over half the leaf and repeat for all leaves)
>N2000 o200 call
>N2100 #Q = [#Q] + 1
>N2200 A[360/[#N]]
>N2300 while #Q LT 5
>
>N2400 #Q = 1 (set counter back to 1)
>N2500 Z0 A-90 (set cutter and pinion leaf back to centre)
>N2600 Z[[#V#/2]
>N2700 do (round over other half the leaf and repeat for all leaves)
>N2800 o300 call
>N2900 #Q = [#Q] + 1
>N3000 A-[360/[#N]]
>N3100 while #Q LT 5
>
>N3200 #Q = 1 (clean up)
>N3300 X-20 Z40 Y50 (retract tool)
>N3200 G40
I'm also a relative newbie at this, but all the examples, and all the code
I've written (that worked, such as a hole in a stack of rubber sheets
yesterday & which I need to do 2 more runs of today) have used numerical
values for the storage locations of variables where you have used
alphabetical characters.
Try this:
#1 = 1.4 ( o.d Was #D)
#2 = 0.38 (root dia was #R)
#3 = [[[#1] - [#2]] / 2] (cut depth was #C)
#4 = 5 (number of teeth was #N)
#5 = 4 (length of cut was #L)
#6 = [360/[#4]] (angular increment was #A, also removed extra #)
#7 = 0.09 (cutter thickness was #V)
#8 = 1 (counter was #Q)
#9 = 1 (tooth counter was #T)
#10 = 10 (step angle for rounding was #S)
#11 = [[#1]/2] (radius of work was #r)
#12 = 10 (increment for rounding steps was #I)
#13 = 90 (final arc angle was #F)
Then, down in the call statements, the syntax I've found that works involves
passing the vars to the subroutine like this example:
N0400 o100 call [#1][#2][#3][#4][#5][#6][#7][#8][#9][#10][#11][#12][#13]
The brackets are required to protect the variables from interpretation within
the call statement itself. You want to pass the variable, not its value, to
the subroutine.
This seems to be required because of the isolation between the subroutines
idea of variables and the main loops idea. Also, anything a subroutine does
to a variable is thrown away at the endsub, and that the call, sub, and
endsub statements all need to have matching o word numbers. Ditto for the
start and end of 'conditional' statements.
I've found the above seems to work for me. The gentlemen who wrote this
program will correct me if I'm wrong, I'm sure.
There may be other gotcha's in your code I didn't spot, like the extra # sign
in the original #A description, but this should get you past line 2 since the
actual error AIUI was in line 1. emc's idea of line numbers is occasionally
off by + one in the error reports. I always check the preceding line when it
fusses.
And welcome to the mailing list, one of the most valuable lists extant IMO.
For even quicker answers if one of the coders is in attendance, you might fire
up an IRC client, goto freenode, and "/join #emc". I have reported bugs
there, and had fixed code compiled and running on my machine in well under an
hour. This is a prime example of a project where the coders themselves are
generally also users.
Also the latest version of emc is 2.1.7, and comes highly recommended by this
user.
Any mistakes above should return -ENOTENOUGHCAFFIENE :)
--
Cheers, Gene
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
You probably wouldn't worry about what people think of you if you could
know how seldom they do.
-- Olin Miller.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users