About *createmark
Dear All,
I have a question about *createmark. I think this question may be fundamental but since I am new to tcl/tk scripting language, I really need some help with this.
Assume I have chosen a set of nodes by using tcl command as follows:
*createmark nodes 1 'on plane' 0.5 0 0 1 0 0 .0001 1 1
# choose all nodes in that plane
For example in hypermesh it came out with *createmark nodes 1 1-40 121 134
Is there a way that I can select the first and second nodes (1 and 2) inside this mark that I just created and store them into a new mark? I know we can select by choosing them by hand but what I need is a macro that can handle multiple different models so I need to select them using this order.
Answers
-
Hi,
you can use: eval *createmark nodes 2 [lrange [hm_getmark nodes 1] 0 1]
to store 1st and 2nd nodes in mark 2
0 -
Hi,
I found another better way to do this by select them by their coordinates in order to choose the right ones. Thanks a lot, Tinh
Regards,
Chong
0 -
Hi All,
I have to select a surface, but I can't use the surface ID. is there a way to select a surface that is X mm far from a specific point?
Where can I found a manual or a reference guide for the tcl language?
Thanks,
Enrico
0 -
Altair Forum User said:
Hi All,
I have to select a surface, but I can't use the surface ID. is there a way to select a surface that is X mm far from a specific point?
Where can I found a manual or a reference guide for the tcl language?
Thanks,
Enrico
Consider the plane X mm from your point and mark the surfaces on that plane.
0 -
how can I do that?
0 -
Hi
Use hm_measureshortestdistance2
Easier than *createmark
0 -
Hi Tinh,
where could I find a reference guide to learn how to use the commands?
Thanks,
Enrico
0 -
Open Hm--> Press F1 key--> under Help Tag You can find 'Reference guide'
0 -
Hi Forum,
I am trying to select elements based on their element normal.
I have a user selected element and I want to select the elements with same normal as the one which user has selected.
Is there any option to do that in HM??
Thanks
Akash
0 -
If there is no existing function, you can do it 'manually' /emoticons/default_biggrin.png' srcset='/emoticons/biggrin@2x.png 2x' title=':D' width='20' />
Just a point to know: it better to give some tolerance by selecting elements by normal.
0 -
Here's my script (tested only with SHELL elements) to select elements based on normal of one element. The tolerance will be applied at angle comparing.
# Tested only with SHELL elements # Reference element *createmarkpanel elems 1 'Select Elem' set elist [hm_getmark elems 1] hm_markclear elems 1 set eid_ref [lindex $elist 0] set nx0 [hm_getvalue elems id=$eid_ref dataname=normalx] set ny0 [hm_getvalue elems id=$eid_ref dataname=normaly] set nz0 [hm_getvalue elems id=$eid_ref dataname=normalz] set v0 [list $nx0 $ny0 $nz0] # Tolerance for normal comparing, in deg set tolerance 17.0; # Select all displayed elements hm_createmark elems 1 'advanced' 'displayed' set elist [hm_getmark elems 1] hm_markclear elems 1 #------------------------------------------------------------------------ set selectedElems [list] foreach eid $elist { set nx [hm_getvalue elems id=$eid dataname=normalx] set ny [hm_getvalue elems id=$eid dataname=normaly] set nz [hm_getvalue elems id=$eid dataname=normalz] set v1 [list $nx $ny $nz] set angle [::hwat::math::AngleBetweenVectors $v1 $v0] if { $angle <= $tolerance } { lappend selectedElems $eid } } eval *createmark elems 2 '$selectedElems'; set elist [hm_getmark elems 2] puts 'Selected E: $elist'
0 -
If 'foreach' loops through element list taking long time, we can make a template code like this
# 1. Get sample element: *createmarkpanel elems 1 'Pick an element:' set eid [lindex [hm_getmark elems 1] 0] if {[llength $eid]} { # 2. Get sample normal: set nx [hm_getvalue elems id=$eid dataname=normalx] set ny [hm_getvalue elems id=$eid dataname=normaly] set nz [hm_getvalue elems id=$eid dataname=normalz] # 3. Prepare a template code: set tplCode { *elements(103,,,) *format() *uservariableset(#nx,normalx) *uservariableset(#ny,normaly) *uservariableset(#nz,normalz) *uservariableset(#angle,[57.295779513082195*@acos(#nx*$nx + #ny*$ny + #nz*$nz)]) *if([#angle <= $tolerance]) *markfailed() *endif() *output() *elements(104,,,) *format() *uservariableset(#nx,normalx) *uservariableset(#ny,normaly) *uservariableset(#nz,normalz) *uservariableset(#angle,[57.295779513082195*@acos(#nx*$nx + #ny*$ny + #nz*$nz)]) *if([#angle <= $tolerance]) *markfailed() *endif() *output() } # 4. Run the template code: set tolerance 5; #degrees set tplCode [string map [list \$nx $nx \$ny $ny \$nz $nz \$tolerance $tolerance] $tplCode] set fpt [open mark_elems_by_normal.tpl w] puts $fpt $tplCode close $fpt hm_answernext yes *usercheck mark_elems_by_normal.tpl mark_elems_by_normal.out 0 ;# only displayed elems #*usercheck mark_elems_by_normal.tpl mark_elems_by_normal.out 1 ;# include non-displayed elems hm_highlightmark elems 2 h set elist [hm_getmark elems 2] puts '[hm_marklength elems 2] elems have normal ~ ($nx,$ny,$nz) within +/-$tolerance degrees' }
0