Find Hole and Create Rigid, In this script, How to add Outer Periphery nodes of the Hole also to Create a Rigid, Currently it only take inner Nodes of the Hole Based on the element edges, but we need to add outer periphery of node so that it create r

Chirag Sharma_20598
Chirag Sharma_20598 Altair Community Member
edited August 2023 in Community Q&A

proc spider {} {

    if { [ hm_marklength nodes 1 ] != 1 } {
        hm_errormessage "More than one node passed to spider procedure"
        return {}
    }
    set nodeId [ hm_getmark nodes 1 ]

    hm_blockmessages 1
    *entityhighlighting 0
    *clearmark comps 2
    *findmark nodes 1 1 1 components 0 2

    *findedges components 2 0

    *createmark elems 1 "by comps" {^edges}
    set edgeElems [ hm_getmark elems 1 ]
    foreach eId $edgeElems {
        set plotelem2Nodes($eId) [ hm_nodelist $eId ]
        foreach nId $plotelem2Nodes($eId) {
            lappend node2Plotelems($nId) $eId
        }
    }
    *deleteedges
    hm_blockmessages 0
    *entityhighlighting 1

    if { ! [ info exists node2Plotelems($nodeId) ] } {
        # selected node is not on an edge
        hm_errormessage "Please select a node on an edge."
        return {}
    }

    set endNode $nodeId
    set nodelist {}

    set nextNode $nodeId
    set nextElem [ lindex $node2Plotelems($nodeId) 0 ]
    set counter 0
    lappend nodelist $nextNode
    while { $counter < 10000 } {
        set prevNode $nextNode
        set prevElem $nextElem
        set nextNode [ lremove $plotelem2Nodes($prevElem) $prevNode ]
        lappend nodelist $nextNode
        if { $nextNode == $endNode } { break }
        set nextElem [ lremove $node2Plotelems($nextNode) $prevElem ]
        incr counter
    }
    if { $counter > 9999 } { set nodelist {} }

    # create and return the element
    set elemId {}
    if { [ llength $nodelist ] } {
        eval *createmark nodes 2 $nodelist
        *rigidlinkinodecalandcreate 2 0 0 123456
        set elemId [ hm_entitymaxid elems ]
    }
    return $elemId
}

image

Here it takes only inner Periphery of the Hole, Can you Help me to Update that, So that it can take outer node of washer as well 

Answers

  • Fred_Juras
    Fred_Juras
    Altair Employee
    edited August 2023

    Hi,

    Instead of having to author and maintain tcl scripts, you can directly use the latest native HyperMesh technologies for this purpose.

    As shown in the two videos below, you can either use a fastener connector to link holes and washers in front of each other or use a attachment to create manually or automatically a rigid spider on every selected or found holes (linking one or more washers). Number of layers can be defined in the 'Connect Outer Layer' field from the attachment config.


    https://www.youtube.com/watch?v=jjQlDPpLtLY


    https://www.youtube.com/watch?v=jQfjx3CG_Fg