hm_getentitycreationid

Returns a valid entity ID that can be used to renumber both the creating and mapping entities.

Syntax

hm_getentitycreationid entity_type_c pool_id entity_type_m entity_id

Type

HyperMesh Tcl Query Command

Description

This command returns a valid entity ID that can be used to renumber both the creating and mapping entities. If the command returns 0, it means the new entity can use any ID. If the command returns a valid ID, both the new entity and mapped entity need to be renumbered to use the returned ID.

Inputs

entity_type_c
The entity type for the creating entity.
pool_id
The solver ID pool number for the creating entity. A value of 0 indicates no solver ID pool.
entity_type_m
The entity type for the mapping entity.
entity_id
The entity ID for the mapping entity. A value of 0 indicates the command should find an ID for renumbering both the creating and mapping entities.

Example

To create a new component named myComp whose ID should map with its assigned property ID of 100:

set propID 100
set newID [hm_getentitycreationid comps 0 props $propID]
*createentity comps name=myComp color=5;
set compID [hm_entityinfo id comps "myComp"];
if { $ newID != 0 } {
    if { $propID != $ newID } {
        #Renumber the property
        *createmark properties 1 "by id only" $propID;
        *renumbersolverid properties 1 $newID 1 0 0 0 0 0;
    }
    if { $compID != $ newID } {
        #Renumber the component
        *createmark comps 1 "by name only" myComp
        *renumbersolverid comps 1 $newID 1 0 0 0 0 0;
    }
}

Errors

Incorrect usage results in a Tcl error. To detect errors, you can use the catch command:
if { [ catch {command_name...} ] } {
   # Handle error
}

Version History

12.0