how to find node number If I create node with *createnode command

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

Hi,

I have created node with *createnode command.How to get the node number of newly created node with using TCL command.

Thanks

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2008

    There is a pretty easy way to get the id of an entity that you just created. HM keeps a stack of those entities

    *createnode 0 1 0 1 0 0 *createmark nodes 1 -1set node_id [hm_getmark nodes 1]puts 'The node id I just made is $node_id'

    You can also get the second last entity using -2, etc.

    Eric

  • Jaggs
    Jaggs New Altair Community Member
    edited May 2016

    Thanks etg, very useful

  • Manoj Yandra
    Manoj Yandra Altair Community Member
    edited July 2020

    Hello, I have created a circle center node. I want to renumber it with a known value just after it is created (using tcl code). How can I do it?

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited July 2020

    Hello, I have created a circle center node. I want to renumber it with a known value just after it is created (using tcl code). How can I do it?

     

    Here's an example: you create the center of circle by 3 nodes (1712, 1709 & 1541). Then you renumber the center as 50000:

     *createmark nodes 1 1712 1709 1541 *createbestcirclecenternode nodes 1 0 1 0 set centerID [hm_latestentityid nodes] *clearmark nodes 1 *createmark nodes 1 $centerID *renumbersolverid nodes 1 50000 1 0 0 0 0 0

     

  • Manoj Yandra
    Manoj Yandra Altair Community Member
    edited July 2020

    Hello, the above code worked. Thanks

     

    I have created a line entity. I want to renumber it with a known value just after it is created (using tcl code). How can I do it.

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited July 2020

    Hello, the above code worked. Thanks

     

    I have created a line entity. I want to renumber it with a known value just after it is created (using tcl code). How can I do it.

     

    The same as nodes. You remplace entity 'nodes' by 'lines' :)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />  Try it!

     

  • Manoj Yandra
    Manoj Yandra Altair Community Member
    edited July 2020

    Ya, I did the same as you suggested, I wrote the script as:

    *createlist nodes 1000

    *createvector 1 0 1 0

    *createcirclefromcenterradius 1 1 22.5 360 0

    set lineid [hm_latestentityid lines]

    *clearmark lines 1

    *createmark lines 1 $lineid

    *renumbersolverid lines 1 10000 1 0 0 0 0 0

     

    When I tried the above script, the error is shown as 'program stopped executing at *renumbersolverid lines 1 10000 1 0 0 0 0 0 '.

    I think the line is not getting renumbered to 10000. Can you please tell me the mistake in above script or any alternative solution?

    Thank You for your fast responses. Very much appreciated.

     

     

     

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited July 2020

    The following code works without issue for me:

     *createlist nodes 1 96 94 100 *createcirclefrompoints 1 1 set lineid [hm_latestentityid lines] *createmark lines 1 $lineid *renumbersolverid lines 1 10000 1 0 0 0 0 0

     

  • Manoj Yandra
    Manoj Yandra Altair Community Member
    edited July 2020

    The above code worked. Thx.

    I created a 2d cylindrical mesh and I wanted to renumber it in a specific order as shown in figure. I want to get #13 just above #1 (i mean once the node#12 is numbered in first plane, then #13 must be starting just above #1). The objective is to align nodes 25, 37, 49, 61, ..... with nodes 1 and 13; similarly 26, 38, 50, 62,........ with nodes 2 and 14.

    I tried renumbering 'node by path' but couldn't control the manner of numbering.

    <?xml version="1.0" encoding="UTF-8"?>mesh.PNG

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

    i know you're trying a script for that, but you should take a look at the 'Aerospace' userprofile in HM.

    User Profiles>>Enginenering Solutions>>Aerospace.

     

    There is the Spatial ID Manager, that probably do what oyu need.

    image.png.bfe1a0d2aa74b6724a1035e174f87a73.png

    Unable to find an attachment - read this blog

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited July 2020

    The above code worked. Thx.

    I created a 2d cylindrical mesh and I wanted to renumber it in a specific order as shown in figure. I want to get #13 just above #1 (i mean once the node#12 is numbered in first plane, then #13 must be starting just above #1). The objective is to align nodes 25, 37, 49, 61, ..... with nodes 1 and 13; similarly 26, 38, 50, 62,........ with nodes 2 and 14.

    I tried renumbering 'node by path' but couldn't control the manner of numbering.

    <?xml version="1.0" encoding="UTF-8"?>mesh.PNG

     

    I don't think you can do that with method 'automatic' renumbering, via Hypermesh panel.

    But maybe it's simpler to control at begin of mesh creation? I mean you use Tcl script to create element by element for one layer and then copying later to get full mesh.

     

  • Manoj Yandra
    Manoj Yandra Altair Community Member
    edited July 2020

    Thx Mr.Adriano and Mr.Nguyen for ur responses.

    @Mr.Adriano, My Hypemresh is 2019.1 version and I couldnt find 'Aerospace' list.

    @Nguyen, I am actually trying to renumber the nodes of face elements of a hexamesh.

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

    change user profile first to engineerign slutions>> Aerospace user profile.

  • Manoj Yandra
    Manoj Yandra Altair Community Member
    edited August 2020

    Ya, I will try that.

    I think the below actions would work to ensure node alignment:

    1) Projecting duplicate nodes of first circle to the 2nd plane

    2) Equivalencing the 2nd plane nodes to the duplicate nodes

  • Manoj Yandra
    Manoj Yandra Altair Community Member
    edited August 2020

    /profile/97129-adriano-a-koga/?do=hovercard' data-mentionid='97129' href='<___base_url___>/profile/97129-adriano-a-koga/' rel=''>@Adriano A. Koga, I tried the panel you suggested, but it displayed as that the function doesnt support for hexa element nodes.

     

    Can  anyone say how to define base node (in N1,N2,N3,B plane) through its node id?

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited August 2020

    *createplane ?

  • Manoj Yandra
    Manoj Yandra Altair Community Member
    edited August 2020

    yes, when i look the tcl script it defines the plane by coordinates of nodes. I want to project nodes along y-axis at one base point. And the base point keeps on changing for each case. So it will be difficult to enter location of node in script everytime. i thought it would be easy if we can be able to define the base point through its id. or is there any other way to do projection of nodes to a plane using script?

  • Manoj Yandra
    Manoj Yandra Altair Community Member
    edited August 2020

    how do we retrieve node coordinates of a node and use its coordinates to define a base point?

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited August 2020

    how do we retrieve node coordinates of a node and use its coordinates to define a base point?

     

     	set x [hm_getvalue nodes id=$nodeID dataname=globalx] 	set y [hm_getvalue nodes id=$nodeID dataname=globaly] 	set z [hm_getvalue nodes id=$nodeID dataname=globalz]

     

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

    set node_coords [lindex [hm_nodevalue $id ] 0 ]

  • Xavier
    Xavier Altair Community Member
    edited August 2020

    the spatial renumbering allows renumber with respect to axis and adjacent, but what if we require renumber along specific path, 

    for example A SPIRAL PATH ALONG SCREW THREAD