How to identify selected line is straight or Curve?

Bhavik Sheth_21143
Bhavik Sheth_21143 Altair Community Member
edited August 2023 in Community Q&A

Hello Team,

I have used below function to select line.

*createmarkpanel lines 1 'Select line'the 
  set WCL [hm_getmark lines 1]
  *clearmark lines 1

After selection, I need to check whether selected line is straight or not.

Suggestion please how to proceed.

Thank you in advance.

 

Answers

  • Rishabh Awasthi_20948
    Rishabh Awasthi_20948
    Altair Employee
    edited August 2023

    Hello Bhavik

    You can try the following steps : 

    1. If a line is straight , the a center won't be created of this line type. In Hypermesh try to create a center node using straight line as an input and it would throw an error. 

    2. In Tcl scripting, you can find the command that finds center node for an arc/circle from reference guide . The commands are :                                                                                                                    *createlist nodes 1 1 2
    *linecreatefromnodes 1 0 150 5 179 

    3. You can introduce an error handling using a catch command to check if the input line given as an argument to this command  causes an error or not .

    *createlist nodes 1 1 2

    curve_list = [list]

    straight_line_list = [list]

    if ([catch {*linecreatefromnodes 1 0 150 5 179 }] == 1) {

    lappend straight_line_list $line_id # Find line id in your code

    # Line is straight 

    } else {

    #Line is a curve

    lappend curve_list $line_id # Find line id in your code

    }