hyperview isolate a component by tcl script

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

Hello

 

So I am developing a script in which I need to display a particular component using script

 

name and ID of component is know

 

So how to do it??

Tagged:

Answers

  • QuyNguyenDai
    QuyNguyenDai Altair Community Member
    edited December 2016

    Do what do you want in interactive mode. Then have a look at file 'command.tcl'. You'll found the command for your script.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2016

    and where can I find 'command.tcl'

     

    Is it available for hyperview??

  • QuyNguyenDai
    QuyNguyenDai Altair Community Member
    edited December 2016

    Sorry, only for Hypermesh.

  • Andy Ellis_21076
    Andy Ellis_21076 Altair Community Member
    edited December 2023

    I realise this is an old thread, but it's had a lot of views and I have a solution that may benefit future users of HyperView:

     

    proc isolate_comp { comp_id } {
        # this procedure masks all of the model elements before displaying only the specified component
        # begin automatic handle tracking
        hwi OpenStack
        set ui [expr rand()];
        # get handles down to model and view level
        hwi GetSessionHandle my_session$ui
        my_session$ui GetProjectHandle my_project$ui
        my_project$ui GetPageHandle my_page$ui [my_project$ui GetActivePage]
        my_page$ui GetWindowHandle my_window$ui [my_page$ui GetActiveWindow]
        my_window$ui GetClientHandle my_client$ui
        my_window$ui GetViewControlHandle my_view$ui
        my_client$ui GetModelHandle my_model$ui [my_client$ui GetActiveModel]
        # mask all parts
        my_model$ui MaskAll part
        # create a temporary selection set of component type, give it a unique label and make sure that it's empty to begin with
        my_model$ui GetSelectionSetHandle ssh$ui [my_model$ui AddSelectionSet component]
        ssh$ui SetLabel "SelectionSet$ui"
        ssh$ui Clear
        # making the select mode "all" allows hidden entities to be selected
        ssh$ui SetSelectMode all
        # add the specified component id to the selection set
        ssh$ui Add "component $comp_id"
        # unmask selected set, fit the view and redraw
        set tempsetnum [ssh$ui GetID]
        my_model$ui UnMask $tempsetnum
        my_view$ui Fit
        my_page$ui Draw
        # remove the temporary selection set, leaving the component elements displayed
        my_model$ui RemoveSelectionSet [ssh$ui GetID]
        # release handles
        ssh$ui  ReleaseHandle
        my_model$ui ReleaseHandle
        my_view$ui ReleaseHandle
        my_client$ui ReleaseHandle
        my_window$ui ReleaseHandle
        my_page$ui  ReleaseHandle
        my_project$ui  ReleaseHandle
        my_session$ui  ReleaseHandle
        hwi CloseStack
    }
     
     
    # this is the line to set the component id number that will be isolated:
    set component_id_number 2
    # this is the line to call the procedure that will isolate the specified component:
    isolate_comp $component_id_number