Get nodeset from node id
Best Answer
-
Akash Purushothaman said:
Hi @Adriano A. Koga.. I tried this API, it returns only the cross referenced entity type (in my case it shows only elems & sets).
I would like to get the entity set name or id in reference with the node id.. Thanks in advance!!
i believe you're missing only retrieving the entities from the output selection (mark), with hm_getmark sets (mark number).
INPUT> node ID
OUTPUT> a list of entities related to the input, outputted into the desired mark (selection bin).
>>to retrieve the output, use hm_getmark entity_type mark_number
I've used a similar command below. My command has returned the cross-referenced entities into mark #1. Then I've used a few hm commands to retrieve their ids and names.
0
Answers
-
I believe you can work with references API.
hm_getcrossreferencedentities
Finds entities that reference the specified entity.
Syntax
hm_getcrossreferencedentities entity_type entity_name_or_id reference_flag output_mark_id string_array number_of_strings ?search_type? ?exclude_regions?
Type
HyperMesh Tcl Query Command
Description
Finds entities that reference the specified entity. This includes collected references, data name references and attribute entity references. Each type of entity that references the specified input entity is returned in a list, and the found entities are then placed on the specified mark for those entity types. See the list of supported entities for this command.
Inputs
entity_type
The type of entity to query.
entity_name_or_id
The name or ID of the entity.
reference_flag
The type of cross-reference entities to find. Bit values are used and the value is calculated as (Bit0 + 2*Bit1 + 4*Bit2).
Bit0
0 - Do not consider collected entity cross-references.
1 - Consider collected entity cross-references. If the specified entity is not a collected entity, nothing will be returned for this bit.
Bit1
0 - Do not consider data name entity cross-references.
1 - Consider data name entity cross-references. If the specified entity is not referenced by any data names, nothing will be returned for this bit.
Bit2
0 - Do not consider attribute entity cross-references.
1 - Consider attribute entity cross-references. If the specified entity is not referenced by any entity attributes, nothing will be returned for this bit. Only entities for the currently loaded template are considered.
output_mark_id
The ID of the mark to place the found cross-referenced entities on. Valid values are 1 and 2.
string_array
Reserved for future use. Must be set to 0.
number_of_strings
Reserved for future use. Must be set to 0.
search_type
By default, HyperMesh searches for entities by name, and if the name is not found, it then searches by ID. This option allows you to specify how the search for an entity should be conducted. Valid values are:
-byname - Search only by name.
-byid - Search only by ID.
exclude_regions
0 - Include region entities in the search (default).
1 - Exclude region entities in the search.
Examples
To get all entities that cross-reference component with ID 100 on mark 1 and highlight them on the screen:
foreach entity_type [hm_getcrossreferencedentities comps 100 7 1 0 0 -byid] {
hm_highlightmark $entity_type 1 h
}
To get only collected entity cross-references for component with ID 100 on mark 2:
hm_getcrossreferencedentities comps 100 1 2 0 0 -byid
To get only data name entity cross-references for component with ID 100 on mark 1:
hm_getcrossreferencedentities comps 100 2 1 0 0 -byid
To get only attribute entity cross-references for component with ID 100 on mark 1:
hm_getcrossreferencedentities comps 100 4 1 0 0 -byid
Errors
Incorrect usage results in a Tcl error. To detect errors, you can use the catch command:
if { [ catch {command_name...} ] } {
# Handle error
}
0 -
Hi @Adriano A. Koga.. I tried this API, it returns only the cross referenced entity type (in my case it shows only elems & sets).
I would like to get the entity set name or id in reference with the node id.. Thanks in advance!!
0 -
Akash Purushothaman said:
Hi @Adriano A. Koga.. I tried this API, it returns only the cross referenced entity type (in my case it shows only elems & sets).
I would like to get the entity set name or id in reference with the node id.. Thanks in advance!!
i believe you're missing only retrieving the entities from the output selection (mark), with hm_getmark sets (mark number).
INPUT> node ID
OUTPUT> a list of entities related to the input, outputted into the desired mark (selection bin).
>>to retrieve the output, use hm_getmark entity_type mark_number
I've used a similar command below. My command has returned the cross-referenced entities into mark #1. Then I've used a few hm commands to retrieve their ids and names.
0 -
Adriano A. Koga_21884 said:
i believe you're missing only retrieving the entities from the output selection (mark), with hm_getmark sets (mark number).
INPUT> node ID
OUTPUT> a list of entities related to the input, outputted into the desired mark (selection bin).
>>to retrieve the output, use hm_getmark entity_type mark_number
I've used a similar command below. My command has returned the cross-referenced entities into mark #1. Then I've used a few hm commands to retrieve their ids and names.
Oh yes!! Thats right.. Works as expected.. Thank you!!
0