🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

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.

Find more posts tagged with

Sort by:
1 - 12 of 121
    tinhUser: "tinh"
    Altair Community Member
    Updated by tinh

    Hi,

    you can use: eval *createmark nodes 2 [lrange [hm_getmark nodes 1] 0 1]

    to store 1st and 2nd nodes in mark 2

    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

    Enrico_20294User: "Enrico_20294"
    Altair Community Member
    Updated by Enrico_20294

    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

    PandurangUser: "Pandurang"
    Altair Community Member
    Updated by Pandurang

    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.

    Enrico_20294User: "Enrico_20294"
    Altair Community Member
    Updated by Enrico_20294

    how can I do that?

     

    tinhUser: "tinh"
    Altair Community Member
    Updated by tinh

    Hi

    Use hm_measureshortestdistance2

    Easier than *createmark

    Enrico_20294User: "Enrico_20294"
    Altair Community Member
    Updated by Enrico_20294

    Hi Tinh,

    where could I find a reference guide to learn how to use the commands?

     

    Thanks,

    Enrico

    PandurangUser: "Pandurang"
    Altair Community Member
    Updated by Pandurang

    Open Hm--> Press F1 key--> under Help Tag You can find 'Reference guide'

     

    blob.png.d8442c7d2c49a98aeacbbcf396f4fe0d.png

    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 

    QuyNguyenDaiUser: "QuyNguyenDai"
    Altair Community Member
    Updated by QuyNguyenDai

    If there is no existing function, you can do it 'manually' :D/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.

    QuyNguyenDaiUser: "QuyNguyenDai"
    Altair Community Member
    Updated by QuyNguyenDai

    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'

     

    tinhUser: "tinh"
    Altair Community Member
    Updated by tinh

    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' }