|
发表于 2021-7-19 22:56:45
|
显示全部楼层
本帖最后由 w_y8266* 于 2021-7-19 22:58 编辑
我抄了下来,但是UG后处理报警。for {set i 0} {$i < 3} {incr i} {
set blank_mcs($i) [expr $mom_msys_origin($i)-$mom_blank_block_center($i)]
}
proc MTX3_vec_multiply {u m w} {
upvar $u ul; upvar $m ml; upvar $w wl
set wl(0) [expr ($ul(0) * $ml(0) + $ul(1) *$ml(1) + $ul(2) *$ml(2))]
set wl(1) [expr ($ul(0) * $ml(3) + $ul(1) *$ml(4) + $ul(2) *$ml(5))]
set wl(2) [expr ($ul(0) * $ml(6) + $ul(1) *$ml(7) + $ul(2) *$ml(8))]
}
MTX3_vec_multiply blank_mcs mom_msys_matrix blank_mcs_center
mom_blank_block_length 毛坯的长
mom_blank_block_width 毛坯的宽
mom_blank_block_height 毛坯的高
mom_blank_block_center 毛坯中心相对于ACS的位置
mom_msys_origin MCS原点相对于ACS的位置
mom_msys_matrix MCS姿态的9值矩阵
set blank_xx [expr $mom_blank_block_length /2]
set blank_yy [expr $mom_blank_block_width /2]
set blank_zz [expr $mom_blank_block_height /2]
set blank_x_left [expr -1*$blank_xx]
set blank_y_front [expr -1*$blank_yy]
set fol_height [expr -1*$mom_blank_block_height]
set blank_mcs_center(2) [expr $blank_mcs_center(2) - $blank_zz]
#X位置
if { [EQ_is_zero $blank_mcs_center(0)] } {
MOM_output_text "(X分中)"
} elseif {[EQ_is_equal $blank_mcs_center(0) $blank_x_left]} {
MOM_output_text "(X左端为零)"
} elseif {[EQ_is_equal $blank_mcs_center(0) $blank_xx]} {
MOM_output_text "(X右端为零)"
} else {
MOM_output_text "(X分中偏移[format%0.2f $blank_mcs_center(0)])"
}
#Y位置
if { [EQ_is_zero $blank_mcs_center(1)] } {
MOM_output_text "(Y分中)"
} elseif {[EQ_is_equal $blank_mcs_center(1) $blank_y_front]} {
MOM_output_text "(Y下端为零)"
} elseif {[EQ_is_equal $blank_mcs_center(1) $blank_yy]} {
MOM_output_text "(Y上端为零)"
} else {
MOM_output_text "(Y分中偏移[format%0.2f $blank_mcs_center(1)])"
}
#Z位置
if { [EQ_is_zero $blank_mcs_center(2)] } {
MOM_output_text "(Z顶面为零)"
} elseif {[EQ_is_equal $blank_mcs_center(2) $fol_height]} {
MOM_output_text "(Z底面为零)"
} else {
MOM_output_text "(Z顶面偏移[format%0.2f $blank_mcs_center(2)])"
}
|
|