normals adjustment

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

hi there..!!!

i am trying to write the macro for normals adjustments.

here is the way i want the macro to work:

i would like to select a element for orientation.

macro should adjust the normals of the components attached to the selected elements and orientation should be as per the selected elements.

i am not succesful in creating this macro but i tried this way..

*createmarkpanel elements 1'select orientation element'

set d [hm_getmark elements 1]

*createmark elements 1 $d

*findmark elements 1 1 1 elements 0 2

set elementset [ hm_getmark elements 2 ]

set compid [ hm_getentityvalue ELEMENTS [ lindex $elementset 0 ] 'collector.id' 0 ]

*createmark comps 2 $compid

set maxcomp [ hm_entitymaxid comps 1]

*normalsadjust components 2 1 0 0

its giving the error... 'elements have not been selected'

i also request you to help me understand * findmark syntax and *normaladjust syntax.

thanks for ur help in advance.

Regards,

Kiran

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2011

    [uPDATE: ]

    *createmarkpanel elements 1 'Select orientation element';set d [hm_getmark elements 1];hm_createmark elements 1 $d;hm_createmark elems 2 $d;hm_appendmark elems 2 'advanced' 'by attached';*normalsadjust elems 2 $d 0 0;*normalsoff;

    this will change the normals of all of the attached element to the selected element. Maybe you need to remove the non-2D-elements.

    here is a simpler script, ignore the other one.

    //----------------------------------------------------------------------------------------------------------------------------------

    your code seems OK, but there is one tiny error, on the *normaladjust, you need to provide the id of the element, not a mark containing the element. Here is the modified code with some modifications.

    *createmarkpanel elements 1 'Select orientation element';

    set d [hm_getmark elements 1];

    hm_createmark elements 1 $d;

    *findmark elements 1 1 1 elements 0 2;

    set elementset [ hm_getmark elements 2 ];

    set compid [ hm_getentityvalue ELEMENTS [ lindex $elementset 0 ] 'collector.id' 0 ];

    hm_createmark comps 2 $compid

    #set maxcomp [ hm_entitymaxid comps 1];

    *normalsadjust components 2 $d 0 0