! TITLE: u_spe_poc_cut.mac (SM_TOOL) ! ! ! ! This sub-macro is used to create a more user specified pocket cut into ! a volume, where the pocket shape is inscribed within the selected area ! profile on the volume, utilizing a specified set of lines. This dif- ! fers from the 'pocket_cut' macro in that it allows for the creation of ! a controlled pocket shape such that the lines are parallel to a select- ! ed subset of the selected area lines. The pocket may then take on a ! simpler shape then the selected area. ! ! The distance between the parallel lines is either a constant, 'wall_thk', ! which is the thickness of the remaining wall after the operation is ! completed; or it may have a varying wall thickness, wall%i%, where i ! is the side line number. This results in a "hollwed-out" volume. The ! lines must be straight lines, i.e., no arc or splined lines. Be sure ! that the lines that choose to create form a closed path INSIDE of the ! selected area. A boolean operation may be performed that will erase ! an undesired portion of the volume. ! ! NOTE: The centroid of the selected area profile is assumed to be ! at or near the center of the selected area, and therefore ! within the confines of the area line loop. There can be an ! ill-formed area profile that WILL violate the intended ex- ! ecution of this macro. If the centroid is located outside ! of the loop, or any such location that will cause the dir- ! ection of any of the KP c.s.'s to be reversed, the boolean ! operation will fail to execute properly or at all. ! ! A general 'rule-of-thumb' is to choose areas that are close ! to a symmetric form around the centroid of area such that ! the centroid lies within the line loop. ! ! Input data necessary to run this macro: ! ! A selected area ! ! output from (in order): ! ! LN_ARRAY.MAC ! WALL_DIMN.MAC (if wall_thk is not specified) ! ! p1 = origin keypoint of 1st c.s., which is on 1st line, ln1. ! p2 = x axis keypoint, which establishes the extrude direction ! which is on the 1st line, ln1. Therefore, p1 and p2 are ! the endpoints of ln1. ! ! wall_thk = desired wall thickness (constant) ! If wall_thk is not specified, the user must ! specify all wall%i%, the wall thickness at each ! side of the pocket: ! ! NOTE: The wall thickness dimension corresponds ! to the line numbers in order: ! ! wall1 is the distance from ln1, ! wall2 is the distance from ln2, ! wall3 is the distance from ln3, ! . ! . ! . ! walln is the distance from lnn, ! ! dcut_n = depth of cut into volume (distance along a path ! normal to the surface) ! ! offset = boolean variable to choose either normal extrude ! or skewed extrude. Valid arguments: ! ! offset='normal' ! offset='skew' ! ! The following arguments are valid only when offset='skew'. If ! offset='normal', they need not be specified: ! ! dcut_s = depth of cut into volume (distance along the skew ! path) ! ! *NOTE: If dcut_s is left blank or 0, dcut_n will be ! used to calculate the skew path length. ! ! phi_xz = skew angle as measured from the -z axis, in the ! xz plane: ! ! phixz < 0: skew toward - x axis direction ! phixz > 0: skew toward + x axis direction ! ! phi_elev = skew angle as measured from xz plane to a line ! that connects the origin of p1cs to a point in ! space (y coordinate of point is not 0): ! ! phi_elev < 0: skew toward - y direction ! phi_elev > 0: skew toward + y direction ! ! The skew line direction is measured from a car- ! tesian c.s. that is centered at point p1, whose x ! axis is parrallel to the first selected line in ! ln_array.mac. This is the active c.s. that is used ! to measure phi_xz and phi_elev from. Therefore, ! phi_xz is measured from the -z axis, and phi_elev ! is measured from the xz plane of the newly formed c.s. ! (Note that this c.s. has its origin located at the ! minimum keypoint number of the new area profile to be ! extruded.) ! ! ! ! (1) (2) (3) (4) (5) (6) (7) (8) ! U_SPE_POC_CUT, p1, p2, wall_thk, offset, phi_xz, phi_elev, dcut_n, dcut_s ! ! *get,prkey_,active,0,prkey /nopr p1=arg1 p2=arg2 wall_thk=arg3 offset=arg4 phi_xz=arg5 phi_elev=arg6 dcut_n=arg7 dcut_s=arg8 ! !- A. - Create Volume, Area, Line, and Keypoint Sets for Operations ------ ! get_max_entity ! a2bcut=am ! area surface to be (2b) cut into (selected) ! csys,0 ! asum,default ! *get,pcx,area,,cent,x ! x, y and z location of area centroid *get,pcy,area,,cent,y *get,pcz,area,,cent,z ! k,,pcx,pcy,pcz ! place keypoint at centroid ! *get,pc,kp,,num,max ! assign parameter to centroid KP number ! p1od=p1 p2od=p2 ! lsel,selv,line,,lnarset ! select line set 1 from ln_array command ! ksll,selv ksel,a,kp,,pc cm,kset1,kp ! vsla,selv,0 ! select volume associated with a2bcut cm,vset1,volu ! !-- B. --- Create Path Direction for Correct Extrude Direction --------- ! init_entity_num ! asel,selv,area,,a2bcut ! select all entities of a2bcut lsel,selv,line,,lnarset ksel,selv,kp,,kset1 ! create_cs,1,'p1cs',0,p1od,p2od,pc ! k,,0,0,-1 ! create dummy keypoint *get,dkp,kp,,num,max ! !-- C. ------------------- Create Keypoint C.S.'s --------------------- ! init_entity_num ! asel,selv,area,,a2bcut ! select all entities of a2bcut lsel,selv,line,,lnarset ksel,selv,kp,,kset1 ! max_enty_dim,'l' ! retrieve MAX line length ! *do,ii,2,num_lns,1 ! lsel,selv,line,,ln(ii,1) ksll,selv ! *get,k1,kp,,num,min *get,k2,kp,,num,max ! ksel,a,kp,,pc ksel,a,kp,,dkp ! create_cs,1,'p%ii%cs',0,k1,k2,pc ! *if,kz(dkp),gt,0,then create_cs,1,'p%ii%cs',0,k2,k1,pc *endif ! asel,selv,area,,a2bcut lsel,selv,line,,lnarset ksel,selv,kp,,kset1 *enddo ! !-- D. --------------------- Create Area Profile ---------------------- ! *do,ii,1,num_lns,1 ! jj=ii+1 mm=ii-1 ! csys,p%ii%cs ! *if,wall_thk,eq,0,then k,,-3*max_leng,wall(ii,1),0 k,,3*max_leng,wall(ii,1),0 *else k,,-3*max_leng,wall_thk,0 k,,3*max_leng,wall_thk,0 *endif ! *get,km,kp,,num,max ! lstr,km,km-1 ! *if,jj,le,num_lns,then ! csys,p%jj%cs ! *if,wall_thk,eq,0,then k,,-3*max_leng,wall(jj,1),0 k,,3*max_leng,wall(jj,1),0 *else k,,-3*max_leng,wall_thk,0 k,,3*max_leng,wall_thk,0 *endif *else csys,p1cs ! *if,wall_thk,eq,0,then k,,-3*max_leng,wall(1,1),0 k,,3*max_leng,wall(1,1),0 *else k,,-3*max_leng,wall_thk,0 k,,3*max_leng,wall_thk,0 *endif *endif ! *get,km,kp,,num,max ! lstr,km,km-1 ! init_entity_num ! lsbl,lm-1,lm,,delete,delete ! init_entity_num ! p%ii%=km ! ldele,lm-1,lm,1 ! init_entity_num ! *if,ii,gt,1,then lstr,p%mm%,p%ii% *endif ! *if,ii,eq,num_lns,then lstr,p1,p%ii% *endif *enddo ! pdrgl=p1 ! point of origin for the drag line ! init_entity_num ! lsel,selv,line,,lm-(num_lns-1),lm ksll,selv ! al,all ! init_entity_num ! !-- E. ------------------ Perform Boolean Operation ------------------- ! *if,offset,eq,'normal',then ! voffst,am,-dcut_n ! init_entity_num ! vsbv,vset1,vm,,delete,delete ! init_entity_num ! lplot ! *elseif,offset,eq,'skew',then ! *if,dcut_s,eq,0,then ! x=dcut_n*tan(phi_xz*rconv) c=sqrt((dcut_n**2)+(x**2)) y=c*tan(phi_elev*rconv) z=dcut_n ! csys,p1cs ! create_cs,0,,0,kx(pdrgl),ky(pdrgl),kz(pdrgl),0,0,0 ! k,,x,y,-z ! init_entity_num ! lstr,pdrgl,km ! init_entity_num ! vdrag,am,,,,,,lm ldele,lm ! init_entity_num ! vsbv,vset1,vm,,delete,delete ! init_entity_num ! lplot *else y=dcut_s*sin(phi_elev*rconv) c=dcut_s*cos(phi_elev*rconv) x=c*sin(phi_xz*rconv) z=c*cos(phi_xz*rconv) ! csys,p1cs ! create_cs,0,,0,kx(pdrgl),ky(pdrgl),kz(pdrgl),0,0,0 ! k,,x,y,-z ! init_entity_num ! lstr,pdrgl,km ! init_entity_num ! vdrag,am,,,,,,lm ldele,lm ! init_entity_num ! vsbv,vset1,vm,,delete,delete ! init_entity_num ! lplot *endif *endif ! kdele,dkp ! init_entity_num ! lplot ! !-- E. ---------------------- Undefine Parameters --------------------- ! kdele,pc ! init_entity_num ! *do,ii,1,num_lns,1 csdele,p%ii%cs *set,p%ii%, *set,p%ii%cs, *enddo ! *if,wall_thk,eq,0,then *set,wall(1), *endif ! *set,ln(1), *set,pc, *set,pcx, *set,pcy, *set,pcz, *set,wall_thk, *set,offset, *set,dcut_s, *set,dcut_n, *set,phi_xz, *set,phi_elev, *set,ovr_dir, *set,pdrgl, *set,p1od, *set,p2od, *set,p1, *set,p2, *set,num_lns, *set,dkp, *if,prkey_,eq,1,then /go *endif