5iMX宗旨:分享遥控模型兴趣爱好

5iMX.com 我爱模型 玩家论坛 ——专业遥控模型和无人机玩家论坛(玩模型就上我爱模型,创始于2003年)
查看: 580|回复: 10
打印 上一主题 下一主题

求mach3 数控车电动刀架的换刀宏代码

[复制链接]
跳转到指定楼层
楼主
发表于 2024-10-22 19:51 ——“来自手机” | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yhzzp 于 2024-10-22 19:52 编辑

如题,准备做一个迷你自动换刀的数控车。电动刀架已经有了,缺少换刀宏代码。翻了历史帖子,不全。求有这方面资料的坛友赐教。在此表示感谢!

欢迎继续阅读楼主其他信息

沙发
发表于 2024-10-23 15:55 | 只看该作者
你搜下,有人发过
3
 楼主| 发表于 2024-10-23 16:23 ——“来自手机” | 只看该作者
tiantangqq 发表于 2024-10-23 15:55
你搜下,有人发过

代码已经没有了
4
发表于 2024-10-23 18:29 | 只看该作者
找咪咪。咪咪有。
5
发表于 2024-11-8 09:46 | 只看该作者
老兄不忘初心
6
 楼主| 发表于 2024-11-8 19:41 | 只看该作者

人一生嘛!总要有一些自己喜欢的东西。
7
发表于 2025-4-5 21:06 | 只看该作者
我有你要不要了
8
 楼主| 发表于 2025-4-6 07:41 | 只看该作者

要,在此表示感谢!请发邮箱:436040572@qq.com
9
发表于 2025-4-6 09:29 | 只看该作者
'Toolchanger  Macro For the M6Start Macro:
'Input1 == Tool #1
'Input2 == Tool #2
'Input3 == Tool #3
'Input4 == Tool #4

'Output4 raise/rotate turret
'Output5 rotate/Lock turret
'OEMDRO(1111) is utilized to store the last used tool (OldTool) and is updated

OldTool = GetOEMDRO (1111)
Tool = GetSelectedTool()
MaxToolNum = 4      'Max number of tools for the changer

If OldTool = Tool Then
Message ("Selected Tool already loaded")
Exit Sub
End If

While Tool > 4
Tool = Question ("Tool Error, Tool number to large Enter new tool number")
Wend

Call StartTool

While NewTool <> Tool
   Call CheckPins
   While IsMoving()
        Sleep(10)
   Wend
Wend

Call StopTool

Call SetUserDRO (1200, NewTool)
SetCurrentTool(NewTool)

'//// Subroutines /////////

Sub StartTool

   ActivateSignal(Output3)
      While IsMoving()
        Sleep(10)
      Wend
End Sub

Sub CheckPins
   If  IsActive(Input1)  Then
      NewTool = 1
           End If

   If  IsActive(Input2)  Then
      NewTool = 2
            End If

   If  IsActive(Input3)  Then
      NewTool = 3
           End If

   If  IsActive(Input4)  Then
      NewTool = 4
           End If
End Sub


Sub Stoptool

     DeActivateSignal(Output3)

   
    ActivateSignal(Output5)  
          Code "G4 P2.0"     
          While IsMoving()
          Sleep(5)
      Wend
      
      DeActivateSignal(Output5)
            While IsMoving()
          Sleep(5)
      Wend

  End Sub
10
发表于 2025-4-6 09:39 | 只看该作者
yhzzp 发表于 2025-4-6 07:41
要,在此表示感谢!请发邮箱:

你加我QQ吧79023159
11
发表于 2025-4-6 21:29 | 只看该作者
刘国军 发表于 2025-4-6 09:29
'Toolchanger  Macro For the M6Start Macro:
'Input1 == Tool #1
'Input2 == Tool #2

感谢分享
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

关闭

【站内推荐】上一条 /2 下一条

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