Jump to content
Vikas Kumar

Querying about some element for 1D- stress value

Recommended Posts

Dear all,

 

I wants to perform query for some element not for whole model as shown in below picture.

 

image.png.40bfadeff4e11978f61dda1d28f13a9d.png

 

I am trying with this code but in this it is giving miximum value only for whole model but i want result for specific element ID. can anyone help me.

 

My code is.

                                     Model handle i got earlier as mh$t .

                                    mh$t GetQueryCtrlHandle qch$t
                                    qch$t SetDataSourceProperty result datatype Stress
                                    set set_query "contour top 1"
                                    set set_result_component "contour.value"
                                    set id_SelectedNode [mh$t AddSelectionSet element]
                                    mh$t GetSelectionSetHandle selection_set_handle_node$t $id_SelectedNode
                                    # selection_set_handle_node$t Add $set_query
                                    selection_set_handle_node$t Add $SpecificElem_ID ; # adding specific element which was added b4 
                                    qch$t SetSelectionSet $id_SelectedNode
                                    qch$t SetQuery "contour.value"
                                    qch$t GetIteratorHandle i$t
                                    i$t First
                                    if { [i$t Valid] } {
                                        set contourValue [i$t GetDataList]
                                        puts "contourValue: $contourValue"
                                    } else {
                                        set contourValue "N/A"
                                    }

 

Thanks,

Vikas Kumar

 

Share this post


Link to post
Share on other sites

Hi Vikas,

You can pass the element Ids you want to the below procedure:

 

proc contourValue {lst_elements} {
    hwi OpenStack
        set t [clock clicks]
        hwi GetSessionHandle session$t
        session$t GetProjectHandle project$t
        project$t GetPageHandle page$t 1
        page$t GetWindowHandle win$t 1
        win$t GetClientHandle anim$t
        anim$t GetModelHandle my_model$t [anim GetActiveModel]
        my_model$t GetQueryCtrlHandle my_query$t
        set set_id [my_model$t AddSelectionSet element]
        my_model$t GetSelectionSetHandle elem_set$t $set_id
        foreach id $lst_elements {
            elem_set$t Add "id $id"
        }
        my_query$t SetSelectionSet $set_id
        # my_query$t SetQuery "element.id contour.value";
        my_query$t SetQuery "contour.value"; #only contour value
        my_query$t GetIteratorHandle my_iter$t
        set data_list ""
        for {my_iter$t First} {[my_iter$t Valid]} {my_iter$t Next} {
        lappend data_list [my_iter$t GetDataList]
        }
        puts "$data_list----data_list";
        my_model RemoveSelectionSet $set_id
    hwi CloseStack
}

Regards

llyle

vipin likes this

Share this post


Link to post
Share on other sites

source the proc contourValue above,

 

set lst_elems  {700001 700002 700003}

contourValue $lst_elems

 

I would recommend you to get more familiar with tcl programming before getting into HV automation. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...