Hypermesh TCL commands to create a node and identify node id created

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

I have hundreds of points that I was thinking I wanted to read in from a csv file to create nodes, and local coordinate systems for each of those nodes, but the end goal is to be able to apply a force at the node locations according to the local coordinate systems that were created.
I read somewhere here, that nodes are not related to the mesh in any way, so Is there a way then to find the nearest node location in the existing mesh closest to the node I create from the csv file?

Also, once a node is created by:  *createnode $X_Pos $Y_Pos $Z_Pos 0 0 0   is there a way to capture the node ID that was created so that it can be referred to when creating the local coord system using *systemcreate3nodes  ?

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2018

    ok, I've gotten to here:

    image.png.6e8130b36edd5cdd730c892f5d76dec2.png

    this allows me to identify the node# of the just created node,

     

    and actually, I have 3 nodes I am using to create a local coordinate system:

    image.png.8ee04df9d807995a2712e1a75cb09353.png

     

    but now,  is there a way to create the coordinate system with a name or a way to retrieve the name given to each, as it is now it doesn't look like there is any way to distinguish one from another.

     

    Still unknown is what would be the TCL command to select a node or a point on the mesh to apply a force to ?

    As far as I can tell, I'd want it to be the node/point on the mesh nearest the above referenced node_id which is the local_coordinate system's origin.

     

    <?xml version="1.0" encoding="UTF-8"?>image.png

  • Manoj Yandra
    Manoj Yandra Altair Community Member
    edited August 2020

    how do we retrieve coordinates of a node and use them in defining a base point?

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited August 2020

    having the id of the node, you can use:

     

    set node_coords [lindex [hm_nodevalue ${node id} ] 0]

     

    then in some command that uses a base point use ${node_coords} to reproduce their values:

    i..e:

    eval '*translate .....  ...    $\{node_coords\}  .....' 

     

     

     

     

  • Manoj Yandra
    Manoj Yandra Altair Community Member
    edited August 2020

    I am trying to duplicate nodes 1 to 12 and project them along Y-axis at base point '1001'. But the nodes are being projected at some other plane (not in the plane of #1001 node). I think the script is ignoring the last third line (eval). Can you please tell me if there is any mistake in the below script

     

    *clearmark nodes 1
    *createmark nodes 1 1001
    set nid [hm_getmark nodes 1]
    set node_coords [lindex [hm_nodevalue ${nid}]0]
    *createmark nodes 1 1-12
    *duplicatemark nodes 1 28
    *createmark nodes 1 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12
    eval '*createplane 1 0 1 0 $\{node_coords\}'
    *createvector 1 0 1 0
    *projectmarktoplane nodes 1 1 1 1

  • tinh
    tinh Altair Community Member
    edited August 2020

    From tcl 8.5, use {*} instead of eval

    *createplane 1 0 1 0 {*}$node_coords

     

    or

    eval *createplane 1 0 1 0 $node_coords