! TITLE: chamfer_area.mac (SM_TOOL) ! ! ! Added angle input capability (option 2). Added 'if-then' ! structure for opt=2 to the macro line code to accomodate ! the existing structure. ! ! ! This sub-macro creates a chamfer at the intersetion of two lines, ! line#1 and line#2. Their intersection MUST be a right angle. This ! chamfer is a planar (area) chamfer at the intersection of 2 lines. ! ! This macro gives 2 options for creating the chamfer. The first option ! (opt=1) creates the chamfer by specifying each distance along both lines. ! The chamfer dimensions, CHMFDIM1 and CHMFDIM2, are the dimensions ! of the chamfer along lines LINE#1 and LINE#2, respectively. Input for ! this macro: ! ! opt = option to create the chamfer. ! ! 1 = create chamfer by distance along both lines ! ! 2 = create chamfer by a distance along and an angle ! adjacent to one of the lines ! ! line#1 = 1st line to having chamfer length of CHMFDIM1 ! line#2 = 2nd line to having chamfer length of CHMFDIM2 ! ! chmfdim1 = chamfer dimension along line#1 ! chmfdim2 = chamfer dimension along line#2 ! ! chmfdim = a distance along one of the specified lines ! ! chmfang1 = angle adjacent to line#1 ! chmfang2 = angle adjacent to line#2 ! ! In option 1 (opt=1), if CHMFDIM2 is left blank, then CHMFDIM2 is assumed ! to be the same as CHMFDIM1, leading to a 45 degree chamfer. ! ! In the case where an angle is specified at a chamfer, the user may ! create the chamfer by specifying option 2 (opt=2). In this option, ! the two lines again must be specified, a distance along one of the sel- ! ected lines, and the angle adjacent to that line. The algorithm will ! then perform the necessary calculations to create the chamfer. If the ! first angle, CHMFANG1, is specified, then the distance CHMFDIM, is the ! distance along LINE#1, and CHMFANG1 is the angle adjacent to LINE#1. If ! the 2nd angle, CHMFANG2, is specified, then the distance, CHMFDIM, is ! the distance along LINE#2, and CHMFANG2 is the angle adjacent to LINE#2. ! ! ** NOTE: Specify ONLY 1 of the angles, not both. ! ! ! ! CHAMFER_AREA, opt, line#1, line#2, chmfdim1, chmfdim2 ! ! ! CHAMFER_AREA, opt, line#1, line#2, chmfdim, chmfang1, chmfang2 ! ! *get,prkey_,active,0,prkey /nopr opt=arg1 ! *if,opt,eq,1,then ln1=arg2 ln2=arg3 chmfdim1=arg4 chmfdim2=arg5 *endif ! *if,opt,eq,2,then ln1=arg2 ln2=arg3 chmfdim=arg4 chmfang1=arg5 *if,chmfang1,ne,0,then lnchk=1 chmfang2=90-chmfang1 *elseif,chmfang1,eq,0,then lnchk=2 chmfang2=arg6 chmfang1=90-chmfang2 *endif ! *if,lnchk,eq,1,then chmfdim1=chmfdim chmfdim2=chmfdim1*tan(chmfang1*rconv) *elseif,lnchk,eq,2,then chmfdim2=chmfdim chmfdim1=chmfdim2*tan(chmfang2*rconv) *endif *endif ! *if,opt,eq,1,then *if,chmfdim2,eq,0,then chmfdim2=chmfdim1 *endif *endif ! *get,k11,line,ln1,kp,1 *get,k12,line,ln1,kp,2 ! *get,k21,line,ln2,kp,1 *get,k22,line,ln2,kp,2 ! ! *if,k11,eq,k21,then ikp=k11 ! intersection KP of lines line#1 and line#2 create_cs,1,'chmfcs',0,k11,k12,k22 *elseif,k11,eq,k22,then ikp=k11 create_cs,1,'chmfcs',0,k11,k12,k21 *elseif,k12,eq,k21,then ikp=k12 create_cs,1,'chmfcs',0,k12,k11,k22 *elseif,k12,eq,k22,then ikp=k12 create_cs,1,'chmfcs',0,k12,k11,k21 *endif ! k,,chmfdim1,0,0 k,,0,chmfdim2,0 ! init_entity_num ! lstr,km-1,km ! init_entity_num ! lsel,s,line,,ln1 lsel,a,line,,ln2 lsel,a,line,,lm ! ln_part_ln,lm ! lstr,km-1,km ! init_entity_num ! *get,k1,line,lm-3,kp,1 *get,k2,line,lm-3,kp,2 ! *if,k1,eq,ikp,then ldele,lm-3,,,1 *elseif,k2,eq,ikp,then ldele,lm-3,,,1 *endif ! *get,k1,line,lm-2,kp,1 *get,k2,line,lm-2,kp,2 ! *if,k1,eq,ikp,then ldele,lm-2,,,1 *elseif,k2,eq,ikp,then ldele,lm-2,,,1 *endif ! *get,k1,line,lm-1,kp,1 *get,k2,line,lm-1,kp,2 ! *if,k1,eq,ikp,then ldele,lm-1,,,1 *elseif,k2,eq,ikp,then ldele,lm-1,,,1 *endif ! *get,k1,line,lm,kp,1 *get,k2,line,lm,kp,2 ! *if,k1,eq,ikp,then ldele,lm,,,1 *elseif,k2,eq,ikp,then ldele,lm,,,1 *endif ! init_entity_num ! *set,ikp, *set,k1, *set,k2, *set,k11, *set,k12, *set,k21, *set,k22, *set,ln1, *set,ln2, *set,chmfdim1, *set,chmfdim2, *set,chmfang1, *set,chmfang2, *set,lnchk, *set,chmfdim, *if,prkey_,eq,1,then /go *endif