WE ARE TOGETHER !

Tuesday, November 10, 2020

HyperMesh Scripting Tcl/Tk Helpful For Beginners | hypermesh scripting 2

HyperMesh Scripting Tcl/Tk Helpful For Beginners | Hypermesh scripting | 

In the last hypermesh scripting post I had introduced to you 3 basic scripts of hypermesh, here in this post, I have come with 4 new hypermesh scripts that will be helpful while doing work on hypermesh. So without wastage of time, let's see. 

Hypermesh scripting
Source: Unsplash


Basic Hypermesh Script No. 4

If you want to detach all elements in the deck at the same time you can use the below script. It will detach all elements which are shown on the desktop. 

Scripts are available in pink color.

set a 1

while {$a<100} {

    *createmark elements 1 $a

    *detachelements 1 0

    incr a

}


Basic Hypermesh Script No. 5 

If you want to print all part id or node id or elements id you can go through the following Tcl code. Don’t forget to use clear command while using the new script, otherwise, it might be showing you the error.

 

For component id:

*clearmark comp 1; *clearmark comp 2 

hm_createmark comp 1 "advanced" "displayed"

set comp_id_list [hm_getmark comp 1]

puts "$comp_id_list"

 

 For elements id: 

 *clearmark elem 1; *clearmark elem 2 

hm_createmark elem 1 "advanced" "displayed"

set comp_id_list [hm_getmark elem 1]

puts "$comp_id_list"

 

For nodes id:

*clearmark node 1; *clearmark node 2 

hm_createmark node 1 "advanced" "displayed"

set comp_id_list [hm_getmark node 1]

puts "$comp_id_list"


Basic Hypermesh Script No. 6

If you want to remove particular elements submitted into the mark then you can use the following code to delete the elements as you want.

*createmark elem 1 38931 38951 38972

hm_marklength elem 1

hm_markremove elem 1 38931

hm_marklength elem 1


Basic Hypermesh Script No. 7

If you want to delete all the face which are under 5 mm area then you can use the following code which is very useful while going through geometry clean up in plastic meshing or 2D meshing. 


proc delete_face_under {} {

*clearmarkall 1; *clearmarkall 2

*createmark face 1 all

set face_entity [hm_getmark face 1]


foreach entity $face_entity {

    puts $entity

}

}

delete_face_under;


Conclusion:

Once upon we learn 4 basic scripts which is the base for complex scripting. I will attach some basics of Tcl/Tk programming language which directly helps to understand and resolve the complexity level of understanding. In an upcoming post I will aware you about if you don't know the syntax of Tcl scripting then how can you code in hypermesh scripting panel of usage of the command. Tcl & much more with simple language.


 

 

 

 

 

No comments:

Post a Comment

Thank you !