Finding element id from list of node ids

Sai91
Sai91 Altair Community Member
edited October 2020 in Community Q&A

Greetings,

 

I would like to query element id from list of node ids.

 

I know its possible other way around. But can we ask for element id giving list of node ids which make this element ?

Answers

  • tinh
    tinh Altair Community Member
    edited October 2020

    Above thread may be not what @Sai91 wants,

    Let's say, you have 4 node IDs and you're sure that there is a quad formed by those. This is a way to find the quad:

    proc findElementsFormedByNodes args { 	set NodeList [join $args] 	*createmark elems 1 "by node" {*}$NodeList 	set ElemList {} 	foreach ElemId [hm_getmark elems 1] ElemNodes [hm_getvalue elems mark=1 dataname=nodes] { 		if {[lsort $ElemNodes] == [lsort $NodeList]} { 			lappend ElemList $ElemId 		} 	} 	set ElemList }  #test *createmarkpanel nodes 1 "Select nodes of an element:" puts "element(s) with nodes [join [hm_getmark nodes 1] ,] : [findElementsFormedByNodes [hm_getmark nodes 1]]"   #other way to call findElementsFormedByNodes : set nid1 5 set nid2 24 set nid3 65 set nid4 32 findElementsFormedByNodes $nid1 $nid2 $nid3 $nid4