How to set element density on the lines if line IDs are available?
How can I set element density for two shortest lines of a rectangular surface and leave the other two lines with the default element density based on predefined element size?
I have the line IDs.
#Selected Surface set surfIDs [ hm_getmark surfs 1] *createmark lines 1 'by surface' {*}$surfIDs #Line list set lineList [hm_getmark lines 1] #Line IDs set lineId1 [lindex $lineList 0] set lineId2 [lindex $lineList 1] set lineId3 [lindex $lineList 2] set lineId4 [lindex $lineList 3]
Answers
-
Hi,
try this script:
set Density1 5 set Density2 10 *deleteelementsmode 2 *createmarkpanel surfs 1 'Pick a surface:' if {[hm_marklength surfs 1]==1} { foreach LineId [join [hm_getsurfaceedges [hm_getmark surfs 1]]] {lappend LineList [list $LineId [hm_linelength $LineId]]} set LineList [lsort -increasing -real -index 1 $LineList] lassign [join $LineList] Line1 -> Line2 *setedgedensitylinkwithaspectratio -1 *elementorder 1 *defaultremeshsurf 1 [hm_getelementsize] 2 2 2 0 1 1 1 0 0 0 0 *createmark lines 1 $Line1 *change_edgedensities 1 1 $Density1 0 *createmark lines 1 $Line2 *change_edgedensities 1 1 $Density2 0 }
0 -
-
Hi,
what did hm say in error message bar?
it could be due to your surf has only 1 edge
0 -
I'm selecting the top surface as shown in image.
<?xml version="1.0" encoding="UTF-8"?>
Getting following message:
Few questions regarding the code:
Can you please explain what does below line do?
lassign [join $LineList] Line1 -> Line2
puts '[lassign [join $LineList] Line1 -> Line2]]'
Above line is following output. What are 43 and 42 numbers signify?
1 43 1 42 1 15 1 45 1 15 1 45 1 43 1 42 1 45 1 46 1 45 1 46 1 15 1 45 1 43 1 42 1 15 1 45 1 43 1 42 1 45 1 46 1 15 1 45 1 43 1 42 1 45 1 46 1 15 1 45 1 43 1 42 1 43 1 42 1 15 1 45 1 45 1 46 1 15 1 45 1 15 1 45 1 15 1 45 1 45 1 46 1 43 1 42 1 43 1 42 1 43 1 42 1 43 1 42 1 15 1 45 1 43 1 42 1 18 1 20 1 24 1 26 1 24 1 26 1 18 1 20 1 18 1 20 1 26 1 22 1 24 1 26 1 18 1 20 1 26 1 22 1 9 1 8 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 6 1 9 1 6 1 9 1 5 1 4 1 9 1 8 1 6 1 9 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 48 2 48 2 48 2 48 2 48 2 48 2 48 2 15 2 15 2 2 2 2 2 44 5 47 5 25 5 47 5 41 5 40 5 41 5 40 5 25 5 47 5 44 5 47 5 44 5 47 5 41 5 40 5 25 5 47 5 41 5 40 5 25 5 47 5 44 5 47 5 41 5 40 5 25 5 47 5 44 5 47 5 41 5 40 5 25 5 47 5 25 5 47 5 41 5 40 5 44 5 47 5 41 5 40 5 41 5 40 5 41 5 40 5 44 5 47 5 25 5 47 5 25 5 47 5 25 5 47 5 25 5 47 5 41 5 40 5 25 5 47 5 17 5 19 5 23 5 25 5 23 5 25 5 17 5 19 5 {19 15 21 26 22} 5 {23 24 25 26} 5 {17 18 19 20} 5 {19 15 21 26 22} 5 {23 24 25 26} 5 17 5 19 5 19 5 21 5 23 5 25 5 17 5 19 5 19 5 21 5 3 5 7 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 11 5 10 5 11 5 10 5 1 5 3 5 3 5 7 5 11 5 10 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 1 5 1 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5]
0 -
Hi,
I can run it with no error. Did you copy my script and run? or you retyped them (maybe you missed something)?
Send me your model please.
for lassign command usage, please refer to
0 -
Hi
I'm using the exact code what you have written.
The selected surface is meshed but not according to the element density specified in the code.
I closed the hypermesh and started it again. Now I'm getting the error. But the mesh is not according to the density specified.
On one of the shortest edge density is 5 and another shortest edge its 10.
<?xml version="1.0" encoding="UTF-8"?>
0 -
I don't understand.
In tcl script, you set Density1 = 5 and Density2 = 10, then your mesh appeared with one shortest edge has 5 segments and the alternative has 10. So what are you expecting?
0 -
I would like to have same elements on both the short edges of the rectangle and mesh with default element size on the other two long edges.
In the second image(rectangular surface on the bottom right corner) above it can be seen , the element density is 2 on the shortest edges. But I have set the Density1 = 5 in the script.
0 -
I found the issue. I did not reset variable LineList
Just insert below code at begining of script:
set LineList ''
0 -
My problem is not completely solved but taking your script as a reference I have written a script. Its working now.
Thank you very much for your help.
0