Find more posts tagged with
In addition of Marc's proposal, you may try to use *findmark , and to find nodes attached to elements.
Below is a video (the corresponding script can be retrieved from the comments) showing how to use it:
https://youtu.be/t8NkIQC82Ks?si=Ye3RL0wWbk8TqRgJ
Hope this helps,
Michael
Hi,
can you try double quotes instead of single?
Check out the help for the syntax:
https://help.altair.com/hwdesktop/hwd/topics/reference/hm/_createmark.htm?zoom_highlight=createmark
There are also some examples on the bottom of the page.
A little tip:
You see in the bottom-left corner a message how many elements are selected after the *createmark command.That helps me to check immediately if it's working correctly.
Have fun with scripting!
Thank you very much Marc, this was the point! double quote, not single.
About syntax, I am sometimes in trouble with what is in the help. For exemple on https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/hm/_nodemarkaddtempmark.htm in the exemples there are parameters in parenthesis:
*createmark(nodes,1) 100 101 102 103
This does not work in my case. I have to change this line coming from the online help to this:
*createmark nodes 1 100 101 102 103
to make it works.
Thanks for the tip by the way, really helpfull!
Hello @Stéphane Combet,
In addition of Marc's proposal, you may try to use *findmark , and to find nodes attached to elements.
Below is a video (the corresponding script can be retrieved from the comments) showing how to use it:
https://youtu.be/t8NkIQC82Ks?si=Ye3RL0wWbk8TqRgJ
Hope this helps,
Michael
Thank you Michael. Good point with this function findmark, but I can't get what would be the benefit in my case? Anyway it's always good to have some short code tutorial like this one, thanks again.
Thank you Michael. Good point with this function findmark, but I can't get what would be the benefit in my case? Anyway it's always good to have some short code tutorial like this one, thanks again.
Hello @Stéphane Combet ,
you're right, there should be no added value in your case, maybe it will be more useful next time
Best Regards,
Michael
Thank you very much Marc, this was the point! double quote, not single.
About syntax, I am sometimes in trouble with what is in the help. For exemple on https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/hm/_nodemarkaddtempmark.htm in the exemples there are parameters in parenthesis:
*createmark(nodes,1) 100 101 102 103
This does not work in my case. I have to change this line coming from the online help to this:
*createmark nodes 1 100 101 102 103
to make it works.Thanks for the tip by the way, really helpfull!
To be honest, I have never used parentheses in tcl, only square brackets or curly brackets.
If you notice strange behavior, you can check the newest documentation. Just replace the version in the link:
https://2023.help.altair.com/2023/hwdesktop/hwd/topics/reference/hm/_nodemarkaddtempmark.htm
There is only the correct version:
Sorry to be so stupid, but I can't use the lists in a nice way... Syntax issues
Why this leads to 9 elements selected:
*createmark elems 1 "by node id" 20072267 20072268 20072271 20072273
Whereas this leads to only 4 elements (those around the first node of the list $selectedNodes):
*createmark elems 1 "by node id" $selectedNodes
Thank you!
Sorry to be so stupid, but I can't use the lists in a nice way... Syntax issues
Why this leads to 9 elements selected:
*createmark elems 1 "by node id" 20072267 20072268 20072271 20072273
Whereas this leads to only 4 elements (those around the first node of the list $selectedNodes):
*createmark elems 1 "by node id" $selectedNodes
Thank you!
Hello again @Stéphane Combet ,
you just experienced one tricky concept of *createmark
In its implementation, the command considers the output of $selectedNodes as separate arguments, and it takes only the first id of the node list
To avoid it, every time you refer to a list in *createmark, you need to preceed it by the tcl command eval:
eval *createmark elems 1 "by node id" $selectedNodes
Hope this helps,
Michael
Alternatively, you can write {*} in front of the variable you want to "write out":
*createmark elems 1 "by node id" {*}$selectedNodes
You have to check if the API expects a list or separate arguments. If you need seperate arguments and have a list variable, use {*} or the command from Michael. I guess Michael's answer is the safer choice
Hi,
Check below code to get element ID list.
#Get attached ElementIDs of node
#TempNodesList (Node ID list)
hm_markclear elements 2
hm_markclear nodes 1
hm_createmark nodes 1 $TempNodesList
*findmark nodes 1 1 1 elements 0 2
set elemIDList [hm_getmark elements 2]
hm_markclear nodes 1
hm_markclear elements 2
Hi,
can you try double quotes instead of single?
Check out the help for the syntax:
https://help.altair.com/hwdesktop/hwd/topics/reference/hm/_createmark.htm?zoom_highlight=createmark
There are also some examples on the bottom of the page.
A little tip:
You see in the bottom-left corner a message how many elements are selected after the *createmark command.
That helps me to check immediately if it's working correctly.
Have fun with scripting!
Hi,
can you try double quotes instead of single?

Check out the help for the syntax:
https://help.altair.com/hwdesktop/hwd/topics/reference/hm/_createmark.htm?zoom_highlight=createmark
There are also some examples on the bottom of the page.
A little tip:
You see in the bottom-left corner a message how many elements are selected after the *createmark command.
That helps me to check immediately if it's working correctly.
Have fun with scripting!