NGCGUI error with BackToolLathe

More
03 Jul 2013 01:12 - 03 Jul 2013 01:15 #36245 by dgarrett
the .axisrc code on the wiki seems to have been mentioned in irc:
linuxcnc.mah.priv.at/irc/%23emc/2012-01-03.html#00:11:48

but the originator is unclear as is the linuxcnc version it applies to

in git master axis.py:
o = MyOpengl(widgets.preview_frame, width=400, height=300, double=1, depth=1)
but, the class MyOpengl does not define self.g
nor does the parent class GlCanonDraw (in lib/python/rs274/glcanon.py)
nor do other parents that i see -- so the code shown may be incomplete
or bitrotted or applicable to earlier versions (i don't know).

The error from the .axisrc code:
"AttributeError: MyOpengl instance has no attribute 'g'"
does not stop execution and can be remedied by commenting out
the block for "if o.g:"

The red text "SendFileToAxis failed" likely indicates something wrong with
the subroutine (which hasn't been posted). A way to get help for
this is to replicate the problem in a simulator config and post all of the
config and subroutine files.
Last edit: 03 Jul 2013 01:15 by dgarrett.
The following user(s) said Thank You: BigJohnT, bjames28

Please Log in or Create an account to join the conversation.

More
14 Jul 2013 13:43 #36635 by bjames28
Dear Dewey,

Sorry for the late reply, I had no access to the Net.

Thank you for the detailed explanation.
We did as you recommended, the modified .axisrc solved all error messages.

The working .axisrc is:
if lathe:
 bind_axis("Down", "Up", 0)
 def set_view_y(event=None):
	widgets.view_z.configure(relief="link")
	widgets.view_z2.configure(relief="link")
	widgets.view_x.configure(relief="link")
	widgets.view_y.configure(relief="sunken")
	widgets.view_p.configure(relief="link")
	vars.view_type.set(4)
	o.reset()
	glRotatef(90, 1, 0, 0)
	glRotatef(90, 0, 1, 0)
	o.set_eyepoint(5.)
	o.perspective = False
	o.lat = -90
	o.lon = 0
	o.tkRedraw()
  
TclCommands.set_view_y = commands.set_view_y = set_view_y
root_window.bind("v", commands.set_view_y)
root_window.after_idle(commands.set_view_y)

Here is the lathe roughing ngc routine with English translation. It may be useful for others. Thanks to the author, Béni. His other routines can be found on his site.
(info:Keresztrányú nagyolás / Lathe roughing along diameter)
O<keresztnagyol> sub
	G18 G90 G40 G7
	;(X ERTEKEKET ATMERO MODBAN KELL KITOLTENI!)
	;(X VALUES MUST BE GIVEN IN DIAMETER MODE!)
    #<m34>  =#1	(=1 Forgásirány 0-M3 1-M4 )
	;(Rotation of Spindle 0-M3 1-M4 )
    #<tool> =#2	(=1 Szerszám)
	;(Tool no.)
    #<fmod> =#3	(=0 Előtolás 0-mm/perc | 1-mm/ford.)
	;(Feedrate mode: 0=mm/sec | 1=mm/rpm)
    #<smod> =#4 (=0 0-Fix fordulat | 1- Állandó vágóseb.)
	;(0=Constant rpm | 1=Constant Surface Speed)
    #<ff>   =#5	(=20 Előtolás)
	;(Feedrate value)
    #<ss>   =#6	(=1000 Fordulatszám / Vágósebesség)
	;(RPM/CSS)
    #<smax> =#7	(=2000 Max. fordulat) 
	;(Max. RPM)
    #<p1xo>=#8	(=12 Első pont X)
	;(First point X coord)
    #<p1zo> =#9	(=-0.5 Első pont Z)
	;(First point Z coord)
    #<p2xo> =#10	(=1 Második pont X)
	;(Second point X coord)
    #<p2zo> =#11    (=-0.5 Második pont Z)
	;(Second point Z coord)
    #<p3xo> =#12    (=1 Harmadik pont X)
	;(Third point X coord)
    #<p3zo> =#13    (=0 Harmadik pont Z)
	;(Third point Z coord)
    #<d>    =#14    (=0.1 Fogás)
	;(Cut depth)
    #<ax>   =#15    (=0 X ráhagyás)
	;(X allowance)
    #<az>   =#16    (=0 Z ráhagyás)
	;(Z allowance)
    #<rkorr>=#17    (=0 Rádiusz korr. 0-KI | 1- BE)
	;(compensation 0-OFF | 1-ON)

    #<p1x>=[#<p1xo>/2+#<ax>]
    #<p2x>=[#<p2xo>/2+#<ax>]
    #<p3x>=[#<p3xo>/2+#<ax>]
    #<p1z>=[#<p1zo>+#<az>]
    #<p2z>=[#<p2zo>+#<az>]
    #<p3z>=[#<p3zo>+#<az>]

    #<bre>=0
    #<xact>=#<p3x>
    #<zact>=#<p3z>

O<100>  IF[#<fmod> EQ 0]
          G94 F#<ff>
O<100>  ENDIF

O<101>  IF[#<fmod> EQ 1]
          G95 F#<ff>
O<101>  ENDIF

O<102>  IF[#<smod> EQ 2]
          G96 S#<ss> D#<smax>
O<102>  ENDIF

  T#<tool> M6 G43

O<103>  IF[#<m34> EQ 0]
          M03 S#<ss>
O<103>  ELSE
          M04 S#<ss>
O<103>  ENDIF 

  #<dnum>=FUP[[#<p3z>-#<p1z>]/#<d>] ;(Fogások száma / Number of cuts)
  #<dreal>=[[#<p3z>-#<p1z>]/#<dnum>] ;(Valós fogás / real cut)

O<104>  WHILE[[#<zact>-#<dreal>] GE #<p1z>]
          #<xprev>=#<xact>
          #<zprev>=#<zact>
          #<zact>=[#<zact>-#<dreal>]
O<105>    IF[#<zact> LT #<p2z>]
            #<xact>=[[#<p2z>-#<zact>]*[[#<p1x>-#<p2x>]/[#<p2z>-#<p1z>]]+#<p2x>]
O<106>      IF[#<bre> EQ 0]
              #<bre>=1
O<106>      ENDIF
O<105>    ELSE
            #<xact>=[[#<p3z>-#<zact>]*[[#<p2x>-#<p3x>]/[#<p3z>-#<p2z>]]+#<p3x>]
O<105>    ENDIF

          G0 X[2*[#<p1x>]+0.2] Z[#<zact>+0.1]
          G1 X[2*#<p1x>] Z#<zact> F#<ff>
          X[2*#<xact>]

O<107>    IF[#<bre> EQ 1]
            X[2*#<p2x>] Z#<p2z>
            #<bre>=2
O<107>    ENDIF

          X[2*#<xprev>] Z[#<zprev>]
          G0 X[2*#<p1x>+4]

O<104>  ENDWHILE

O<108>  IF[[#<ax>*#<az>] NE 0]
          G0 Z[#<p1zo>+2]

O<109>    IF[#<rkorr> EQ 1]
             G41
O<109>    ENDIF

          G1 X#<p1xo> Z#<p1zo>
          X#<p2xo> Z#<p2zo>
          X#<p3xo> Z#<p3zo>
          G40
O<108>  ENDIF
  G0 X[#<p1xo>+10] Z[#<p3zo>+5]
  M05
O<keresztnagyol> endsub

I am not sure if that's the right topic for that, sorry.

All the config and related files can be found here:
linuxcnc.hu/wp-content/uploads/2013/07/lathe_fman.tar.gz


Best regards:
James

Please Log in or Create an account to join the conversation.

More
15 Jul 2013 17:39 #36663 by ArcEye
Hi

Just to clarify the indentation needed with this code

As it is shown it will change the view irrespective of whether LATHE=1 is defined in the ini file or not
Probably lost indenting in the cut an paste

I found that this works as intended
if lathe:
	bind_axis("Down", "Up", 0)
 	def set_view_y(event=None):
		widgets.view_z.configure(relief="link")
		widgets.view_z2.configure(relief="link")
		widgets.view_x.configure(relief="link")
		widgets.view_y.configure(relief="sunken")
		widgets.view_p.configure(relief="link")
		vars.view_type.set(4)
		o.reset()
		glRotatef(90, 1, 0, 0)
		glRotatef(90, 0, 1, 0)
		o.set_eyepoint(5.)
		o.perspective = False
		o.lat = -90
		o.lon = 0
		o.tkRedraw()
  
	TclCommands.set_view_y = commands.set_view_y = set_view_y
	root_window.bind("v", commands.set_view_y)
	root_window.after_idle(commands.set_view_y)

regards
The following user(s) said Thank You: bjames28

Please Log in or Create an account to join the conversation.

More
15 Jul 2013 22:32 #36675 by bjames28
Dear ArcEye,

Thank you for this clarification!

Regards:
James

Please Log in or Create an account to join the conversation.

More
28 Oct 2013 00:40 #40352 by cradek
I updated the code on that wiki page to work for versions 2.5 and later.

Please Log in or Create an account to join the conversation.

More
28 Oct 2013 04:13 #40357 by emcPT
Hello. After using this change, the axis displays correctly, but the tool geometry does not show after any toolchange.
I think that only the default tool is present.
Can this be confirmed? or it is just me?

Please Log in or Create an account to join the conversation.

Time to create page: 0.156 seconds
Powered by Kunena Forum