Lathe Macros

More
13 Nov 2022 20:48 #256605 by Masiwood123
Replied by Masiwood123 on topic Lathe Macros
now it works:)) and I really like the interface, unfortunately it won't start the program, it shows in the background that the program is running (and this red line also signals that the gcode is being executed, but the axes don't move) however, I usually edit the start line of the gcode to would the program work or ``run from here'' for some simple program, here I am not able to see the lines of the program.. is there a possibility for linuxcnc to export the gcode through this macro so that I can edit it? 
Attachments:

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

More
13 Nov 2022 21:36 - 13 Nov 2022 21:39 #256610 by Masiwood123
Replied by Masiwood123 on topic Lathe Macros
;drilling

; Use T = 0 for tailstock drilling, then this just sets speed

O<drilling> SUB

G18 ; XZ Plane
G21 ; Metric Units
G90 ; Absolute Distance
G91.1 ; but not for arcs

#10 = [#2 * 1000 / [ #1 * 3.141592]]
(debug, #10)
O90 IF [#7 GT 0.5]
M8
O90 ENDIF

O100 IF [#6 LT 0.5]
G97 M3 S#10
O<drilling> RETURN
O100 ENDIF

M6 T#6 G43
G0 X0

O83 IF [#5 GT 0] ; Pecking
G17
G95 F#3 ; Feed-Per-Rev Mode
G97 M3 S#10
G98
G83 R#<_z> Q#5 Z#4
M5 M9 G18
O<drilling> RETURN
O83 ENDIF

O82 IF [1]; not pecking
G17
G95 F#3 ; Feed-Per-Rev Mode
G97 M3 S#10
G98
G82 R#<_z> P0.5 Z#4
M5 M9 G18
O82 ENDIF

O<drilling> ENDSUB

O<drilling> call [10] [100] [0.03] [0] [2] [0] [1]

M2

or maybe I should try to edit this routine to skip some of the first lines of execution, add or similar..maybe is CSS problem?
Last edit: 13 Nov 2022 21:39 by Masiwood123.

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

More
13 Nov 2022 23:02 #256626 by andypugh
Replied by andypugh on topic Lathe Macros
It's all in CSS and feed-per-rev so you need spindle speed feedback or there will be no motion.

Do you have a spindle encoder?
The following user(s) said Thank You: Masiwood123

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

More
13 Nov 2022 23:04 #256627 by andypugh
Replied by andypugh on topic Lathe Macros
Oh, and 100m/min (the default) is much too fast for a HSS drill, best change that now before it's too late.

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

More
13 Nov 2022 23:14 #256630 by Masiwood123
Replied by Masiwood123 on topic Lathe Macros
ok it's still early, I just tried this without the workpiece, away from the headstock..but the program won't start to execute, i.e. it does something but the axes stand still. on the 7i96s I have an encoder input, but the servo motor connected to the headstock has its own encoder that gives feedback to the driver, so I don't use the one on the card. from the card, I only take the analog output 0-5v to the servo motor driver, the driver also has the possibility of position mode, so I use the head as the A axis, also changing the mode of operation between A and S. there is a DRO on the driver that shows the actual speed of the spindle.. and it is accurate almost in a couple of revolutions. what should I do in order for the macros to work at all?

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

More
13 Nov 2022 23:27 #256635 by Masiwood123
Replied by Masiwood123 on topic Lathe Macros
The following user(s) said Thank You: tommylight

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

More
13 Nov 2022 23:58 #256637 by andypugh
Replied by andypugh on topic Lathe Macros
Do you have connections to spindle.0.revs and spindle.0.speed-in?

Check that they show the right numbers with halmeter.

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

More
14 Nov 2022 00:12 - 14 Nov 2022 00:13 #256643 by Masiwood123
Replied by Masiwood123 on topic Lathe Macros
I can check tomorrow on the spot, although I only used the halmeter once to tune the servo motor..this is what I have in Hal as a link. by the way, I only use the spindle in one direction, I think the driver would require a range from -10 to +10v for the reverse M4 (if that is important at all in this case)


# ---setup spindle control signals---

net spindle-vel-cmd-rps <= spindle.0.speed-out-rps
net spindle-vel-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-vel-cmd-rpm <= spindle.0.speed-out
net spindle-vel-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-enable <= spindle.0.on
net spindle-cw <= spindle.0.forward
net spindle-ccw <= spindle.0.reverse
net spindle-brake <= spindle.0.brake
net spindle-revs => spindle.0.revs
net spindle-at-speed => spindle.0.at-speed
net spindle-vel-fb-rps => spindle.0.speed-in
net spindle-index-enable <=> spindle.0.index-enable
Last edit: 14 Nov 2022 00:13 by Masiwood123.

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

More
14 Nov 2022 00:25 #256646 by andypugh
Replied by andypugh on topic Lathe Macros
I don't see anything driving the signals spindle-revs and spindle-vel-fb-rps

Ideally those would be connected to a spindle encoder.

Do you have threading working? I assume not?

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

More
14 Nov 2022 00:40 #256648 by Masiwood123
Replied by Masiwood123 on topic Lathe Macros
in general, everything is still in the final stage of lathe construction, I will use the lathe mainly for some smaller wooden pieces, but since I already have a knife holder on the other side and a slightly stronger motor, I want to perform some basic operations on metal as well(these macros are just ideal for that, because a lot of time is wasted if I had to program everything in solidworks) (I often need some smaller parts of metal) I will also try tomorrow to see if the threading works.. these are good lessons for me to learn, since I didn't know anything, I understand little by little how things fit together:) and thank you very much for your help

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

Time to create page: 0.191 seconds
Powered by Kunena Forum