Extent of Simlab

Skull
Skull Altair Community Member
edited October 2020 in Community Q&A

I want to rename a no. of bodies to a defined name after I import the parasolid into Simlab 14.1. And I am trying to automate the process.

 

For example, right now what i can do is change the name of 'Body 2' to 'xyz' through scripts. What i want is to get this input from user, like select the body to rename it to 'xyz'.

 

Is this possible in Simlab through the method of JScripts ?

Tagged:

Answers

  • tinh
    tinh Altair Community Member
    edited August 2017

    I think you have to get names of bodies, and show them in a listview, then you can pick one to rename

    but I don't know how to do that by JScripts.

  • Rahul Rajan_21763
    Rahul Rajan_21763 New Altair Community Member
    edited August 2017

    Yes it is possible user defined names.We have utility functions in help page in scripting.

    <?xml version="1.0" encoding="UTF-8"?>scripting utilities.JPG

  • Skull
    Skull Altair Community Member
    edited August 2017

    Yes it is possible user defined names.We have utility functions in help page in scripting.

    <?xml version="1.0" encoding="UTF-8"?>scripting utilities.JPG

    So i can get the input from user, prompt the userto select which body he wants to rename. 

  • Rahul Rajan_21763
    Rahul Rajan_21763 New Altair Community Member
    edited August 2017

    Yes it will prompt.

     

  • Skull
    Skull Altair Community Member
    edited August 2017

    Yes it will prompt.

     

    Also. Lets take a basic example. There is a cube. And i want to fix one side of the cube. And i have to repeat this task for  many cubes with different sizes. 

     

    So is it possible in simlab that the simlab detects the face to be fixed automatically by giving something to the software to detect the face. 

     

     

    Also can you help me out with the way by which simlab number the different faces while importing parasolid. Or the process is random. 

  • Skull
    Skull Altair Community Member
    edited August 2017

    Yes it will prompt.

     

    are you talking about creating the groups and prompting the user to select bodies to be part of that group. 

     

    Can i do this without creating groups?

  • Rahul Rajan_21763
    Rahul Rajan_21763 New Altair Community Member
    edited August 2017

    are you talking about creating the groups and prompting the user to select bodies to be part of that group. 

     

    Can i do this without creating groups?

    It is must to have group for this case.

  • Rahul Rajan_21763
    Rahul Rajan_21763 New Altair Community Member
    edited August 2017

    Also. Lets take a basic example. There is a cube. And i want to fix one side of the cube. And i have to repeat this task for  many cubes with different sizes. 

     

    So is it possible in simlab that the simlab detects the face to be fixed automatically by giving something to the software to detect the face. 

     

     

    Also can you help me out with the way by which simlab number the different faces while importing parasolid. Or the process is random. 

    You can use transfer groups here. Numbering of faces can be done internally by software.So it random.
    Create group for in the cube (CAD)
    Mesh it.
    Transfer the groups to the Mesh body
    If you give the Same group name for different cubes you can easily script this.
     

  • Skull
    Skull Altair Community Member
    edited September 2017

    You can use transfer groups here. Numbering of faces can be done internally by software.So it random.
    Create group for in the cube (CAD)
    Mesh it.
    Transfer the groups to the Mesh body
    If you give the Same group name for different cubes you can easily script this.
     

    You are getting, what i am trying to do. 

     

    Let me try to tell you it in this way,

     

    Suppose i want to make a script, in which. When the user selects a body. A message box pops up stating the name of the body.  Is this possible in simlab?

  • Skull
    Skull Altair Community Member
    edited September 2017

    You can use transfer groups here. Numbering of faces can be done internally by software.So it random.
    Create group for in the cube (CAD)
    Mesh it.
    Transfer the groups to the Mesh body
    If you give the Same group name for different cubes you can easily script this.
     

    I want to get the name of the body selected by the user in a variable , is this possible in simlab ?

     

    Like when i select a body , The body ID and body name  is shown in the output tab. So can i store that value in a variable ?

     

  • Skull
    Skull Altair Community Member
    edited September 2017

    You can use transfer groups here. Numbering of faces can be done internally by software.So it random.
    Create group for in the cube (CAD)
    Mesh it.
    Transfer the groups to the Mesh body
    If you give the Same group name for different cubes you can easily script this.
     

    any help Rahul?

  • siddharth_dv
    siddharth_dv New Altair Community Member
    edited September 2017

    Like when i select a body , The body ID and body name  is shown in the output tab. So can i store that value in a variable ?

     

    Hi,

     

    You can store the body name as parameters with the type as 'String'.

     

    var Mname = SimLabUtility.GetStringParameter('$ModelName')

     

    Once you have set is as a parameter , you can directly call the above function, the body name is stored in 'Mname' variable. The supporting file is present in SimLab help.

    When you are working on different cubes , upfront you set it as string parameter , you can make it work for different scripts.

     

    For creation of parameters you can go to option Project > Parameters , and set the values there. Attached screenshot for reference.

     

    Thanks

    Siddharth

     

    <?xml version="1.0" encoding="UTF-8"?>getdouble_parameter.PNG

    <?xml version="1.0" encoding="UTF-8"?>Parameter.PNG