Simlab Automation Get model name for node position from node ID

AjayBorah
AjayBorah Altair Community Member
edited March 2023 in Community Q&A

Hello,

I am trying get model name for node position as script below

Center17673=simlab.getNodePositionFromNodeID("'''FEMModelName'''",5);
Center17674=simlab.getNodePositionFromNodeID("'''FEMModelName'''",4);
Center17675=simlab.getNodePositionFromNodeID("'''FEMModelName'''",6);
Center17676=simlab.getNodePositionFromNodeID("'''FEMModelName'''",2);
Center17677=simlab.getNodePositionFromNodeID("'''FEMModelName'''",1);
Center17678=simlab.getNodePositionFromNodeID("'''FEMModelName'''",7);


FEMModelName = simlab.getModelName("FEM");

MatchNodes=''' <MatchNodes CheckBox="ON" UUID="a1c0401f-a4d1-4f7a-8ae7-47f59af07ae7" gda="">
  <tag Value="-1"/>
  <Name Value=""/>
  <copy Value="FALSE"/>
  <lbc Value="FALSE"/>
  <flip Value="0"/>
  <FixedNode>
   <Entities>
    <Model>'''+FEMModelName+'''</Model>
    <Node>5,4,6,</Node>
   </Entities>
  </FixedNode>
  <MovableNode>
   <Entities>
    <Model>'''+FEMModelName+'''</Model>
    <Node>2,1,7,</Node>
   </Entities>
  </MovableNode>
  <Point1 Value="'''+str(Center17673).strip('()')+'''"/>
  <Point2 Value="'''+str(Center17674).strip('()')+'''"/>
  <Point3 Value="'''+str(Center17675).strip('()')+'''"/>
  <Point4 Value="'''+str(Center17676).strip('()')+'''"/>
  <Point5 Value="'''+str(Center17677).strip('()')+'''"/>
  <Point6 Value="'''+str(Center17678).strip('()')+'''"/>
  <Body>
   <Entities>
    <Model>'''+FEMModelName+'''</Model>
    <Body></Body>
   </Entities>
  </Body>
  <Output/>
 </MatchNodes>''';
simlab.execute(MatchNodes);

 

Getting Error as below...can anyone guide for the same

getModelName-------------------------------------- Passed

getNodePositionFromNodeID------------------------- Failed
    Model name not found

getNodePositionFromNodeID------------------------- Failed
    Model name not found

getNodePositionFromNodeID------------------------- Failed
    Model name not found

getNodePositionFromNodeID------------------------- Failed
    Model name not found

getNodePositionFromNodeID------------------------- Failed
    Model name not found

getNodePositionFromNodeID------------------------- Failed
    Model name not found

getModelName-------------------------------------- Passed

MatchNodes---------------------------------------- Failed
 Fixed points are colinear. Please review your selection.

 

Thank you

Best Answer

  • AlessioLibrandi
    AlessioLibrandi
    Altair Employee
    edited March 2023 Answer ✓

    Hello,

    this syntax

    Center17673=simlab.getNodePositionFromNodeID("'''FEMModelName'''",5);

    Seems wrong to me.

     

    Let's say, my model is called AA.gda and I want to find the position of the node 5360

    I can use the command
    Center=simlab.getNodePositionFromNodeID("AA.gda",5360);

    Now, if I put the model name in a string named FEMModelName:

    FEMModelName='AA.gda';

    then I can use the string variable in my syntax as follows:

    Center1=simlab.getNodePositionFromNodeID(FEMModelName,5360)

     

    The ''''' are not needed there, if FEMModelName is a python variable.

    I hope this can help.

     

    Alessio

Answers

  • AlessioLibrandi
    AlessioLibrandi
    Altair Employee
    edited March 2023 Answer ✓

    Hello,

    this syntax

    Center17673=simlab.getNodePositionFromNodeID("'''FEMModelName'''",5);

    Seems wrong to me.

     

    Let's say, my model is called AA.gda and I want to find the position of the node 5360

    I can use the command
    Center=simlab.getNodePositionFromNodeID("AA.gda",5360);

    Now, if I put the model name in a string named FEMModelName:

    FEMModelName='AA.gda';

    then I can use the string variable in my syntax as follows:

    Center1=simlab.getNodePositionFromNodeID(FEMModelName,5360)

     

    The ''''' are not needed there, if FEMModelName is a python variable.

    I hope this can help.

     

    Alessio

  • AjayBorah
    AjayBorah Altair Community Member
    edited March 2023

    Hello,

    this syntax

    Center17673=simlab.getNodePositionFromNodeID("'''FEMModelName'''",5);

    Seems wrong to me.

     

    Let's say, my model is called AA.gda and I want to find the position of the node 5360

    I can use the command
    Center=simlab.getNodePositionFromNodeID("AA.gda",5360);

    Now, if I put the model name in a string named FEMModelName:

    FEMModelName='AA.gda';

    then I can use the string variable in my syntax as follows:

    Center1=simlab.getNodePositionFromNodeID(FEMModelName,5360)

     

    The ''''' are not needed there, if FEMModelName is a python variable.

    I hope this can help.

     

    Alessio

    Hello Alessio,

    It worked perfect...Thank you

    I have an another issue of getting FE model name for renumbering

    FEMModelName = simlab.getModelName("FEM");

    Renumber=''' <Renumber UUID="28706164-a6f5-4544-b4a9-c052c4b6c60f">
      <Option Value="Nodes"/>
      <Selection Value="Model"/>
      <AdvancedOption>
       <SurfaceAndInterior Value="false"/>
       <CornerAndMid Value="false"/>
      </AdvancedOption>
      <RenumberData>
       <Model>'''+FEMModelName+'''</Model>
        <NodeStartID>101</NodeStartID>
       </Model>
      </RenumberData>
      <FileName Value=""/>
     </Renumber>''';
    simlab.execute(Renumber);

     

    The task shows passed d but the model is not renumbered..

    But when i check with actual model name its working..

    Renumber=''' <Renumber UUID="28706164-a6f5-4544-b4a9-c052c4b6c60f">
      <Option Value="Nodes"/>
      <Selection Value="Model"/>
      <AdvancedOption>
       <SurfaceAndInterior Value="false"/>
       <CornerAndMid Value="false"/>
      </AdvancedOption>
      <RenumberData>
       <Model Name="sample__source change_sltr1_SM.gda">
        <NodeStartID>101</NodeStartID>
       </Model>
      </RenumberData>
      <FileName Value=""/>
     </Renumber>''';
    simlab.execute(Renumber);

    May be again syntex error ....

    Kindly guide.

     

    Thnak you

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.