separating parts using TCL/TK

Aravind palaparthi_22503
Aravind palaparthi_22503 Altair Community Member
edited July 2023 in Community Q&A

Hi,

I have a component which is made into a single solid component but originally it has few separate parts. 

can I separate it using any scripts in tcl/tk to see the parts separately?

I need to do this to see the parts dimensions individually.

Let me know , if it is possible.

 

Regards,

Aravind

Tagged:

Answers

  • Adriano_Koga
    Adriano_Koga
    Altair Employee
    edited July 2023

    i would start doing this operation manually in the GUI, and then after 2 or 3 times, check the command.tcl and get from there the commands necessary and adapt them to your script.

     

    Probably you would:

    - create a new component

    - select one solid

    - organize this solid into the new component

    - loop over and over again until your solids are all organized.

     

     

     

    In the past I did something similar, but for surfs, as you find below.

    This script splits surfaces in a single component, into several different components, one for each surf.

    Maybe you could adapt this one,.

     

    *clearmark comps 1
    *clearmark properties 1
    *clearmark materials 1

    #selecting surfaces for which the components and properties will be created
    *createmarkpanel surfs 1 "Select the surfaces to generate properties for:"
    set surfslist [hm_getmark surfs 1]
    *clearmark surfs 1


    hm_blockerrormessages 1
    hm_blockmessages 1
    *entityhighlighting 0
    #hwbrowsermanager view flush false

     

    #get altair home directory
    set home_dir [hm_info -appinfo ALTAIR_HOME]

    #create a dummy material, in case there is no existent material
    *collectorcreateonly materials "^dummy" "" 5
    *createmark materials 1 "^dummy"
    *dictionaryload materials 1 "${home_dir}/templates/feoutput/optistruct/optistruct" "MAT1"
    *initializeattributes materials "^dummy"
    *clearmark materials 1

    #selecting default material
    *createmarkpanel material 1 "Define the default material (To be applied to all selected properties)"
    set material_name [hm_getentityvalue material [hm_getmark material 1] name 1]

    #if SHELL
    #defining base shell thicknesses
    set shell_thick [hm_getfloat "Shell Thicknesses" "Define SHELL initial thicknesses (REAL>0)"]

    set count 1

    *entityhighlighting 0 

    foreach surf $surfslist {


        #creating new comp 
        set comp_name "COMP_$count" 
        
        *collectorcreateonly components $comp_name "" 5

        *createmark surfaces 1 $surf
        *movemark surfaces 1 $comp_name 
                
        #creating and assigning properties
        *collectorcreateonly properties $comp_name "" 5 
        *createmark properties 1 $comp_name
        *dictionaryload properties 1 "${home_dir}/templates/feoutput/optistruct/optistruct" "PSHELL" 
        *initializeattributes properties $comp_name 
        *materialupdate properties 1 $material_name 
        *createmark properties 1 $comp_name
        set prop_id [hm_getmark properties 1]
        *attributeupdatedouble properties $prop_id 95 1 1 0 $shell_thick 
            
        *createmark components 1  $comp_name
        *propertyupdate components 1 $comp_name
        
        incr count

    }

    *entityhighlighting 1 

    *createmark comps 1 "all"
    *autocolorwithmark comps 1

    *createmark properties 1 "all"
    *autocolorwithmark properties 1

    *clearmark comps 1
    *clearmark properties 1
    *clearmark materials 1

    hm_blockmessages 0
    hm_blockerrormessages 0
    *entityhighlighting 1   
    #hwbrowsermanager view flush true

     

    tk_messageBox -message "Property creation and assignment completed!"

     

     

     

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.