! TITLE: entity_file.mac (MANAGEMENT) ! ! ! ! This sub-macro stores a selected set of solid modeling entities in an ! array of a user specified name. The entity is filed away by its centroid ! coordinates, X, Y and Z. Therefore, the entity may change number, but can ! be selected by its centroidal center. ! ! The following choice of entities are: ! ! ENTITY ! -------- ! keypoint ! line ! area ! volume ! ! Input for this macro are: ! ! 1.) A selected set of specified entities ! ! 2.) entity = 'k' for keypoint entities ! 'l' for line entities ! 'a' for area entities ! 'v' for volume entities ! ! 3.) aname = character name for array ! ! 4.) use_decn = use decision. This parameter allows the user ! to decide whether to calculate the centroid ! for individual entities or a group of entities. ! ! 0 (or blank) = individual ! 1 = group ! ! ** NOTE: If use_decn = 1, then no arrays will be ! returned, and therefore 'aname' may be ! left blank. ! ! The parameter 'arg_decn' is used to decide whether the argument 'default' ! is to be used on the entity summary commands, 'ksum', 'asum', 'lsum' and ! 'vsum', since 'ksum' and 'lsum' do not have arguments. ! ! Output for this macro: ! ! 1.) An array of the user specified name containing the centroid ! triplets, X, Y and Z. ! ! ****** OR ****** ! ! 2.) The centroid coordinate values of the respective selected ! entities: ! ! K_X_CNT, K_Y_CNT, K_Z_CNT ---> keypoints ! ! L_X_CNT, L_Y_CNT, L_Z_CNT ---> lines ! ! A_X_CNT, A_Y_CNT, A_Z_CNT ---> areas ! ! V_X_CNT, V_Y_CNT, V_Z_CNT ---> volumes ! ! ! ! ENTITY_FILE, entity, aname, use_decn ! ! ! *get,prkey_,active,0,prkey /nopr entity1=arg1 anam1=arg2 use_decn=arg3 ! ! *if,entity1,eq,'k',then ev1='kp' argdecn=0 sum_parm='ksum' *elseif,entity1,eq,'l',then ev1='line' argdecn=0 sum_parm='lsum' *elseif,entity1,eq,'a',then ev1='area' argdecn=1 sum_parm='asum' *elseif,entity1,eq,'v',then ev1='volu' argdecn=1 ! argument decision parameter sum_parm='vsum' *else ev1='z' ! If entity is not a 'k','l','a','v','n' *endif ! or 'e' then assign 'ev1' the dummy variable 'z'. ! ! *if,ev1,ne,'z',then ! If ev1 is assigned 'z', then abort ! *if,use_decn,eq,0,then ! entity_array,'%entity1%','%entity1%_set','array' ! *dim,%anam1%,array,ecount+1,3 ! Initialize array ! ! %anam1%(1,1,1)=ecount+1 ! *do,iii,2,ecount+1,1 ! %entity1%sel,s,ev1,,%entity1%_set(iii-1,1) ! *if,argdecn,eq,1,then %sum_parm%,default *else %sum_parm% *endif ! *get,%entity1%_x_cnt,ev1,,cent,x *get,%entity1%_y_cnt,ev1,,cent,y *get,%entity1%_z_cnt,ev1,,cent,z ! %anam1%(iii,1,1)=%entity1%_x_cnt %anam1%(iii,2,1)=%entity1%_y_cnt %anam1%(iii,3,1)=%entity1%_z_cnt *enddo ! ! *else *if,argdecn,eq,1,then %sum_parm%,default *else %sum_parm% *endif ! *get,%entity1%_x_cnt,ev1,,cent,x *get,%entity1%_y_cnt,ev1,,cent,y *get,%entity1%_z_cnt,ev1,,cent,z *endif *endif ! init_entity_num ! lplot ! *if,use_decn,eq,0,then *set,%entity1%_x_cnt, *set,%entity1%_y_cnt, *set,%entity1%_z_cnt, *set,%entity1%_set(1), *endif ! *set,iii, *set,ev1, *set,anam1, *set,entity1, *set,use_decn, *set,argdecn, *set,sum_parm, *if,prkey_,eq,1,then /go *endif