Determine element normal directions in Batch mode using tcl

Roshan Shiveshwar
Roshan Shiveshwar Altair Community Member
edited October 2020 in Community Q&A

Hi,

 

I am trying to create a tcl script that is supposed to find the element normal direction for a component/body.  I want to run the script in batch mode and obtain the output (normal direction) in a text file. Is there any way I can achieve this? Please refer to the attached snapshots for better understanding.

 

Note: All element normals for a particular body are in the same direction.

 

Thanks & Regards,

Roshan

 

<?xml version="1.0" encoding="UTF-8"?>Normals-Blue.JPG

 

Answers

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited December 2017

    Try this code:

     hm_markclear elements 1 *createmarkpanel elements 1 'Select Shell Elements' set myelems [hm_getmark elements 1] foreach eid $myelems { 	set nx [hm_getvalue elems id=$eid dataname=normalx]	 	set ny [hm_getvalue elems id=$eid dataname=normaly]	 	set nz [hm_getvalue elems id=$eid dataname=normalz]	 	puts [format '%d %0.6E %0.6E %0.6E' $eid $nx $ny $nz] } hm_markclear elements 1

     

    HTH

  • Roshan Shiveshwar
    Roshan Shiveshwar Altair Community Member
    edited December 2017

    Thanks Q.Nguyen-Dai.

     

    With the above code I am able to get normal components in x,y&z directions. But, I am trying to capture whether the normals are inwards or outwards for a particular body.

    In HM , visually it is possible to capture this information (depending  on the color  red or blue ). So, I am looking for a code to capture this without any user intervention.

     

    Please check the example picture for reference.

     

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited December 2017

    Maybe try the command *normalsadjust2 ?

    normalsadjust2_s.png.e9f01a5656f92e7057937e85332a40ca.png