*#FILE_EXTENSION .nas
*# Note: This interface only translate the mesh to Nastran format
BEGIN BULK  
$ ----------------------------------------------------------
$    GiD Mesh to Nastran TransLator - Version: 1.0
$    Written by: Kike III 
$    Copyright @CIMNE 2002 - http://gid.cimne.com
$ ----------------------------------------------------------
*Set var ID0(int)=0
*Set var ID1(int)=1
*Set var DefaultNum(int)=1
*realformat "%8.3f"
*intformat "%8i"
*#*loop nodes
*#GRID    *NodesNum*ID0*NodesCoord(1,real)*NodesCoord(2,real)*NodesCoord(3,real)
*#*end nodes
*loop nodes
*format "GRID*%19i%16i%#16g%#16g*G%6i"
*NodesNum*ID0*NodesCoord(1,real)*NodesCoord(2,real)*NodesNum
*format "*G%6i%#16g"
*NodesNum*NodesCoord(3,real)
*end nodes
*#ficticious material MAT1 nš 1
*format "MAT1%12i%8i"
*ID1
*if(nelem(Linear)>0)
*if(nmats>0)
*loop materials
*format "PROD%12i%8i"
*matnum*ID1
*end materials
*else
*#ficticious property PROD nš 1
*format "PROD%12i%8i"
*ID1*ID1
*endif
*endif
*Set elems(Linear)
*loop elems
*if(IsQuadratic(int)==1)
*WarningBox Warning: - Quadratic line elements translated as linear
*break
*endif
*end elems
*loop elems
*set var PropNum=elemsmat
*if(PropNum<=0)
*set var PropNum=DefaultNum
*endif
*format "CROD%12i%8i%8i%8i"
*elemsNum*PropNum*elemsConec(1)*elemsConec(2)
*end elems
*if(nelem(Triangle)>0 || nelem(Quadrilateral)>0)
*if(nmats>0)
*loop materials
*format "PSHELL%10i%8i"
*matnum*ID1
*end materials
*else
*#ficticious property PSHELL nš 1
*format "PSHELL%10i%8i"
*ID1*ID1
*endif
*endif
*Set elems(Triangle)
*loop elems
*if(IsQuadratic(int)==1)
*WarningBox Warning: - Quadratic triangle elements translated as linear
*break
*endif
*end elems
*loop elems
*set var PropNum=elemsmat
*if(PropNum<=0)
*set var PropNum=DefaultNum
*endif
*format "CTRIA3%10i%8i%8i%8i%8i"
*ElemsNum*PropNum*ElemsConec(1)*ElemsConec(2)*ElemsConec(3)
*end elems
*Set elems(Quadrilateral)
*loop elems
*set var PropNum=elemsmat
*if(PropNum<=0)
*set var PropNum=DefaultNum
*endif
*if(IsQuadratic(int)==1)
*WarningBox Warning: - Quadratic quadrilateral elements translated as linear
*break
*endif
*end elems
*loop elems
*format "CQUAD4%10i%8i%8i%8i%8i%8i"
*ElemsNum*PropNum*ElemsConec(1)*ElemsConec(2)*ElemsConec(3)*ElemsConec(4)
*end elems
*if(nelem(Tetrahedra)>0 || nelem(Hexahedra)>0)
*if(nmats>0)
*loop materials
*format "PSOLID%10i%8i"
*matnum*ID1
*end materials
*else
*#ficticious property PSOLID nš 1
*format "PSOLID%10i%8i"
*ID1*ID1
*endif
*endif
*set elems(Tetrahedra)
*loop elems
*set var PropNum=elemsmat
*if(PropNum<=0)
*set var PropNum=DefaultNum
*endif
*if(IsQuadratic(int)==0)
*format "CTETRA%10i%8i%8i%8i%8i%8i"
*ElemsNum*PropNum*ElemsConec
*elseif(IsQuadratic(int)==1)
*format "CTETRA%10i%8i%8i%8i%8i%8i%8i%8i+T%6i"
*ElemsNum*PropNum*ElemsConec(1)*ElemsConec(2)*ElemsConec(3)*ElemsConec(4)*ElemsConec(5)*ElemsConec(6)*elemsNum
*format "+T%6i%8i%8i"
*elemsNum*ElemsConec(7)*ElemsConec(8)
*endif
*end elems
*set elems(Hexahedra)
*loop elems
*set var PropNum=elemsmat
*if(PropNum<=0)
*set var PropNum=DefaultNum
*endif
*if(IsQuadratic(int)==0)
*format "CHEXA%11i%8i%8i%8i%8i%8i%8i%8i+H%6i"
*ElemsNum*PropNum*ElemsConec(1)*ElemsConec(2)*ElemsConec(3)*ElemsConec(4)*ElemsConec(5)*ElemsConec(6)*elemsNum
*format "+H%6i%8i%8i"
*elemsNum*ElemsConec(7)*ElemsConec(8)
*elseif(IsQuadratic(int)==1)
*format "CHEXA%11i%8i%8i%8i%8i%8i%8i%8i+H%6i"
*ElemsNum*elemsmat()*ElemsConec(1)*ElemsConec(2)*ElemsConec(3)*ElemsConec(4)*ElemsConec(5)*ElemsConec(6)*elemsNum
*format "+H%6i%8i%8i%8i%8i%8i%8i%8i%8i+E%6i"
*elemsNum*ElemsConec(7)*ElemsConec(8)*ElemsConec(9)*ElemsConec(10)*ElemsConec(11)*ElemsConec(12)*ElemsConec(13)*ElemsConec(14)
*format "+E%6i%16i%8i%8i%8i%8i%8i"
*ElemsNum*ElemsConec(15)*ElemsConec(16)*ElemsConec(17)*ElemsConec(18)*ElemsConec(19)*ElemsConec(20)
*endif
*end elems
ENDDATA
