! TITLE: lug_flat.mac (MISC_PART) ! ! ! OBJECTIVE: ! ! This sub-macro creates a flat, circular-end bolt lug as a miscellaneous ! part. ! ! ! COMMAND SYNTAX: ! ! (1) (2) (3) (4) (5) (6) (7) ! LUG_FLAT, lug_cs, r_out, thick, d_hole, lug_leng, angle, end_leng ! ! ! ARGUMENTS: ! ! (1) lug_cs = the coordinate system to create lug relative to. ! ! (2) r_out = outer radius of the lug surface. ! ! (3) thick = thickness (length) of the lug. ! ! (4) d_hole = center hole (shaft) diameter. If left blank (0), ! the lug is created with no center hole. ! ! (5) lug_leng = length of the lug, as measured from the hole/radius ! center to the straight/flat lug end. ! ! (6) angle = angle between the 2 opposite straight sides intersecting ! the circular profile. Default is 0 (parallel sides). ! [This argument will be ignored if END_LENG ! (argument 7) is specified.] ! ! (7) end_leng = length of the straight/flat end of the lug, located ! a distance specified in LUG_LENG (argument 5). ! [If this argument is specified, then the angle ! specified in argument 6 is ignored.] ! ! ! DESCRIPTION: ! ! The lug is a flat plate with thickness, where the plate is a circular ! profile intersecting a rectangular section. The end of the rectangular ! section is conected to a mounting surface, thereby supporting the bolted ! lug hole. ! ! The lug profile is created with the hole and/or lug-surface radius axis ! along the Z-axis, with one surface coplanar to the XY-plane of the specified ! coordinate system. The length of the lug is measured form the hole/radius ! center, along the +Y-axis. The thickness of the lug is extruded along the ! +Z-axis. If it is desired to extrude in the -Z-axis direction, simply ! place a minus sign in front of the value of argument 3 (thick). ! ! If the hole diameter (argument 4) is not specified, the lug is created ! with no center hole. If the thickness (argument 3) is not specified, the ! lug is created as an area (no thickness). ! ! To view a lug created from this macro, run the following example lines ! of code (must execute 'mod_assemb_prep' prior to running): ! ! LUG_FLAT,0,1.0,0.25,1.2,4,30, ! ! LUG_FLAT,0,1.0,-0.35,1.2,4,,5.0 ! ! LUG_FLAT,0,1.0,0.45,1.2,4,, ! ! ! *get,prkey_,active,0,prkey /nopr ! *get,actvcs_,active,,csys ! lugcs_=arg1 rout_=arg2 thk_=arg3 dhole_=arg4 leng_=arg5 lugang_=arg6 endleng_=arg7 ! csys,lugcs_ ! *get,ccstyp_,cdsy,lugcs_,attr,kcs ! *if,ccstyp_,ne,0,then create_cs,0,,0,0,0,0,0,0,0 *endif ! *if,endleng_,gt,0,then *if,(endleng_/2),gt,rout_,then h__=sqrt((endleng_/2)**2+leng_**2) beta_=atan((endleng_/2)/leng_)*dconv gamma_=acos(rout_/h__)*dconv lugang_=2*(beta_+gamma_-90) *else lugang_=0 *endif ! *set,h__, *set,beta_, *set,gamma_, *endif ! a___=leng_/(tan((90-(lugang_/2))*rconv)) b___=rout_*cos((lugang_/2)*rconv) c___=sqrt((rout_**2)-(b___**2)) m___=rout_/(sin((90-(lugang_/2))*rconv)) ! k,,b___,-c___,0 k,,m___+a___,leng_,0 k,,-(m___+a___),leng_,0 k,,-b___,-c___,0 k,,0,0,0 ! create_area ! create_cs,0,,1,0,0,0,180,0,0 l,km-1,km-4 init_entity_num al,lm-2,lm-1,lm init_entity_num ! aadd,am-1,am init_entity_num ! *if,dhole_,gt,0,then create_circ_area,dhole_/2,0 ! asba,am-1,am,,delete,delete init_entity_num *endif ! *if,thk_,ne,0,then asel,s,area,,am extrude_aset,thk_ *endif ! init_entity_num ! csys,actvcs_ ! aplot ! *set,lugcs_, *set,rout_, *set,thk_, *set,dhole_, *set,leng_, *set,ccstyp_, *set,actvcs_, *set,lugang_, *set,endleng_, *set,a___, *set,b___, *set,c___, *set,m___, ! *if,prkey_,eq,1,then /go *endif