Mach Discussion > VB and the development of wizards

How to stop a movement when input is active?

(1/3) > >>

bob1:
Hello all!

First a littel introduction of myself. I´m a student at a technical school in Germany.
At the moment I´m building a CNC plasma-router, running with mach3.

I want to write a macro that should automatically set the right hight from the sheet metal.

For this application I need to code something that will stop the movement of the Z-axis when a Input Signal is active.

I wanted to try something like that:


--- Code: ---Input = IsActive(INPUT1)

If Not (IsActive(Input)) Then
Code "G1Z-20F100"                 "Z-Axis is moving a in Z - to touch down on the sheet an trigger the sensor"
While isMoving()
Sleep 100
Wend
Else
DoOEMButton(1003)                   "I wanted to stop the Axis moving with that, but this seems to be wrong in that way!"
End If
--- End code ---


This code doesn´t work for me ( Unfortunately, I dont have a big idea about basic  :(  )

So I just want to stop an Axis movment by an Sensor.
Can anybody help me with that problem?

Thank you in advance!

Greets
Bob

P.S. Sorry if there are to much mistakes in my speech  ;D

zealous:
I dont have all the info on what you are trying to do but following the code you have this would be how you would do it:


--- Code: ---Code "G1 Z -20 F100"
While isMoving()
If (IsOutputActive(Output1)) Then
DoOEMButton(1003)
Sleep 100                
End If
Wend
--- End code ---

zealous:
BTW: you could use G31 is what I quess you are looking for.
G31 Z-20.0 F100 (Probe in Z)

bob1:
Hi,

Thank you Jason!

I tryied it with your code and the axis is stopping.

But I want it to return straight after it has stopped, and move it incremental to maybe Z +5 ( sorry I didn´t mentioned that in my first explanation ).
With the G31, it is stopping when the Input is active, but not moving any more when the input is active, when I disable the input manually it starts to move back.

Maybe to be clearer I wanna do something like the guy in this short clip (Machine is doing a touch probe with the torch before every cut)

I tryied it like that :


--- Code: ---Code "G31 Z -20 F100"
While isMoving()
If (IsInputActive(Input1)) Then
Code "G91"
Code G0 Z5
Sleep 100                
End If
Wend
--- End code ---

But aint working

Any ideas?

Thanks
Bob

stirling:
Bob - I'm not sure if you have been told to do this via a VB macro by your school but this is not generally how this is done. IHS (Initial Height Sensing) from the hardware point of view is usually done by one (or more) of: Floating head, Ohmic sensing and capacitive sensing. It sounds from what you've said that you are using the floating head method with a microswitch. If so, you have the option of using either probe based IHS (G31) or home based IHS (G28.1). I'd suggest home based to start with.

In this method, you set your floating head microswitch as a home switch and set home to be -ve (in home/limits). You then use something like the following gcode at the start of each cut:


--- Code: ---G28.1 Z3.00  (home downwards from safe height, 3 is just an example)
G92 Z0.0      (Homed, so set Z to 0)
G00 Z2.8000 (back off for switch travel - yours will likely be different - set distance appropriately)
G92 Z0.0      (set Z to 0)
G00 Z3.8000 (Move up to piearce height - see your plasma cutter manual)
M03             (fire torch)
G04 P0.3      (wait pierce delay - see your plasma cutter manual)
G01 Z1.5000 (descend to cut height - see your plasma cutter manual)
....               (commanded moves in x, y)

--- End code ---

Hope this helps

Ian

Navigation

[0] Message Index

[#] Next page

Go to full version