! TITLE: tangent_area.mac (SM_TOOL) ! ! ! OBJECTIVE: ! ! This sub-macro creates an area consisting of two circular ends joined ! between by a section tangent to the circular ends. ! ! ! COMMAND SYNTAX: ! ! (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) ! TANGENT_AREA, acs, r1, x1, y1, r2, x2, y2, z_pos, r_fil, d1, d2 ! ! n_arc, st_ang ! (12) (13) ! ! ! ARGUMENTS: ! ! (1) acs = active coordinate system (CS). ! ! (2) r1 = radius of 1st circular end of the area. ! ! (3) x1 = X-coordinate of the center of the 1st circular end. ! ! (4) y1 = Y-coordinate of the center of the 1st circular end. ! ! (5) r2 = radius of 2nd end of the area. ! ! (6) x2 = X-coordinate of the center of the 2nd circular end. ! ! (7) y2 = Y-coordinate of the center of the 2nd circular end. ! ! (8) z_pos = Z-coordinate of the plane of the area. ! ! (9) r_fil = radius of the fillet tangent ot circular ends. ! ! (10) d1 = diameter of hole at 1st circular end radius. ! ! (11) d2 = diameter of hole at 2nd circular end radius. ! ! (12) n_arc = The number of equal arc increments that the holes ! (arguments 10 and 11) are constructed from. ! [ Defaults to 4 arcs ] ! ! (13) st_ang = The start angle of the first arc used in the ! construction of the holes (arguments 10 and 11). ! [ Defaults to 0 degrees ] ! ! ! DESCRIPTION: ! ! The area has 2 circular ends that form an oval, with the exception ! that the ends of the oval have unequal radius, thereby resulting in a ! cam-lobe shaped area. ! ! If desired, a fillet region tangent to both circular ends may be used to ! join the circular ends. This may be done by specifying the fillet radius ! between them in argument 9. ! ! The area will be formed in a plane normal to the Z axis of the specified ! active CS (parallel to the XY-plane of the specified CS), with cartesian ! coordinates of the centers of the circular ends specified in arguments 2 ! through 8. The specified CS may be any type. ! ! If circular holes are desired at the centers of each circular end, then ! simply specifying the hole diameters at one or both ends will create the ! holes (arguments 10 and 11). If either or both are left blank, then no ! hole will be created at the blank arguments. ! ! The holes may be constructed from a variuos number of arc increments. The ! number of arc increments may be specified in argument 12, and the start ! angle of the first point of the arcs may be specified in argument 13. If ! they are left blank, then the holes will be constructed from 4 90-degree ! arcs starting at 0 degrees (as measured from a line through the hole ! centers). ! ! EXAMPLES: (execute 'mod_assemb_prep' prior to running each): ! ! TANGENT_AREA,0,3,1,1,1,5,3,0 ! ! TANGENT_AREA,0,3,1,1,2,5,3,0,,4,1 ! ! TANGENT_AREA,1,3,1,1,2,7,3,1,5 ! ! TANGENT_AREA,1,3,1,1,2,-7,3,1,5,4,2 ! ! TANGENT_AREA,1,3,1,1,2,-7,-4,1,5,4,2 ! ! ! *get,prkey_,active,0,prkey /nopr ! configuration,0,1 ! acs__=arg1 r1__=arg2 x1__=arg3 y1__=arg4 r2__=arg5 x2__=arg6 y2__=arg7 zpos__=arg8 rfil__=arg9 d1__=ar10 d2__=ar11 narc__=ar12 stang__=ar13 ! *if,r2__,gt,r1__,then rhold_=r2__ xhold_=x2__ yhold_=y2__ dhold_=d2__ ! r2__=r1__ r1__=rhold_ ! x2__=x1__ x1__=xhold_ ! y2__=y1__ y1__=yhold_ ! d2__=d1__ d1__=dhold_ ! *set,rhold_ *set,xhold_ *set,yhold_ *set,dhold_ *endif ! dx_=x2__-x1__ dy_=y2__-y1__ ! d__=sqrt((dx_**2)+(dy_**2)) l__=sqrt((d__**2)-((r1__-r2__)**2)) ! alpha__=(asin(l__/d__))*r2d_conv ! *if,dy_,gt,0,and,dx_,gt,0,then gamma__=(atan(dy_/dx_))*r2d_conv *elseif,dy_,lt,0,and,dx_,gt,0,then gamma__=360+((atan(dy_/dx_))*r2d_conv) *elseif,dy_,lt,0,and,dx_,lt,0,then gamma__=180+((atan(dy_/dx_))*r2d_conv) *elseif,dy_,gt,0,and,dx_,lt,0,then gamma__=180+((atan(dy_/dx_))*r2d_conv) *endif ! csys,acs__ clocal,csn+1000,0,0,0,0,0,0,0 acs__=csn+1000 ! clocal,csn+1001,1,x1__,y1__,zpos__,gamma__,0,0 cscntr1_=csn+1001 ! csys,acs__ clocal,csn+1002,1,x2__,y2__,zpos__,gamma__,0,0 cscntr2_=csn+1002 ! csys,cscntr1_ create_circ_area,r1__,,,3,0 ! csys,cscntr2_ create_circ_area,r2__,,,3,60 ! *if,rfil__,eq,0,then csys,cscntr1_ k,,r1__,-alpha__,0 ! csys,cscntr2_ k,,r2__,-alpha__,0 k,,r2__,alpha__,0 ! csys,cscntr1_ k,,r1__,alpha__,0 ! create_area ! isolate_areas configuration,-1,1 a_add *elseif,rfil__,gt,0,then a__=r2__+rfil__ b__=r1__+rfil__ c__=d__ ! alpha1__=(acos(((b__**2)+(c__**2)-(a__**2))/(2*b__*c__)))*r2d_conv alpha2__=(acos(((a__**2)+(c__**2)-(b__**2))/(2*a__*c__)))*r2d_conv alpha3__=(acos(((a__**2)+(b__**2)-(c__**2))/(2*a__*b__)))*r2d_conv ! csys,cscntr1_ k,,r1__,-alpha1__,0 ! csys,cscntr2_ k,,r2__,180+alpha2__,0 k,,r2__,180-alpha2__,0 ! csys,cscntr1_ k,,r1__,alpha1__,0 ! create_area ! isolate_areas configuration,-1,1 a_add ! csys,cscntr1_ clocal,csn+1003,1,b__,alpha1__,0,-alpha1__-(alpha3__/2),0,0 wedge,csn+1003,rfil__,0,,ky(km),ky(km-1) ! csys,CScntr1_ clocal,csn+1004,1,b__,-alpha1__,0,alpha1__+(alpha3__/2),0,0 wedge,csn+1004,rfil__,0,,ky(km-6),ky(km-5) ! asel,s,area,,am-1,am cm,asubtr_,area ! isolate_areas configuration,-1,1 a_sub_a,am-2,'asubtr_' ! csdele,csn+1003,csn+1004,1 ! *set,a__, *set,b__, *set,c__, *set,alpha1__, *set,alpha2__, *set,alpha3__, *endif ! *if,d1__,gt,0,then csys,cscntr1_ create_circ_area,d1__/2,,,narc__,stang__ a_sub_a,am-1,am *endif ! *if,d2__,gt,0,then csys,cscntr2_ create_circ_area,d2__/2,,,narc__,stang__ a_sub_a,am-1,am *endif ! csdele,csn+1000,csn+1002,1 ! configuration,1,1 init_entity_num ! aplot ! *set,acs__, *set,r1__, *set,x1__, *set,y1__, *set,r2__, *set,x2__, *set,y2__, *set,zpos__, *set,rfil__, *set,gamma__, *set,dx_, *set,dy_, *set,d__, *set,l__, *set,filcs__, *set,d1__, *set,d2__, *set,cscntr1_, *set,cscntr2_, *set,narc__, *set,stang__, ! *if,prkey_,eq,1,then /go *endif