Model.hm_getincrementalname#
- Model.hm_getincrementalname(entity_type_list, base_name, start_num=-1, num_digits=0, separator='')#
Returns a unique incremental name from a specified base name and one or more entity types (for example, name1, name2, etc.). Multiple entity types might require the same name (generate comp/mat/prop with same name), so the returned name is unique across the specified entity types.
For entity types enabled for name pool, the function looks at the solver name and returns a unique incremental solver name.
- Parameters:
entity_type_list (_EntityFullTypeList_vector) – A quoted list of entity types to consider for generating the name. A unique incremental name is found considering all of the specified types. Only named entity types are valid.
base_name (hwString) – The base name to use for generating the incremental name. A blank string can be specified to just use the incremental ID as the name. Names with spaces must be enclosed in quotes.
start_num (int) –
An argument that specifies the starting number for generating the incremental name.
Unless specified as 0, the increment counter always starts at 1. Valid values are:
Non-negative integer - Find the first available incremental name starting from this value.
-1 - Use the highest available incremental name (the generated name never falls inside of existing names). This is the default.
-2 - Use the lowest available incremental name (the generated name could fall inside of existing names).
num_digits (int) – An argument that specifies the number of digits to use for generating the incremental number. If 0, use the minimum number of required digits (default). If the generated incremental number does not fit within the specified value, an error is returned.
separator (hwString) – An argument that specifies the separator (delimiter) that will be appended between the base name and the number. Only valid when
start_num=-1.
- Returns:
hwReturnStatus- Status objectHmQueryResult- Result object containing the output values:name (str)
Examples#
Generate a name based off of components in the form N , where N is the incremental ID of any length , use the highest available incremental name#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_getincrementalname( entity_type_list=[ent.Component], base_name="" ) # equivalent to: # _, result = model.hm_getincrementalname( # entity_type_list=[ent.Component,base_name="", start_num=-1 # ) print("name", result.name)
Generate a name based off of components in the form N , where N is the incremental ID of any length , use the lowest available incremental name#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_getincrementalname( entity_type_list=[ent.Component], base_name="", start_num=-2 ) print("name", result.name)
Generate a name based off of components in the form N , where N is the incremental ID of any length , use the lowest available incremental name start from 0#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_getincrementalname( entity_type_list=[ent.Component], base_name="", start_num=0 ) print("name", result.name)
Generate a name based off of components in the form N , where N is the incremental ID of any length , use the lowest available incremental name start from 1#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_getincrementalname( entity_type_list=[ent.Component], base_name="", start_num=1 ) print("name", result.name)
Generate a name based off of components in the form N , where N is the incremental ID of any length , use the lowest available incremental name start from 4#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_getincrementalname( entity_type_list=[ent.Component], base_name="", start_num=4 ) print("name", result.name)
Generate a name based off of components in the form N , where N is the incremental ID of any length , use the lowest available incremental name start from 50#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_getincrementalname( entity_type_list=[ent.Component], base_name="", start_num=50 ) print("name", result.name)
Generate a name based off of components in the form my_namesN , where N is the incremental ID of any length , use the highest available incremental name#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_getincrementalname( entity_type_list=[ent.Component], base_name="my_name", start_num=-1 ) print("name", result.name)
Generate a name based off of components in the form my_namesNNN , where NNN is the incremental ID of any length , use the highest available incremental name#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_getincrementalname( entity_type_list=[ent.Component], base_name="my_name", start_num=-1, num_digits=3 ) print("name", result.name)
Generate a name based off of components , properties and materials , in the form my_namesNNN , where NNN is the fixed incremental ID length , use the highest available incremental name#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_getincrementalname( entity_type_list=[ent.Component, ent.Property, ent.Material], base_name="my_name", start_num=-1, num_digits=3 ) print("name", result.name)
Generate a name based off of components , properties and materials , in the form my_namesNNN , where NNN is the fixed incremental ID length , use the lowest available incremental name#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_getincrementalname( entity_type_list=[ent.Component, ent.Property, ent.Material], base_name="my_name", start_num=-2, num_digits=3 ) print("name", result.name)
Generate a name based off of components and materials , in the form my_nameNNN , where NNN is the fixed incremental ID length , use the highest available incremental name#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_getincrementalname( entity_type_list=[ent.Component, ent.Material], base_name="my_name", start_num=-1, num_digits=3 ) print("name", result.name)
Generate a name based off of components and materials , in the form my_nameNNN , where NNN is the fixed incremental ID length , use the lowest available incremental name#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_getincrementalname( entity_type_list=[ent.Component, ent.Material], base_name="my_name", start_num=-2, num_digits=3 ) print("name", result.name)