! TITLE: vmat_attr.mac (SM_TOOL) ! ! ! OBJECTIVE: ! ! This sub-macro retrieves the material attributes of a selected set of ! volumes (1st execution), and reassigns them to the resulting volumes ! after performing a boolean operation (2nd execution). ! ! ! COMMAND SYNTAX: ! ! VMAT_ATTR ! ! ! DESCRIPTION: ! ! This macro is used in the event that a boolean operation is performed ! on a volume, or set of volumes, that have material attributes already ! assigned. It serves to automatically reassign those properties after ! the boolean operation without manually assigning. ! ! The material properties are extracted from the selected volumes and are ! stored for future retrieval. The resulting volumes, after the boolean ! operations, are reassigned the stored material attribute type. ! ! The proper use of this macros is as follows: ! ! Select volumes to be modified ! ! (1st execution): VMAT_ATTR ! ! (boolean operation command/macro): vsbv, cut_tool, etc. ! ! (2nd execution): VMAT_ATTR ! ! This macro must be executed prior to a boolean operation command or ! command macro, and then executed just after execution of boolean ! operation. ! ! If the selected volume set has more than one material type, this macro ! aborts and the volumes must be assigned manually. This macro may be used ! to restore material assignments on a single part volume(s) or within an ! assembly. ! ! ! *get,prkey_,active,0,prkey /nopr ! *if,mtretrv_,eq,0,then mtretrv_=1 *elseif,mtretrv_,eq,1,then mtretrv_=0 *elseif,mtretrv_,eq,-1,then mtretrv_=-1 *endif ! *if,mtretrv_,eq,1,then cm,CV001,volu ! entity_array,'v','vmatset_','array',1,,2,1 ! volu, mat numv_=ecount ! *do,abc_,1,numv_,1 init_entity_num,1 cm,CVassemb,volu cmsel,s,CV001 ! *get,vmat_,volu,vmatset_(abc_,1),attr,mat vmatset_(abc_,2)=vmat_ *enddo ! *if,numv_,gt,1,then *do,abc_,2,numv_,1 *do,xyz_,1,abc_-1,1 *if,vmatset_(abc_,2),ne,vmatset_(abc_-xyz_,2),then mtretrv_=-1 cmdele,CVassemb *exit *else vmat_=vmatset_(1,2) *endif *enddo *enddo *endif ! cmsel,s,CV001 *set,vmatset_(1), *elseif,mtretrv_,eq,0,then init_entity_num,1 cmsel,u,CVassemb vatt,vmat_ ! init_entity_num ! *set,vmat_, *set,mtretrv_, cmdele,CVassemb *elseif,mtretrv_,eq,-1,then *set,vmat_, *set,mtretrv_, *endif ! *set,abc_, *set,xyz_, *set,numv_, *set,ecount, *set,ctyp_, cmdele,CV001 ! *if,prkey_,eq,1,then /go *endif