找回密码
 立即注册

QQ登录

只需一步,快速开始

微信扫码登录

搜索
查看: 552|回复: 12

[原创] 手把手教你制作UG四五轴宏联动后处理(二十九)

[复制链接]

54

主题

138

回帖

1665

积分

六级士官

积分
1665
发表于 2026-1-11 00:35:47 | 显示全部楼层 |阅读模式
  #*********************计算Zrtcp***********************
  set e1 [expr cos($rad_b)-1.0]
  set e2 [expr sin($rad_b)]
  set d1 [expr round($e1*1000000.0)/1000000.0]
  set d2 [expr round($e2*1000000.0)/1000000.0]
  set vz [expr round($mom_pos(2)*10000.0)/10000.0]
  set w1 [format "%.6f" $d1]
  if {![string compare "-1.000000" $w1]} {
    set s1 "-#103"
  } elseif {![string compare "1.000000" $w1]} {
      set s1 "#103"
    } else {
        if {[string index $w1 end-0] == "0"} {
          if {[string index $w1 end-1] == "0"} {
            if {[string index $w1 end-2] == "0"} {
              if {[string index $w1 end-3] == "0"} {
                if {[string index $w1 end-4] == "0"} {
                  if {[string index $w1 end-5] == "0"} {
                     set w1 [format "%d." [expr round($d1)]]
                   } else {
                       set w1 [format "%.1f" $d1]
                     }
                 } else {
                     set w1 [format "%.2f" $d1]
                   }
               } else {
                   set w1 [format "%.3f" $d1]
                 }
             } else {
                 set w1 [format "%.4f" $d1]
               }
           } else {
               set w1 [format "%.5f" $d1]
             }
        }
        if {$d1 != 0.0} {
          set s1 [format "%s*#103" $w1]
        } else {
            set s1 "NONE"
          }
      }
  set w2 [format "%.6f" $d2]
  if {![string compare "-1.000000" $w2]} {
    set s2 "-#101"
  } elseif {![string compare "1.000000" $w2]} {
      set s2 "+#101"
    } else {
        if {[string index $w2 end-0] == "0"} {
          if {[string index $w2 end-1] == "0"} {
            if {[string index $w2 end-2] == "0"} {
               if {[string index $w2 end-3] == "0"} {
                 if {[string index $w2 end-4] == "0"} {
                   if {[string index $w2 end-5] == "0"} {
                     set w2 [format "%d." [expr round($d2)]]
                   } else {
                       set w2 [format "%.1f" $d2]
                     }
                 } else {
                     set w2 [format "%.2f" $d2]
                   }
               } else {
                   set w2 [format "%.3f" $d2]
                 }
             } else {
                 set w2 [format "%.4f" $d2]
               }
           } else {
               set w2 [format "%.5f" $d2]
             }
        }
        if {$d2 > 0.0} {
          set s2 [format "+%s*#101" $w2]
        } elseif {$d2 < 0.0} {
            set s2 [format "%s*#101" $w2]
          } else {
              set s2 "NONE"
            }
      }
  set w4 [format "%.4f" $vz]
  if {[string index $w4 end-0] == "0"} {
    if {[string index $w4 end-1] == "0"} {
      if {[string index $w4 end-2] == "0"} {
        if {[string index $w4 end-3] == "0"} {
          set w4 [format "%d." [expr round($vz)]]
        } else {
            set w4 [format "%.1f" $vz]
          }
      } else {
          set w4 [format "%.2f" $vz]
        }
    } else {
        set w4 [format "%.3f" $vz]
      }
  }
  if {$vz > 0.0} {
    set s4 [format "+%s" $w4]
  } elseif {$vz < 0.0} {
      set s4 [format "%s" $w4]
    } else {
        set s4 "NONE"
      }
  if {[string compare "NONE" $s1] && ![string compare "NONE" $s2]} {
    set s $s1
  } elseif {![string compare "NONE" $s1] && [string compare "NONE" $s2]} {
      set s $s2
    } elseif {[string compare "NONE" $s1] && [string compare "NONE" $s2]} {
        set s [format "%s%s" $s1 $s2]
      } else {
          set s "NONE"
        }
  if {[string compare "NONE" $s] && [string compare "NONE" $s4]} {
    set sz [format "\[%s%s\]" $s $s4]
  } elseif {![string compare "NONE" $s] && [string compare "NONE" $s4]} {
      set sz $s4
    } elseif {[string compare "NONE" $s] && ![string compare "NONE" $s4]} {
        set sz [format "\[%s\]" $s]
      } else {
          set sz "0."
        }
  return 1
}
return 0
  点击确定。
7.在"程序和刀轨"选项卡中,选择左侧"工序结束序列"选项,在"刀轨结束"事件下添加G91 G28 Z0.行。
8.在"程序和刀轨"选项卡中,选择左侧"程序结束序列"选项:
  (1).在"程序结束"事件下添加G91 G28 X0. Y0. M9行。
  (2).在"程序结束"事件下的G91 G28 X0. Y0. M9行下面添加G91 G28 B0. M5行。
  (3).在"程序结束"事件下的G91 G28 B0. M5行下面添加M30行。
  (4).在"程序结束"事件下的M30行下面添加%行。
9.保存后处理文件。  
10.四轴转台B宏联动后处理制作完成。

大功告成。。。。。。。。。。。。。作者 南京六合标子

评分

参与人数 1G币 +1 收起 理由
静宁思远 + 1 很给力!

查看全部评分

23

主题

391

回帖

3424

积分

中尉

积分
3424
发表于 2026-1-12 13:47:38 | 显示全部楼层
梦绕临岚 发表于 2026-1-12 11:51
global dpp_flag
       global mom_tool_axis_type
       global mom_operation_type

对,旋转部件加工也会失效判定 为定轴

7

主题

392

回帖

3645

积分

中尉

积分
3645
发表于 2026-1-12 10:40:22 | 显示全部楼层
感谢大佬无私奉献

1

主题

493

回帖

5463

积分

上尉

积分
5463
发表于 2026-1-12 11:51:46 | 显示全部楼层
       global dpp_flag
       global mom_tool_axis_type
       global mom_operation_type
       set dpp_flag 1
       if { ![info exists mom_tool_axis_type] } {
          set mom_tool_axis_type 0
       }
       if { $mom_tool_axis_type >= 2 && [string match "Variable-axis *" $mom_operation_type] } {
         set dpp_path_type "4X"
      } else {
          set dpp_path_type "3X"
        }
这种判断,操作工序是引导曲线,设置了侧倾/退刀会失效的

19

主题

903

回帖

2万

积分

中将

积分
26512

论坛贡献灌水王

发表于 2026-1-12 14:41:01 | 显示全部楼层
我感觉手把手我也学不会

1

主题

15

回帖

759

积分

四级士官

积分
759
发表于 2026-1-22 21:01:18 | 显示全部楼层
6816 发表于 2026-1-12 13:47
对,旋转部件加工也会失效判定 为定轴

我这被低版本钻孔卡住了,本应为“3x"或”3+2“的,测试出来全是”5X“,从而解发RTCP补偿
微信图片_2026-01-22_205733_421.png

23

主题

391

回帖

3424

积分

中尉

积分
3424
发表于 2026-1-23 08:39:43 | 显示全部楼层
钻孔我倒是解决了,但是铣孔没解决只能一个角度空 一个工序,不能连起来。我看那做后处理得大师联动也能用,不知道怎么弄得!

1

主题

15

回帖

759

积分

四级士官

积分
759
发表于 2026-1-23 11:03:37 | 显示全部楼层
6816 发表于 2026-1-23 08:39
钻孔我倒是解决了,但是铣孔没解决只能一个角度空 一个工序,不能连起来。我看那做后处理得大师联动也能用 ...

孔铣我的解决了,你低版本钻孔处理出来是什么样的,可否共享下

23

主题

391

回帖

3424

积分

中尉

积分
3424
发表于 2026-1-23 11:09:58 | 显示全部楼层
没解决我就没弄给删了,又时间我找找看看又没有备份,钻孔要改它那个判断语句!

1

主题

299

回帖

2398

积分

少尉

积分
2398
发表于 2026-1-23 12:33:30 来自手机 | 显示全部楼层
你好楼主,请教下UG三轴后处理怎么加判断语句, G43 Z(),当这里的Z是负值则不输出后处理
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

咨询QQ:1359218528|发帖须知!|Archiver|手机版|小黑屋|UG爱好者论坛 ( 京ICP备10217105号-2 )

GMT+8, 2026-2-27 13:27

Powered by Discuz! X3.5 Licensed

© 2001-2025 Discuz! Team.

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