少尉
UID2759808
U币409
G币1874
技术0
主题29
精华1
阅读权限75
注册时间2016-12-27
最后登录2024-11-17
在线时间70 小时
手机18855358125
少尉
|
本帖最后由 xingyue 于 2016-12-29 09:57 编辑
PM加工垂直面是一个很郁闷的事情,不过在很多前辈的努力下,发现了找到了很多种方法!这里我介绍一种,是用宏写出来的!
下面是我运行宏产生边界的过程!后面当然有宏的源码,希望大家多多指教!一、选择要生成边界的垂直面,也可以是陡峭面,但是不能为倒扣面;
二、运行宏;
三、输入余量。径向余量和轴向余量用空格隔开,单独输入一个数字,而不使用空格。默认为关闭轴向余量;
四、输入底部偏置的距离;
五、选择刀具!
六、宏可以计算……这是计算后的边界;
七、这是等高的效果!等高的刀具是你一开始选择的刀具,余量也是你设置的余量!
OK!不多废话了!下面是源码!免得有人说我只发图不发源码!无意苦争春,只把春来报!奈何零落成泥碾作尘,扔遭群芳妒!用不好代码框!不好意思!修改了下!注意代码不全:到后面找<有字数限制>!
//注意:
// 0)运行宏之前选好要加工的面(虽然是多算,最好自选一个垂直面);
// 1)径向余量与轴向余量用空格隔开,单独输入数字默认是关闭轴向余量;
// 2)由于更改了开始点和结束点,刀路安全自己注意 ;
// 3)容错公差默认为1MM;
// 4)等高刀路自己设置;
FUNCTION MAIN() {
GRAPHICS LOCK
DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
DELETE TOOLPATH FOLDER "Toolpath\MyFolderTop"
DELETE TOOLPATH FOLDER "Toolpath\MyFolderBottom"
STRING $str=input "请输入余量:"
Real $offset=input "请输入底部位置偏置距离:"
STRING ToolName = INPUT ENTITY TOOL "选择刀具"
ACTIVATE TOOL $ToolName
CALL SetBlock()
//生成顶部参考线
CREATE FOLDER "Toolpath" "MyFolderTop"
ACTIVATE FOLDER #
STRING THName=""
CALL Swarf(str,0,'top',THName)
STRING PName=new_entity_name('Pattern')
CREATE PATTERN ;
EDIT PATTERN ; INSERT TOOLPATH ;
EDIT TOOLPATH DIVIDE TYPE RETRACT
PROCESS TPDIVIDE
DELETE TOOLPATH $THName
//生成底部部参考线
CREATE FOLDER "Toolpath" "MyFolderBottom"
ACTIVATE FOLDER #
CALL Swarf(str,offset,'bottom',THName)
EDIT PATTERN $PName INSERT TOOLPATH ;
EDIT TOOLPATH DIVIDE TYPE RETRACT
PROCESS TPDIVIDE
DELETE TOOLPATH $THName
//取刀路参数
FOREACH TH1 IN FOLDER('Toolpath\MyFolderTop') {
REAL X1=ENTITY('Toolpath',TH1.Name).StartPoint.Position.X
REAL Y1=ENTITY('Toolpath',TH1.Name).StartPoint.Position.Y
REAL Z1=ENTITY('Toolpath',TH1.Name).StartPoint.Position.Z-ENTITY('Toolpath',TH1.Name).StartPoint.Distance
REAL X11=ENTITY('Toolpath',TH1.Name).EndPoint.Position.X
REAL Y11=ENTITY('Toolpath',TH1.Name).EndPoint.Position.Y
REAL Z11=ENTITY('Toolpath',TH1.Name).EndPoint.Position.Z-ENTITY('Toolpath',TH1.Name).EndPoint.Distance
FOREACH TH2 IN FOLDER('Toolpath\MyFolderBottom') {
REAL X2=ENTITY('Toolpath',TH2.Name).StartPoint.Position.X
REAL Y2=ENTITY('Toolpath',TH2.Name).StartPoint.Position.Y
REAL Z2=ENTITY('Toolpath',TH2.Name).StartPoint.Position.Z-ENTITY('Toolpath',TH2.Name).StartPoint.Distance
REAL X22=ENTITY('Toolpath',TH2.Name).EndPoint.Position.X
REAL Y22=ENTITY('Toolpath',TH2.Name).EndPoint.Position.Y
REAL Z22=ENTITY('Toolpath',TH2.Name).EndPoint.Position.Z-ENTITY('Toolpath',TH2.Name).EndPoint.Distance
IF ABS(X1-X2)<1 AND ABS(Y1-Y2)<1 {
EDIT PATTERN $PName INSERT SKETCH
ABSOLUTE
XYPLANE
X $X1
Y $Y1
Z $Z1
ADD
X $X2
Y $Y2
Z $Z2
ADD
END
X $X11
Y $Y11
Z $Z11
ADD
X $X22
Y $Y22
Z $Z22
ADD
END
QUIT SSKETCHER ACCEPT
CONTINUE
} ELSEIF ABS(X1-X22)<1 AND ABS(Y1-Y22)<1 {
EDIT PATTERN $PName INSERT SKETCH
ABSOLUTE
XYPLANE
X $X1
Y $Y1
Z $Z1
ADD
X $X22
Y $Y22
Z $Z22
ADD
END
X $X11
Y $Y11
Z $Z11
ADD
X $X2
Y $Y2
Z $Z2
ADD
END
QUIT SSKETCHER ACCEPT
CONTINUE
} ELSE {
CONTINUE
}
}
}
EDIT PATTERN $PName MERGE
CREATE BOUNDARY ; SKETCH \r EDIT BOUNDARY ; INSERT PATTERN ;
DELETE TOOLPATH FOLDER "Toolpath\MyFolderTop"
DELETE TOOLPATH FOLDER "Toolpath\MyFolderBottom"
EDIT RECYCLER DELETE Toolpath ALL
DIALOGS MESSAGE ON
DIALOGS ERROR ON
GRAPHICS UNLOCK
}
|
-
a.png
(251.14 KB, 下载次数: 363)
评分
-
查看全部评分
版权声明 |
|
本人声明此帖为本人原创帖,未经允许,不得转载!
|
|