! 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. ! ! Added capability for creating a chamfer between 2 lines that are ! not orthogonal and/or may be curved. ! ! OBJECTIVE: ! ! This command macro creates a chamfer at the intersetion of 2 coplanar ! lines. ! ! ! COMMAND SYNTAX: ! ! * OPTION = 1: ! ! (1) (2) (3) (4) (5) ! CHAMFER_AREA, opt, line#1, line#2, chmfdim1, chmfdim2 ! ! -------------------------------------------------------------- ! * OPTION = 2: ! ! (1) (2) (3) (4) (5) (6) ! CHAMFER_AREA, opt, line#1, line#2, chmfdim, chmfang1, chmfang2 ! ! ! ARGUMENTS: ! ! (1) opt = options 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 ! ! (2) line#1 = 1st line of the chamfered corner ! ! (3) line#2 = 2nd line of the chamfered corner ! ! OPTION = 1: ! ! (4) chmfdim1 = chamfer dimension along LINE#1 ! ! (5) chmfdim2 = chamfer dimension along LINE#2 ! ! OPTION = 2: ! ! (4) chmfdim = a distance along one of the specified lines, ! as determined by the specification of either ! CHMFANG1 or CHMFANG2. ! ! (5) chmfang1 = angle adjacent LINE#1 (Leave CHMFANG2 blank) ! ! (6) chmfang2 = angle adjacent LINE#2 (Leave CHMFANG1 blank) ! ! ! DESCRIPTION: ! ! A chamfer is created at the intersetion of two lines; line#1 and line#2. ! The lines may be straight or curved, with any intersection angle between ! 0 and 180 degrees. The chamfer is created coplanar (area) with both ! original lines. Therefore, the original linesmust not be 3D space curves. ! ! This macro gives 2 options for creating the chamfer: ! ! (opt=1) - creates the chamfer by specifying the distance along ! each lines. The chamfer dimensions, CHMFDIM1 and CHMFDIM2 ! are the dimensions of the chamfer along lines, LINE#1 and ! LINE#2, respectively. ! ! If CHMFDIM2 is left blank, then CHMFDIM2 is assumed to be ! the same as CHMFDIM1, leading to a 45 degree chamfer for ! orthogonal, intersecting lines; and equal chamfer-angles ! at the intersection of non-orhtogonal lines. ! ! (opt=2) - creates the chamfer by specifying a distance along one of ! the lines, and the angle adjacent to that line. (Specify ! only one angle, CHMFANG1 or CHMFANG2, not both). ! ! If the 1st angle, CHMFANG1, is specified, the distance, ! CHMFDIM, is the distance along LINE#1, where CHMFANG1 is ! the angle adjacent to LINE#1. ! ! If the 2nd angle, CHMFANG2, is specified, the distance, ! CHMFDIM, is the distance along LINE#2, where CHMFANG2 is ! the angle adjacent to LINE#2. ! ! *get,prkey_,active,0,prkey /nopr ! opt_=arg1 ! ! *if,opt_,eq,1,then ln1_=arg2 ln2_=arg3 chmfdim1=arg4 chmfdim2=arg5 ! *if,chmfdim2,eq,0,then ! If line 2 chamfer dimension is unspecified, chmfdim2=chmfdim1 ! then it is defaulted as equal to line 1 *endif ! chamfer dimension. *endif ! ! *if,opt_,eq,2,then ln1_=arg2 ln2_=arg3 chmfdim=arg4 chmfang1=arg5 ! *if,chmfang1,eq,0,then lnchk=2 chmfang2=arg6 chmfang1=90-chmfang2 *elseif,chmfang1,ne,0,then lnchk=1 chmfang2=90-chmfang1 *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 ! ! *get,k11,line,ln1_,kp,1 ! k11 = keypoint 1 of line #1 *get,k12,line,ln1_,kp,2 ! k12 = keypoint 2 of line #1 ! *get,k21,line,ln2_,kp,1 ! k21 = keypoint 1 of line #2 *get,k22,line,ln2_,kp,2 ! k22 = keypoint 2 of line #2 ! ! *get,ln1_lng,line,ln1_,leng ! retrieve length of line #1 *get,ln2_lng,line,ln2_,leng ! retrieve length of line #2 ! ! *if,k11,eq,k21,then ikp=k11 create_cs,1,'chmfcs',0,k11,k12,k22 ang_lns=(anglek(k11,k12,k22))*dconv *elseif,k11,eq,k22,then ikp=k11 create_cs,1,'chmfcs',0,k11,k12,k21 ang_lns=(anglek(k11,k12,k21))*dconv *elseif,k12,eq,k21,then ikp=k12 create_cs,1,'chmfcs',0,k12,k11,k22 ang_lns=(anglek(k12,k11,k22))*dconv *elseif,k12,eq,k22,then ikp=k12 create_cs,1,'chmfcs',0,k12,k11,k21 ang_lns=(anglek(k12,k11,k21))*dconv *endif ! *if,ang_lns,eq,90,then ! ! k,,chmfdim1,0,0 k,,0,chmfdim2,0 create_lines ! ! lsel,s,line,,ln1_ ! Partition lines at their intersetions lsel,a,line,,ln2_ lsel,a,line,,lm ln_part_ln,lm ! lstr,km-1,km ! Create new chamfer line ! ksel,s,kp,,ikp ! Select all lines attached to IKP and delete lslk,s,0 ! lines and IKP. ldele,all,,,1 init_entity_num ! ! *else *if,k11,eq,k21,then dir_ln1=1 dir_ln2=1 *elseif,k11,eq,k22,then dir_ln1=1 dir_ln2=-1 *elseif,k12,eq,k21,then dir_ln1=-1 dir_ln2=1 *elseif,k12,eq,k22,then dir_ln1=-1 dir_ln2=-1 *endif ! kl,dir_ln1*ln1_,chmfdim1/ln1_lng kl,dir_ln2*ln2_,chmfdim2/ln2_lng ! ln_series ! lglue,ln1_,ln2_,lm ! ksel,s,kp,,ikp lslk,s,0 ldele,all,,,1 ! init_entity_num ! *set,dir_ln1, *set,dir_ln2, *endif ! lplot ! *set,ikp, *set,k11, *set,k12, *set,k21, *set,k22, *set,ln1_, *set,ln2_, *set,chmfdim1, *set,chmfdim2, *set,chmfang1, *set,chmfang2, *set,lnchk, *set,chmfdim, *set,ln1_lng, *set,ln2_lng, *set,ang_lns, ! *if,prkey_,eq,1,then /go *endif