Jump to content
mansin

How to mesh lines automatically by using tcl script?

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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;

 

Share this post


Link to post
Share on other sites
On 3/24/2019 at 7:36 PM, Q.Nguyen-Dai said:

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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...