In TCL How to skip command if it dosen't have any entity to select.

User: "shubham Dhokare_21832"
Altair Community Member
Updated by shubham Dhokare_21832

Hello everyone,

I have created a sample script attached below. I want a modification in it. For example if I want to move knuckle solid in knuckle comps, but If I didn't receive the knuckle geometry from my client and I run the script. If this solid is not there to select then this command file stops and execute an error. So I want to skip the particular commands if there is no solid for selection.

*createentity comps includeid=0 name="KNUCKLE"
*createmarkpanel solids 1 "Select Knuckle Geometry";
*movemark solids 1 "KNUCKLE"
*createmark components 3 "KNUCKLE"
*createstringarray 2 "elements_off" "geometry_on"
*hideentitybymark 3 1 2
*clearmark solids 1
*createentity comps includeid=0 name="DISC"

 

so in the createmarkpanel if I didn't have any geometry to select .... and without selecting any geometry if I proceed it should skip the commands till createenity comps includeid=0

So if solution available please guide

Thanks & Regards,

Shubham Dhokare

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "Hypermesh User"
    Altair Community Member
    Accepted Answer
    Updated by Hypermesh User

    Hi Shubham,

      hope this will help you..

     

    #create the list of part name to be created.

    #APpend your 16 solid name in the list.

    #create the list of part name to be created.


    set Listpartname { KNUCKLE DISC }

    foreach {partname} $Listpartname {

     

    *createmarkpanel solids 1 "Select $partname Geometry";

    if {[llength [hm_getmark solids 1]] > 0} {

    *createentity comps includeid=0 name="$partname"
    *movemark solids 1 "$partname"
    *createmark components 3 "$partname"
    *createstringarray 2 "elements_off" "geometry_on"
    *hideentitybymark 3 1 2
    *clearmark solids 1
    }

    }

     

     

    Regards,

     

    Manoj