Re: [Emc-developers] Dynamically building a string for a varname?

2024-03-02 Thread gene heskett

On 3/2/24 10:28, Andy Pugh wrote:




On 2 Mar 2024, at 12:35, gene heskett  wrote:

I renamed tholefinder.ngc to tholefinder,


Leave the filename the same.
Rename the subroutine inside that file.
Call it by the subroutine name.

I did that, it worked but now complains about a syntax error in that 
file. But without reporting a line number or anything that might lead to 
locating it. And I have another problem, tholefinder was written in inch 
days, last used for inch measurements. To make it smarter I need to have 
it check the machines units with units.comp, which I finally found a 
copy of but halcompile flat refuses to do anything with it.  Every combo 
the manpage shows exits with:



gene@GO704:~/linuxcnc/configs/go704-xyza$ halcompile --install units.comp

Traceback (most recent call last):
  File "/usr/bin/halcompile", line 1558, in 
main()
  File "/usr/bin/halcompile", line 1528, in main
process(f, mode, outfile)
  File "/usr/bin/halcompile", line 1366, in process
a, b = parse(filename)
  File "/usr/bin/halcompile", line 441, in parse
a, b = f.split("\n;;\n", 1)
ValueError: not enough values to unpack (expected 2, got 1)

units.comp file attached

Is the man page for halcompile duff?  This is master, apt updated early 
this morning.  On buster of course.



___
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers
.

Thank you.

Cheers, Gene Heskett, CET.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
#!/usr/bin/python

#  Author: Kurt Jacobson
#Date: 04/15/17
#   Email: kurtjacob...@bellsouth.net
# License: GPL 

import hal, time
import linuxcnc

stat = linuxcnc.stat()

h = hal.component("units")
h.newpin("prog_in", hal.HAL_BIT, hal.HAL_OUT)
h.newpin("prog_mm", hal.HAL_BIT, hal.HAL_OUT)
h.newpin("update_rate", hal.HAL_FLOAT, hal.HAL_IN)

h.ready()

# Set default update rate to 50ms
h.update_rate = .05

try:
while 1:
time.sleep(h.update_rate)
stat.poll()
prog_units = stat.program_units
if prog_units == 1: # Inch
h.prog_in = 1
h.prog_mm = 0
elif prog_units == 2: # Metric
h.prog_in = 0
h.prog_mm = 1
except KeyboardInterrupt:
raise SystemExit
___
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers


Re: [Emc-developers] Dynamically building a string for a varname?

2024-03-02 Thread Andy Pugh



> On 2 Mar 2024, at 12:35, gene heskett  wrote:
> 
> I renamed tholefinder.ngc to tholefinder,

Leave the filename the same. 
Rename the subroutine inside that file. 
Call it by the subroutine name. 



___
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers


Re: [Emc-developers] Dynamically building a string for a varname?

2024-03-02 Thread gene heskett

On 3/2/24 04:59, andy pugh wrote:

On Fri, 1 Mar 2024 at 23:38, gene heskett  wrote:


Well, I seem to be up to the first named subroutine call. But it cannot
find it.


Drop the ".ngc" from the subroutine name in the .ngc fle.

You have

o sub


Didn't help, Andy.
I renamed tholefinder.ngc to tholefinder, fixed it internally, It is not 
(most of the time) looking in the right place as specified in [RS@&$NGC] 
SUBROUTINE_PATH in the .ini file. See attached screenshot.
Most of the time its looking in /tmp, /home/tmp (which doesn't exist, or 
/home/gene/tmp which is apparently where its caching stuff. but NEVER 
looks in /home/gene/linuxcnc/nc_files/subs/ which is where [RS274NGC} 
SUBROUTINE_PATH = ~/linuxcnc/nc_files/subs point it at.


Am I being dense? Or are you saying the files name still has the .ngc, 
and the search adds that to the simplified name used in the parent file? 
I'll try that but after some shoe-goo cures a while. After a decade the 
glue holding the gear shift tally switches has given way so I had to 
reglue that assembly before the spindle runs right. Takes about an hour.


Thank you, take care & stay well.

Cheers, Gene Heskett, CET.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
___
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers


Re: [Emc-developers] Dynamically building a string for a varname?

2024-03-02 Thread andy pugh
On Fri, 1 Mar 2024 at 23:38, gene heskett  wrote:

> Well, I seem to be up to the first named subroutine call. But it cannot
> find it.

Drop the ".ngc" from the subroutine name in the .ngc fle.

You have

o sub

-- 
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1912


___
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers


Re: [Emc-developers] Dynamically building a string for a varname?

2024-03-01 Thread gene heskett

On 3/1/24 07:22, andy pugh wrote:

On Fri, 1 Mar 2024 at 08:04, gene heskett  wrote:


One last Q in this thread, assuming the machine has been homed and I
want to G38.2 z-70. where contact is expected at about -67mm. But I
occasionally get a stop before contact. Noise? Will #5070 tell me?.


No, the system can't tell the difference between a false and a genuine trigger.

Well, I seem to be up to the first named subroutine call. But it cannot 
find it.

my .ini file has:

[RS274NGC]
DISABLE_G92_PERSISTENSE = 0
PARAMETER_FILE  = linuxcnc.var
SUBROUTINE_PATH = /home/gene/linuxcnc/nc_files/subs/
RS274NGC_STARTUP_CODE	= G21 G61 #4990=0. #4991=0. #4992=0. 
#4993=0. #4994=0. #4995=0.00


Then I noted that it wasn't looking in the directory named above, but in 
a hash named subdir in /tmp.  So I hunted it down with  mc and deleted 
the whole thing from /tmp, I had restarted and rehomed lcnc a couple 
times to get the stripped to the above path to subs into effect but 
after nukeing it from /tmp the EOF error is gone. Does anyone have any 
idea where/how/why /tmp even got into the lcnc env? 4 damned days I've 
looked at that error, seeing the filename and the line # of the error 
w/o a solution.


Stopped lcnc, nuked that dir in /tmp restarted linuxcnc, the dir in /tmp 
is recreated but it still cannot find that file, and the path to it is 
not being looked at despite the above SUBROUTINE_PATH being specified, 
so I moved the file to nc_files where the error msg says it is looking, 
but still can't find it, put copies both places, still can't find it, 
copy of tholefinder.ngc file attached. Whats wrong?


I'm DIW.

Thanks all.

Cheers, Gene Heskett, CET.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
o sub
( tholefinder.ngc, a hole finding routine to aid in properlyregistering )
( the top and bottom machining operations based on the eagle CAD program. )
( The files are issued by pcb2gcode ulp when it converts an eagle designed )
( board to gcode commands)
( VERY IMPORTANT this code makes some assumptions )
( I am also rigging it to look at a much larger hole, in this case about )
( a 27mm hole in the bellows nipples for the Sheldon's z screw bellows covers )

( 1. That a small piece of brass tubing has been let into the pallet, at )
( board left front corner -0.2X and +0.1Y and is connected to the probe )
( circuit )

( a year later, working on Kip Koons first board )
( now effectively random, and we must find that offset anew )
( when this is finalized, copy to coco-baord1 directory )

( 2. This location device is not known to eagle. Since I found that the )
( whole pattern worked better if the eagle output files were moved to )
( the left by 0.1X, this program will leave at $100 in memory, a value )
( that when applied with a G43.1 X#100 command, the offset to X that will )
( do that, but _all_ tool probing is done without that offset in effect )

( 3. The mill is driven by gcode or by hand before this routine is run )
( so that the tip of a conical probe is already reasonably well centered )
( and lowered slightly into the hole and that the probes hot lead is )
( actually connected to the board! )

( 4. From that point we can probe to find the exact X center of the hole )
( in just 3 probing moves, and an additional 2 probing moves will show )
( the actual Y offset.  For informational use only so far. )

( 5. My probe for this was a very small dremel burr that was cut off to )
( leave a tapered shank but it has some runout, hence the probe is turning )
( slowly at high rate in comparison to the probing moves to effectively )
( cancel out the runout, improving the accuracy by at least 2 decimal places)

( 6. The returned value will be returned in var #100, using other 100 up )
( vars for local scratchpad as it runs &  available for bot.etch and )
( bot.drill use in setting a G43.1 offset )
( 7.  In any event this MUST be used before any other top machining )
( operations. )

( Copyright Feb 2012 by Gene Heskett, licensed the same as LinuxCNC )
( these values are custom for each board pallet made )
( change signs of fudges here in these 2 statements )
( set initial search limits )
(and I just found why some puzzliing results, I was re-using inital values! )
( so use tmp_name for contact results )
#<_right_x> = 0.150
#<_1st_speed>   =   1.5
#<_2nd_speed>   =   .05
#<_left_x>  = -#<_right_x>
#<_back_y>  =   #<_right_x>
#<_front_y> = -#<_right_x>
#<_tmp_f_y> =   0.000
#<_tmp_b_y> =   0.000
#<_tmp_l_x> =   0.000
#<_tmp_r_x> =   0.000
( Assume machine is lost, reset so machine & g54 match )
( G53 G0 X0. Y0. Z0. )
G92.1 (cancel any G92 offsets)
(G10 L2 P1 X0.0 Y0. Z0. R0.0

Re: [Emc-developers] Dynamically building a string for a varname?

2024-03-01 Thread andy pugh
On Fri, 1 Mar 2024 at 08:04, gene heskett  wrote:

> One last Q in this thread, assuming the machine has been homed and I
> want to G38.2 z-70. where contact is expected at about -67mm. But I
> occasionally get a stop before contact. Noise? Will #5070 tell me?.

No, the system can't tell the difference between a false and a genuine trigger.

-- 
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1912


___
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers


Re: [Emc-developers] Dynamically building a string for a varname?

2024-03-01 Thread gene heskett

On 2/29/24 18:50, gene heskett wrote:

On 2/29/24 15:56, andy pugh wrote:

On Thu, 29 Feb 2024 at 18:14, gene heskett  wrote:


Is it possible to concatenate several string vars into a variable name
in order to access an array of vars


No.

But you can do this with numbered variables.

So #[100 + #3] is a valid construction.


tholefinder.ngc currently uses #100 and #101 to return the exact xy 
location of the bolthole its positioned to check (but that is 
adjustable) so I likely will use #200, #210, #220 for the anchor points 
of the 3 0-9 element arrays for x,y,z. Any possible interference with 
o### etc while/do/etc markers?


How do I initialize that to 0., the same way, I assume by
#300=0, then #3000=first hole location x while incremnting #300 to 9
#3010=y location etc, #3020=zlocattion.  Just to make sure its reserved 
when I write the actual data returned from tholefinder (which returns 
the exact center of the holes x in #100 y=in #101 etc) to that location 
for later use.  This will greatly simplify the code, thank you very much 
Andy. Even simpler if I don't have to init the storage until I actually 
have data to write to that location.



One last Q in this thread, assuming the machine has been homed and I 
want to G38.2 z-70. where contact is expected at about -67mm. But I 
occasionally get a stop before contact. Noise? Will #5070 tell me?. The 
docs for G38.2 should say if the value z is searching for is absolute or 
relative from whence it starts.  Needs a 1 liner to add that missing 
data. Docs are 2.9.0-pre1+git20230208.f1270d6ed7 so pretty old now. but 
bookworm isn't offering me anything newer? shouldn't it be up to 2.9.2 now?


Thanks Andy. Stay warm & well.

Cheers, Gene Heskett, CET.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis



___
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers


Re: [Emc-developers] Dynamically building a string for a varname?

2024-02-29 Thread gene heskett

On 2/29/24 15:56, andy pugh wrote:

On Thu, 29 Feb 2024 at 18:14, gene heskett  wrote:


Is it possible to concatenate several string vars into a variable name
in order to access an array of vars


No.

But you can do this with numbered variables.

So #[100 + #3] is a valid construction.


tholefinder.ngc currently uses #100 and #101 to return the exact xy 
location of the bolthole its positioned to check (but that is 
adjustable) so I likely will use #200, #210, #220 for the anchor points 
of the 3 0-9 element arrays for x,y,z. Any possible interference with 
o### etc while/do/etc markers?


How do I initialize that to 0., the same way, I assume by
#300=0, then #3000=first hole location x while incremnting #300 to 9
#3010=y location etc, #3020=zlocattion.  Just to make sure its reserved 
when I write the actual data returned from tholefinder (which returns 
the exact center of the holes x in #100 y=in #101 etc) to that location 
for later use.  This will greatly simplify the code, thank you very much 
Andy. Even simpler if I don't have to init the storage until I actually 
have data to write to that location.


Thanks Andy. Stay warm & well.

Cheers, Gene Heskett, CET.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis



___
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers


Re: [Emc-developers] Dynamically building a string for a varname?

2024-02-29 Thread andy pugh
On Thu, 29 Feb 2024 at 18:14, gene heskett  wrote:

> Is it possible to concatenate several string vars into a variable name
> in order to access an array of vars

No.

But you can do this with numbered variables.

So #[100 + #3] is a valid construction.

-- 
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1912


___
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers


[Emc-developers] Dynamically building a string for a varname?

2024-02-29 Thread gene heskett

Good afternoon;

Is it possible to concatenate several string vars into a variable name 
in order to access an array of vars by appending one or more chars to 
build the name of an array of values?


Something like starting with the general array name like the first 5 
chars of "#<_ar" then append the axis letter, then append the while 
loops control variable 0 to 9 and add a final ">" to terminate the name 
of the var winding up with #<_arx4>, in this case meaning the 5th x 
location storage name, assuming a base0 numbering system.


I've spent several hours scanning thru the docs pdf w/o finding any 
string manipulation stuff. It would be handier than sliced bread or 
bottled beer for this. And would shrink my final code to 15% of 
unrolling the whole maryann bolthole by bolthole.


Thanks all.

Cheers, Gene Heskett, CET.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis


___
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers