Estratégia:
- Identifique o número máximo de propriedades do material
- Crie material
- Atribuir material aos elementos selecionados
Código:
! Commands inserted into this file will be executed just prior to the ANSYS SOLVE command.
! These commands may supersede command settings set by Workbench.
! Active UNIT system in Workbench when this object was created: Metric (mm, t, N, s, mV, mA)
! NOTE: Any data that requires units (such as mass) is assumed to be in the consistent solver unit system.
! See Solving Units in the help system for more information.
FINISH
/PREP7
*DEL,mySelectioName,,nopr
*DIM, mySelectioName, string, 248, 1
!################### Start User Input
myEModul = 210000
myPoissionration = 0.3
mySelectioName(1, 1) = 'steelElements'
!################### End User Input
ALLSEL
!Get maximal material number assigned and increment
*GET,maxMaterialNumber,ELEM,0,MATM
maxMaterialNumber = maxMaterialNumber + 1
!Create new material properties
MP, EX, maxMaterialNumber, myEModul
MP, NUXY, maxMaterialNumber, myPoissionration
!Select elements and change material property number of those materials
CMSEL,s,mySelectioName(1, 1)
MPCHG, maxMaterialNumber, all
!Select all entities and leave code snippet
ALLSEL
FINISH
/SOLU
! Doublecheck in Classic:
! /pnum,mat,1 !0=off, 1=on
! /number,1 !0=on, 1=off
*GET, maxMaterialNumber, MAT, 0, NUM, MAX