How to mesh lines automatically by using tcl script?

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

Hi ,

I wanted to mesh a lot of lines with variable lengths in model by using tcl script, but I found the sample script in help is not intelligent, for example

 

*createmark lines 1 15 18

*linemesh_preparedata lines 1 30

*linemesh_saveparameters 0 3 0 0

*linemesh_saveparameters 1 2 0 0

*linemesh_savedata1 1 5 0 0

 

The parameter 'density' in line 3 and 4 are manually assigned, and the 'segment' and 'density' parameteres must be strictly matched. If the length of each line are different, the density are also different. So, a lot of *linemesh_saveparameters commands are needed. It is not acceptable for this meshing scripting.

So, is there a way to mesh lines with constant element size?

Answers

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited March 2019

    If the standard command is not suitable for you, write yourself!

    Here's my script:

     set elem_size 5; set elem_type 61;  *createmarkpanel lines 1 'Select Lines' set lines [hm_getmark lines 1] *linemesh_preparedata1 lines 1 0 $elem_type; set i 0; foreach line_id $lines { 	set len [hm_linelength $line_id] 	set num [expr int($len / $elem_size)] 	*linemesh_saveparameters $i $num 0 0; 	incr i; } *linemesh_savedata1 1 $elem_type 0 0; *clearmark lines 1;

     

  • mansin
    mansin Altair Community Member
    edited March 2019

    Hi, Q.Nguyen-Dai

    Thanks you very much for your sample script.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2019

    If the standard command is not suitable for you, write yourself!

    Here's my script:

      set elem_size 5; set elem_type 61;  *createmarkpanel lines 1 'Select Lines' set lines [hm_getmark lines 1] *linemesh_preparedata1 lines 1 0 $elem_type; set i 0; foreach line_id $lines { 	set len [hm_linelength $line_id] 	set num [expr int($len / $elem_size)] 	*linemesh_saveparameters $i $num 0 0; 	incr i; } *linemesh_savedata1 1 $elem_type 0 0; *clearmark lines 1;

     

    when i am run this file their is error unknown entity type found what is this ?  what is element type 61?

  • Dinesh c
    Dinesh c Altair Community Member
    edited August 2019

    element type changes from solver to solver. Please set which element type do you want.

     

    You can easily find available element types in hypermesh>1D page>element types