HyperView customiztion

Beta
Beta New Altair Community Member
edited October 2020 in Community Q&A

Hi,

 

I am trying o write a script in HyperView.

 

My problem is I don't know how to plot the legend.

 

Below is my current code. I am able to apply displacement result on model but the legend doesn't show up.

        clear
        hwi OpenStack
        hwi GetSessionHandle session_handle
        session_handle New
        session_handle GetProjectHandle project_handle
        project_handle GetPageHandle page_handle [project_handle GetActivePage]
        page_handle GetWindowHandle window_handle [page_handle GetActiveWindow]
        window_handle GetClientHandle client_handle
        
        # load model #
        client_handle AddModel 'D:/P-optistruct/rs/OS-1050/dissimilar.h3d'
        client_handle GetModelHandle model_handle [client_handle GetActiveModel]
        client_handle SetDisplayOptions 'contour' true
        model_handle SetResult 'D:/P-optistruct/rs/OS-1050/dissimilar.h3d'
        model_handle GetResultCtrlHandle result_handle
        result_handle GetContourCtrlHandle contour_handle
        contour_handle SetEnableState true
        contour_handle SetDataType 'Displacement'
        contour_handle GetDataType
        contour_handle GetLegendHandle legend_handle
        legend_handle SetDefaultState True
        legend_handle SetPosition upper left
        client_handle Draw
        window_handle Draw    

        hwi CloseStack
        

 

 

please give me some advice. Thank you 

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2018

    Hi Toan,

     

    You need the following statement as well:

     client_handle SetDisplayOptions 'legend' true

     

  • Beta
    Beta New Altair Community Member
    edited March 2018

    Thank you.

     

    I am also trying to create a GUI. I used 'Keepontop' to keep the GUI window appear even when I switch to another program. This command works in HM but not in HV.

    Could you please show me another way to do this

  • tinh
    tinh Altair Community Member
    edited March 2018

    Hi,

    use  ::hwt::KeepOnTop

     

    in hypermesh the proc KeepOnTop is pushed to global ns

  • Beta
    Beta New Altair Community Member
    edited March 2018

    Thank you very much

     

  • Beta
    Beta New Altair Community Member
    edited March 2018

    One more question. I am also trying to write macro for HyperGraph 2D. 

     

    I can not execute the command 'SelectYComponent' to select Component for graph.

     

    Below is my code.

     

    Please give me any advice:\

     set file_path 'D:/P-optistruct/rs/OS-1050/dissimilar.h3d' 	 	hwi OpenStack 		 	hwi GetSessionHandle session_handle 	session_handle New 	session_handle GetProjectHandle project_handle 	session_handle GetClientManagerHandle plot_manager Plot 	project_handle GetPageHandle page_handle [project_handle GetActivePage] 	 	page_handle GetWindowHandle window_handle_2 1 	page_handle SetActiveWindow 1 	window_handle_2 SetClientType Plot 	window_handle_2 GetClientHandle client_handle_2 	plot_manager GetBuildPlotsCtrlHandle build_plot 	build_plot SelectDataFile '$file_path' 	build_plot GetActiveFilename 	build_plot SetXDatatype 'Time' 	build_plot SetYDatatype 'Displacement' 	build_plot SelectYRequests {'N5'}  	build_plot GetComponentList 'True' 	build_plot SelectYComponent {'X' 'Y' 'Z' 'MAG'} 	build_plot GeneratePlots 	client_handle_2 Draw 	 	hwi CloseStack 	

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2018

    Hi Toan,

     

    You can give multiple components, so the statement below is correct.

     build_plot SelectYComponents {'X' 'Y' 'Z' 'MAG'} 

    Please give it a try.

  • Aniket Jadhav
    Aniket Jadhav New Altair Community Member
    edited May 2020

    Hello Toan,

     

    I am also trying to write macro for HyperGraph 2D with your script you mentioned above, But I'm not able to get output.

    Have you succeed in your script? 

    Please give me advice.

     

    Thanks,