请选择 进入手机版 | 继续访问电脑版

大海作坊

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 312|回复: 0

发个MACH3原版对刀

[复制链接]

2

主题

7

帖子

48

积分

新手上路

Rank: 1

积分
48
发表于 2018-7-15 19:57:32 | 显示全部楼层 |阅读模式
E文原版





Howto use the Tool Touch Macro
Automatic tool setting is a powerfulroutine that will really improve the speed and accuracy of your CNC work.
Here’s how it works.  
Configure Mach 2 to accept a digitize input on your inputs page, andset the correct input pin assignment for your digitizer.  The digitizer can be NC or NO and can triggerthe input signal “high” or “low”.  
file:///C:/Users/ADMINI~1/AppData/Local/Temp/msohtmlclip1/01/clip_image002.jpgfile:///C:/Users/ADMINI~1/AppData/Local/Temp/msohtmlclip1/01/clip_image004.gif
Your digitizer can be as simple as a NC electric switch or inductiveproximity sensor, but for accurate and repeatable touch off (.001”) you willneed a touch probe like the one shown in the photo.  The touch probe sends an open circuit signalto Mach 2 whenever the contact is broken by your tool touching the switch.  
This can also be accomplished by simply attaching a wire to yourwork and to the tool.  When the two cometogether they will close the electric circuit and send the signal to thecontrol.  Be aware however that if youare doing this the tool must be electrically insulated from the work and thisis not normal on most machine tools. Most machines will conduct electricity through the entire chassis of themachine.  Also be aware that there is no“give” when your tool touches the work and any error in set up on your partwill result in a broken tool or gouged work or both.
An inexpensive and reliable probe can be purchased from Minitech

ToolTouch Macro Explained
The VB code to execute your tool touch is shown below with a briefexplanation of the functions shown in BLUE.  Do not include the BLUEtext in your code; it is simply an explanation of the function of the code.
This text can be written into a button using Mach 2 Screen Designer,or can be used to create a custom Macro function that can be executed a numberof ways.  Please consult Mach 2documentation for more info on creating Macros or using Screen Designer.
Tool Touch Macro
REM Context 10001
if IsSuchSignal (22) Then
code "G49 g31 z-2 f10" Cancel any tool length offsets and move thetool to Z = -2.0 units at a feed rate of 10 units/time until a digitize signalis detected.  Feed-rate is entirely up toyou but make sure it’s not too fast or you will get inaccurate results fromyour digitize “touch”.  You may want toset G90 or G91 on this line as well.  Thecommand will behave differently if you are in absolute or relative mode.  G31 is a probing command that tells themachine to move in the commanded direction until a “digitize” input signal isdetected.
While IsMoving()
Wend
Height = GetOEMDRO(85)  Set the variable “height” equal to the value of the Z axisposition DRO.
Call SetoemDRO(42,Height)  Set the Z offset DRO to the value of the variable“height”  This also sets the Z touchvalue in the Tool Table for the tool that you have selected.  Be careful not to have tool “0” (zero)selected as this can cause some weird problems and the only way to clear toolzero back to zero offset is to move the machine to machine coordinates Z=0 and“touch”
Tool = GetSelectedTool                 ‘ this gets the current toolnumber
REM Context 10001            
if IsSuchSignal (22) Then
code "G0X" & PROBEX & "Y" &PROBEY   'this moves us to above the switch
code "g31 z-10 f50"
While IsMoving()
Wend
MachineZ = GetVar( 2002)                       'this is the point of switch contact
MachineZ = MachineZ - SPECIAL             'this calculates the length of the bit from bit 0’s length
code "G10 L2 P"& Tool &" Z"&MachineZ   'puts it in the tool table
code"G43H"&Tool                                   ' and turns on the offset
end if
  TheSPECIAL is replaced by the distance of your Z from home to the top of thesensor with tool #0 in it. The macro subtracts the difference and know exactlyhow long the tool is
The G10L2 line sets the tool in the table andthen turns on G43 with that tool. PROBEX an Y need to be changed to the XYposition of the sensor on the table.
code "G49 G54 Z0"  Cancel tool length offset and move the tool back to Z =0.  Depending on what mode you started inand how your Z axis is referenced this may not be where the tool started from.
While IsMoving()
Wend
end if

CAUTION- READ BELOW!!
1.  All motion will be in theABS or INC mode that you have selected (i.e. G90 or G91).  For instance if the tool is at Z=-3 and youselect “auto tool touch” the tool will actually move up which isn’t much goodfor tool setting.  You may have toexperiment with the G Code in your macro to get the machine to respondcorrectly for your application.
2.  Make sure if you modifythe code that you test all code before placing your probe under the tool.  It is very easy to make a mistake here andactually have your tool crash into the probe and ruin it!!  Please test all code safely before puttingexpensive components in the way of the tool. The combination of G91 and G90 plus the tool length offsets can create someconfusing situations if you are not 100% familiar and experienced with howthese codes affect your machine.  Pleaseread and understand the MACH2 documentation concerning tool length offsets,fixture offsets, and relative and absolute coordinate systems.
3.  Be aware that if your Zaxis has not been referenced you may experience some strange behavior whenattempting your automatic tool touch off.





回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|大海作坊 ( 湘ICP备17019901 )

GMT+8, 2018-8-22 14:28 , Processed in 0.067475 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表