Re: [Emc-users] Passing file names into a subroutine

2012-02-02 Thread dave
On Thu, 2 Feb 2012 17:33:10 +0200
andy pugh  wrote:

> On 2 February 2012 17:09, Alan Condit  wrote:
> 
> > Gee, I bet that news would surprise Kernigan and Ritchie. I've been
> > using strings in 'C' since 1977.

So much of K&R C was almost a 1:1 correspondence with PDP-11 machine
instructions. :-)
> 
> No, you have been using arrays of chars, and an external library to do
> even simple things like compare two strings to see if they match.
> 
> I am not saying that C can't process textual data, but it certainly
> has no built in types for strings.

Whereas, Pascal does. OT ... I'm it is rumored that really fast code is
produced by writing in Pascal then using p2c to translate to C before
compiling. 

Dave
> 


--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Passing file names into a subroutine

2012-02-02 Thread andy pugh
On 2 February 2012 17:09, Alan Condit  wrote:

> Gee, I bet that news would surprise Kernigan and Ritchie. I've been using 
> strings in 'C' since 1977.

No, you have been using arrays of chars, and an external library to do
even simple things like compare two strings to see if they match.

I am not saying that C can't process textual data, but it certainly
has no built in types for strings.

-- 
atp
The idea that there is no such thing as objective truth is, quite simply, wrong.

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Passing file names into a subroutine

2012-02-02 Thread Alan Condit
> On 2 February 2012 03:51, Kenneth Lerman  wrote:
> 
>> BTW: That's another place where it would be nice to have variables with
>> string values.
> 
andy pugh  wrote:
> Considering that C doesn't really do strings, adding them to G-code
> might be nontrivial.
> 
> -- 
> atp

Gee, I bet that news would surprise Kernigan and Ritchie. I've been using 
strings in 'C' since 1977.

Alan
---

Alan Condit
1085 Tierra Ct.
Woodburn, OR 97071

Email -- acon...@ipns.com
Home-Office (503) 982-0906


--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Passing file names into a subroutine

2012-02-01 Thread gene heskett
On Thursday, February 02, 2012 02:13:53 AM andy pugh did opine:

> On 2 February 2012 03:51, Kenneth Lerman  
wrote:
> > BTW: That's another place where it would be nice to have variables
> > with string values.
> 
> Considering that C doesn't really do strings, adding them to G-code
> might be nontrivial.

Where did you find that, Andy?  In the past 25 years I have used lots of 
strings in C code, they work as expected, including manipulating them as an 
array, which is another way to march thru a string in C.

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)
My web page: 
Sacred cows make great hamburgers.

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Passing file names into a subroutine

2012-02-01 Thread andy pugh
On 2 February 2012 03:51, Kenneth Lerman  wrote:

> BTW: That's another place where it would be nice to have variables with
> string values.

Considering that C doesn't really do strings, adding them to G-code
might be nontrivial.

-- 
atp
The idea that there is no such thing as objective truth is, quite simply, wrong.

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Passing file names into a subroutine

2012-02-01 Thread BRIAN GLACKIN
> You can pass a numeric argument. Then:
> O#4 call ...
>

Here is where I made a grammar error - I typed
o<#4> call   [var1][var2]  instead

Got rid of the <> and it passed this point of the code.  The second error
is I failed to put o1 sub and o1 endsub around my code.


BTW: That's another place where it would be nice to have variables with
> string values.
>
>
Guess thats a reason to upgrade to 2.5

 Still running 2.4.6 here.

I still have a few bugs in the while loop that increments the Z axis for
each successive pass.  I sent Linuxcnc into a infinte loop trying to load a
malformed routine.   Time to brush up on my logic statements.

Thanks all for your help.

Brian
--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Passing file names into a subroutine

2012-02-01 Thread Kenneth Lerman
On 02/01/2012 10:01 AM, BRIAN GLACKIN wrote:
> Hi all.
>
> I tried to ask this question on IRC last eve and had trouble staying in
> channel.
>
> equipment - 25" X 49" X 4" gantry router  for wookwork - all cutting is 2.5D
>
> I have a subroutine o100 that at present, I pass three values too
> Value 1 is the total depth of cut
> Value 2 is the incremental depth of cut
> Value 3 is the feed rate
>
> My past practice has been to cut and paste the gcode of a part into this
> subroutine.  This has been fine for multiples of a single part.  I recently
> started calling a gcode file directly from inside the subroutine which
> worked fine.
>
> What I would like avoid constantly cutting and pasting code (or
> filenames) into my "parts program" subroutine. I thought I could send via
> the subroutine a fourth value with the file name.  The thought being that I
> can have a series of calls for different parts that I can cut out from the
> same sheet without having to mash up a massive gcode file.
>
> So I modified the O100 to add that fourth value.
>
> In the subroutine, I tried calling the file with O<#4>  call.
>
> ON loading the code into Linuxcnc, I get the error "Near Line XXX urnary
> operation expected ."  Or something to that effect.  I typed the exact
> error in IRC channel last eve if anyone saw that.
>
>
> Can I pass a filename through a subroutine call??
>
> I did try renaming the file to a numer (1.ngc)  and tried passing both
> 1 and 1.ngc.

I believe the answer is yes (I've done it in the past).

You can pass a numeric argument. Then:
O#4 call ...
Will call O100 if argument 4 is 100. When this is called, I believe the 
interpreter will look for O100 in the usual way. That includes looking 
for o100 in a file named o100.ngc (I think). I believe that the o in 
o100 must be lower case because the interpret converts everything to 
lowercase as the first step in the parsing. At any rate, the O#4 should 
be treated EXACTLY as if the code was written as O100 call if #4 has the 
value 100.

BTW: That's another place where it would be nice to have variables with 
string values.

Ken
>
> Brian
> --
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Passing file names into a subroutine

2012-02-01 Thread BRIAN GLACKIN
THanks Michael and Dwey,

I think I failed to properly code the individual part files and that is the
probable error.  I will pluck away at it this evening and try again.

Kurt,

While that is one option, I am usually cutting out of a sheet of wood.  I
have a higher level routine that I pass the upper left coordinates of the
part then use that with a G92/G92.1   This allows me to try a couple of
placements simply by changing the coordinate positions in the call.

Thanks all for your help.

Brian

On Wed, Feb 1, 2012 at 11:35 AM, Kirk Wallace
wrote:

> On Wed, 2012-02-01 at 10:01 -0500, BRIAN GLACKIN wrote:
> ... snip
> > What I would like avoid constantly cutting and pasting code (or
> > filenames) into my "parts program" subroutine. I thought I could send via
> > the subroutine a fourth value with the file name.  The thought being
> that I
> > can have a series of calls for different parts that I can cut out from
> the
> > same sheet without having to mash up a massive gcode file.
> ... snip
>
> Why not write a g-code file for each part, then write a shell script
> batch file to execute the files in order?
> --
> Kirk Wallace
> http://www.wallacecompany.com/machine_shop/
> http://www.wallacecompany.com/E45/index.html
> California, USA
>
>
>
> --
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users
>
--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Passing file names into a subroutine

2012-02-01 Thread Kirk Wallace
On Wed, 2012-02-01 at 10:01 -0500, BRIAN GLACKIN wrote:
... snip
> What I would like avoid constantly cutting and pasting code (or
> filenames) into my "parts program" subroutine. I thought I could send via
> the subroutine a fourth value with the file name.  The thought being that I
> can have a series of calls for different parts that I can cut out from the
> same sheet without having to mash up a massive gcode file.
... snip

Why not write a g-code file for each part, then write a shell script
batch file to execute the files in order?
-- 
Kirk Wallace
http://www.wallacecompany.com/machine_shop/
http://www.wallacecompany.com/E45/index.html
California, USA


--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Passing file names into a subroutine

2012-02-01 Thread Dewey Garrett
And another way that works with ngcgui
(files tst2.ngc,1.ngc,2.ngc must be in [RS274NGC]SUBROUTINE_PATH)

$ cat tst2.ngc

o  sub

#   =  #1 (=1 partno)
#=  #2 (=123)

o# call [#]

oendsub

$ cat 1.ngc
o1 sub
 # = #1
 (debug, this is part1 value=#)
o1 endsub

$ cat 2.ngc

o2 sub
 # = #1
 (debug, this is part2 value=#)
o2 endsub

-- 
Dewey Garrett


--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Passing file names into a subroutine

2012-02-01 Thread Dewey Garrett

This works with ngcgui (requires linuxcnc2.5):
(The files tst.ngc, part1.ngc,part2.ngc must be in
a directory specified by [RS274NGC]SUBROUTINE_PATH)

$ cat tst.ngc

o  sub
#   =  #1 (=1 partno)
#=  #2 (=123)

o if [# eq 1]
o call [#]
o endif
o if [# eq 2]
o call [#]
o endif

oendsub


$ cat part1.ngc
o sub
 # = #1
 (debug, this is part1 value=#)
o endsub

$ cat part2.ngc
o sub
 # = #1
 (debug, this is part2 value=#)
o endsub

-- 
Dewey Garrett


--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Passing file names into a subroutine

2012-02-01 Thread Michael Haberler
this works:

 1234.ngc ---
O1234 sub
(debug,in 1234.ngc, p1=#1 p2=#2 p3=#3)
O1234 endsub
m2
-

in MDI/code do this:

#1 = 1234  ; 'filename' - must be a number though
O#1 call [47] [11] [15]

- Michael

Am 01.02.2012 um 16:01 schrieb BRIAN GLACKIN:

> Hi all.
> 
> I tried to ask this question on IRC last eve and had trouble staying in
> channel.
> 
> equipment - 25" X 49" X 4" gantry router  for wookwork - all cutting is 2.5D
> 
> I have a subroutine o100 that at present, I pass three values too
> Value 1 is the total depth of cut
> Value 2 is the incremental depth of cut
> Value 3 is the feed rate
> 
> My past practice has been to cut and paste the gcode of a part into this
> subroutine.  This has been fine for multiples of a single part.  I recently
> started calling a gcode file directly from inside the subroutine which
> worked fine.
> 
> What I would like avoid constantly cutting and pasting code (or
> filenames) into my "parts program" subroutine. I thought I could send via
> the subroutine a fourth value with the file name.  The thought being that I
> can have a series of calls for different parts that I can cut out from the
> same sheet without having to mash up a massive gcode file.
> 
> So I modified the O100 to add that fourth value.
> 
> In the subroutine, I tried calling the file with O<#4> call.
> 
> ON loading the code into Linuxcnc, I get the error "Near Line XXX urnary
> operation expected ."  Or something to that effect.  I typed the exact
> error in IRC channel last eve if anyone saw that.
> 
> 
> Can I pass a filename through a subroutine call??
> 
> I did try renaming the file to a numer (1.ngc)  and tried passing both
> 1 and 1.ngc.
> 
> 
> Brian
> --
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users


--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


[Emc-users] Passing file names into a subroutine

2012-02-01 Thread BRIAN GLACKIN
Hi all.

I tried to ask this question on IRC last eve and had trouble staying in
channel.

equipment - 25" X 49" X 4" gantry router  for wookwork - all cutting is 2.5D

I have a subroutine o100 that at present, I pass three values too
Value 1 is the total depth of cut
Value 2 is the incremental depth of cut
Value 3 is the feed rate

My past practice has been to cut and paste the gcode of a part into this
subroutine.  This has been fine for multiples of a single part.  I recently
started calling a gcode file directly from inside the subroutine which
worked fine.

What I would like avoid constantly cutting and pasting code (or
filenames) into my "parts program" subroutine. I thought I could send via
the subroutine a fourth value with the file name.  The thought being that I
can have a series of calls for different parts that I can cut out from the
same sheet without having to mash up a massive gcode file.

So I modified the O100 to add that fourth value.

In the subroutine, I tried calling the file with O<#4> call.

ON loading the code into Linuxcnc, I get the error "Near Line XXX urnary
operation expected ."  Or something to that effect.  I typed the exact
error in IRC channel last eve if anyone saw that.


Can I pass a filename through a subroutine call??

I did try renaming the file to a numer (1.ngc)  and tried passing both
1 and 1.ngc.


Brian
--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users