标题: 哪位大哥给个垂直面边界宏 [打印本页] 作者: 王梦恩恩 时间: 2023-5-16 12:19 标题: 哪位大哥给个垂直面边界宏 垂直面边界宏 !作者: bc123456 时间: 2023-5-16 14:30
MACRO STOP DIALOGS MESSAGE OFF DIALOGS ERROR OFF ECHO OFF DCPDEBUG UNTRACE COMMAND ACCEPT TOOLBAR COMMANDBAR LOWER
STRING yl= "请输入加工余量"
real q= ""
$q= input $yl
real qd= q-0.01
real qdi= q+0.01
STRING ToolName = INPUT ENTITY TOOL "选择当前刀具"
ACTIVATE TOOL $ToolName
EDIT ENTATTRIBUTE TEMPLATE FOLDER TOOLPATH
'xu顶'
CREATE FOLDER "Toolpath" ;
ACTIVATE FOLDER #
EDIT ENTATTRIBUTE TEMPLATE FOLDER TOOLPATH OFF
IMPORT TEMPLATE ENTITY TOOLPATH "Finishing/Swarf-Finishing.ptf"
EDIT TPPAGE SWBlock
EDIT BLOCK ALL UNLOCK
EDIT BLOCK RESETLIMIT "100"
EDIT BLOCK RESET
EDIT TPPAGE SWPatternSwarf
EDIT PAR 'Tolerance' "0.01"
EDIT PAR 'CutDirection' 'climb'
EDIT PAR 'UseAxialThickness' '1'
EDIT PAR 'Thickness' $qd
EDIT PAR 'AxialThickness' "0.01"
EDIT TPPAGE SWPosition
EDIT PAR 'SwarfBasePosition' 'top'
EDIT TPPAGE SWMultiCutSwarf
EDIT PAR 'MultipleCuts' 'off'
EDIT PAR 'Ordering' 'pocket'
EDIT PAR 'UpperLimit.Type' 'top'
EDIT TPPAGE SWHighSpeed
EDIT PAR 'CornerRadius.Active' '1'
EDIT PAR 'CornerRadius.Active' '0'
EDIT PAR 'AxialSmoothingTolerance' "0"
EDIT TPPAGE SWToolRapidMv
EDIT TOOLPATH SAFEAREA SIZE "0"
EDIT TOOLPATH SAFEAREA PLUNGE_SIZE "0"
EDIT TPPAGE SWLeadsLinks
EDIT TOOLPATH LEADS PAGE ZHEIGHTS
EDIT TOOLPATH LEADS SKIMDIST "3"
EDIT TOOLPATH LEADS PLUNGEDIST "1"
EDIT TOOLPATH LEADS PAGE LEADIN
EDIT TOOLPATH LEADS LEADIN NONE
EDIT TOOLPATH LEADS LEADIN2 NONE
EDIT TOOLPATH LEADS LEADOUT COPY
EDIT TOOLPATH LEADS PAGE LINK
EDIT TOOLPATH LEADS LINK THRESHOLD "1"
EDIT TOOLPATH LEADS LINK SAFEZ
EDIT TOOLPATH LEADS LONGLINK SAFEZ
EDIT TOOLPATH LEADS SAFELINK SAFEZ
PROCESS TPLEADS
LEADS ACCEPT
EDIT TPPAGE SWSEPtSPoint
EDIT TOOLPATH START TYPE POINT
EDIT TPPAGE SWSEPtEPoint
EDIT TOOLPATH END TYPE POINT
EDIT TOOLPATH ; CALCULATE
string ding = toolpath.name
IF toolpath.Computed ==0 {
DELETE TOOLPATH FOLDER "Toolpath\xu顶1"
return
}
CREATE PATTERN ;
EDIT PATTERN ; INSERT TOOLPATH ;
EDIT TOOLPATH DIVIDE TYPE RETRACT
PROCESS TPDIVIDE
DELETE TOOLPATH $ding
////////////////
EDIT ENTATTRIBUTE TEMPLATE FOLDER TOOLPATH
'xu底'
CREATE FOLDER "Toolpath" ;
ACTIVATE FOLDER #
EDIT ENTATTRIBUTE TEMPLATE FOLDER TOOLPATH OFF
IMPORT TEMPLATE ENTITY TOOLPATH "Finishing/Swarf-Finishing.ptf"
EDIT TPPAGE SWBlock
EDIT BLOCK ALL UNLOCK
EDIT BLOCK RESETLIMIT "100"
EDIT BLOCK RESET
EDIT TPPAGE SWPatternSwarf
EDIT PAR 'Tolerance' "0.01"
EDIT PAR 'CutDirection' 'climb'
EDIT PAR 'UseAxialThickness' '1'
EDIT PAR 'Thickness' $qdi
EDIT PAR 'AxialThickness' "0"
EDIT TPPAGE SWPosition
EDIT PAR 'SwarfBasePosition' 'bottom'
EDIT TPPAGE SWMultiCutSwarf
EDIT PAR 'MultipleCuts' 'off'
EDIT PAR 'Ordering' 'pocket'
EDIT PAR 'SwarfBasePosition' 'bottom'
EDIT TPPAGE SWHighSpeed
EDIT PAR 'CornerRadius.Active' '1'
EDIT PAR 'CornerRadius.Active' '0'
EDIT PAR 'AxialSmoothingTolerance' "0"
EDIT TPPAGE SWToolRapidMv
EDIT TOOLPATH SAFEAREA SIZE "0"
EDIT TOOLPATH SAFEAREA PLUNGE_SIZE "0"
EDIT TPPAGE SWLeadsLinks
EDIT TOOLPATH LEADS PAGE ZHEIGHTS
EDIT TOOLPATH LEADS SKIMDIST "3"
EDIT TOOLPATH LEADS PLUNGEDIST "1"
EDIT TOOLPATH LEADS PAGE LEADIN
EDIT TOOLPATH LEADS LEADIN NONE
EDIT TOOLPATH LEADS LEADIN2 NONE
EDIT TOOLPATH LEADS LEADOUT COPY
EDIT TOOLPATH LEADS PAGE LINK
EDIT TOOLPATH LEADS LINK THRESHOLD "1"
EDIT TOOLPATH LEADS LINK SAFEZ
EDIT TOOLPATH LEADS LONGLINK SAFEZ
EDIT TOOLPATH LEADS SAFELINK SAFEZ
PROCESS TPLEADS
LEADS ACCEPT
EDIT TPPAGE SWSEPtSPoint
EDIT TOOLPATH START TYPE POINT
EDIT TPPAGE SWSEPtEPoint
EDIT TOOLPATH END TYPE POINT
EDIT TOOLPATH ; CALCULATE
string di = toolpath.name
IF toolpath.Computed ==0 {
DELETE TOOLPATH FOLDER "Toolpath\xu顶1"
DELETE TOOLPATH FOLDER "Toolpath\xu底1"
return
}
EDIT PATTERN ; INSERT TOOLPATH ;
EDIT TOOLPATH DIVIDE TYPE RETRACT
PROCESS TPDIVIDE
DELETE TOOLPATH $di
string pat = entity('pattern','').Name
FOREACH tp IN folder('Toolpath\xu顶1') {
int xs = entity('toolpath',$tp.name).StartPoint.Position.X
int ys = entity('toolpath',$tp.name).StartPoint.Position.Y
real xst = entity('toolpath',$tp.name).StartPoint.Position.X
real yst = entity('toolpath',$tp.name).StartPoint.Position.Y
real zst = entity('toolpath',$tp.name).StartPoint.Position.Z-entity('toolpath',$tp.name).StartPoint.Distance
real xnd = entity('toolpath',$tp.name).EndPoint.Position.X
real ynd = entity('toolpath',$tp.name).EndPoint.Position.Y
real znd = entity('toolpath',$tp.name).EndPoint.Position.Z-entity('toolpath',$tp.name).EndPoint.Distance
FOREACH dtp IN folder('Toolpath\xu底1') {
int xs1 = entity('toolpath',$dtp.name).StartPoint.Position.X
int ys1 = entity('toolpath',$dtp.name).StartPoint.Position.Y
real xst1 = entity('toolpath',$dtp.name).StartPoint.Position.X
real yst1 = entity('toolpath',$dtp.name).StartPoint.Position.Y
real zst1 = entity('toolpath',$dtp.name).StartPoint.Position.Z-entity('toolpath',$dtp.name).StartPoint.Distance
real xnd1 = entity('toolpath',$dtp.name).EndPoint.Position.X
real ynd1 = entity('toolpath',$dtp.name).EndPoint.Position.Y
real znd1 = entity('toolpath',$dtp.name).EndPoint.Position.Z-entity('toolpath',$dtp.name).EndPoint.Distance
if xs==xs1 and ys==ys1 {
EDIT PATTERN ; INSERT SKETCH
ABSOLUTE
XYPLANE
X $xst
Y $yst
Z $zst
ADD
X $xst1
Y $yst1
Z $zst1
ADD
QUIT SSKETCHER ACCEPT
EDIT PATTERN ; INSERT SKETCH
ABSOLUTE
XYPLANE
X $xnd
Y $ynd
Z $znd
ADD
X $xnd1
Y $ynd1
Z $znd1
ADD
QUIT SSKETCHER ACCEPT
}
}
}
CREATE BOUNDARY ; SKETCH
EDIT BOUNDARY ; INSERT PATTERN ;
DELETE PATTERN ;
DELETE TOOLPATH FOLDER "Toolpath\xu顶1"
DELETE TOOLPATH FOLDER "Toolpath\xu底1"
EDIT TOOLPATH START TYPE POINT_SAFE
EDIT TOOLPATH END TYPE POINT_SAFE
GRAPHICS UNLOCK
DIALOGS MESSAGE ON
DIALOGS ERROR ON