*setcurrentbagentitytype()
Sets the type of entity within a bag for which information is to be queried.
Syntax
*setcurrentbagentitytype (entity_type)
Type
HyperMesh Template Command
Description
This command is used in the *format level of a template to set the queried entity type of the bag to entity_type. Subsequent references to bag entity data names entitylist and entitylistmax in the template will then be based on the entity type that was set using this command, until *setcurrentbagentitytype is called again with a different entity_type.
Example
The following code in the HMASCII template loops through all the entity types in the database for each bag and writes out the ids of the entities, if present:
*bags()
*before()
*end()
*string("BEGIN BAGS")
*end()
*format()
*string("*bags(")
*field(integer,id,0)
*string(",")
*field(quotedstring,name,0)
*string(",")
*field(integer,config,0)
*string(",")
*field(integer,color,0)
*string(")")
*end()
*if([attributesmax > 0])
*string(" *attributesforentity(BAGS,")
*field(integer,id,0)
*string(",")
*field(integer,attributesmax,0)
*string(")")
*end()
*include(attribs)
*endif()
*counterset(counter1,1)
*loopif([counter1 <= globalentitytypesmax])
*setcurrentbagentitytype([@getdatabaseentitytypename(counter1)])
*if([entitylistmax > 0])
*end()
*string("*bagentitytype(")
*field(string,[@getdatabaseentitytypename(counter1)],0)
*string(")")
*end()
*string("*bagentitylistmax(")
*field(integer,entitylistmax,0)
*string(")")
*end()
*counterset(counter2,0)
*string("*bagentityidlist(")
*loopif([counter2 < entitylistmax])
*pointerset(pointer1,entitylist,counter2)
*field(integer,pointer1.pointervalue,0)
*if([counter2 < (entitylistmax - 1)])
*string(",")
*endif()
*counterinc(counter2)
*if([counter2 == entitylistmax])
*string(")")
*end()
*else()
*if([counter2 % 9 == 0])
*end()
*endif()
*endif()
*endloop()
*end()
*endif()
*counterinc(counter1)
*endloop()
*end()
*after()
*string("END BAGS")
*end()
*output()