CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ANSA (https://www.cfd-online.com/Forums/ansa/)
-   -   ANSA_Scripting Batch mesh session and scenario (https://www.cfd-online.com/Forums/ansa/217716-ansa_scripting-batch-mesh-session-scenario.html)

Rakesh@I May 22, 2019 05:51

ANSA_Scripting Batch mesh session and scenario
 
Hi all,

I am new to Pyhon scripting, and i generated the following code to automate the batch mesh generation process by giving reference to saved mesh parameters and quality criteria files.

The mesh is generated , and the specific session is running but the part is not getting allocated to the component.PFA screenshots.

import os
import ansa
from ansa import *
deck=constants.ABAQUS

def main():

mesh_scen=batchmesh.GetNewMeshingScenario('New','P ARTS')
session=batchmesh.GetNewSession('s1')
parts = base.CollectEntities (deck, None, 'ANSAPART')
batchmesh.AddPartToMeshingScenario (parts, mesh_scen)
batchmesh.AddSessionToMeshingScenario(session, mesh_scen)
ret_val=batchmesh.ReadSessionMeshParams(session,'D :/Rakesh/param1.ansa_mpar')
ret_val2=batchmesh.ReadSessionQualityCriteria(sess ion,'D:/Rakesh/quality.ansa_qual')


status = batchmesh.RunMeshingScenario(mesh_scen, 30)
print(ret_val)
print(ret_val2)
print(status)


if __name__ == '__main__':
main()

Mahmoud_aboukhedr June 14, 2019 09:56

If I understand correctly, your request is to get a screenshot after running the batch mesh script. If so, you can use something similar to the code below:

Code:

status = utils.SnapShot(abs_filename_1, image_format='PNG', transparent=True)
        if status == 0:
                print('Image saved in ' + abs_filename_1)
        status = utils.SnapShot(abs_filename_2, red=100, green=140, blue=210, text_axes=False)
        if status == 0:
                print('Image saved in ' + abs_filename_2)


Rakesh@I June 27, 2019 05:26

Mistake in Mesh criteria allocation to geometry
 
My requirement is not to get the screenshot after batch meshing.
My requirement is to run the script when ever i got the job for that particular component.
But after running the script ,the geometry is not getting allocated to the mesh parameters.In the meshing scenario, only mesh parametrs are showing after running this script,but not the contents( i mean geometry).

In my input geometry, i am keeeping only the component that is required to mesh.

The return values are only for checking whether it is executing or not.

I hope no coonfusions


All times are GMT -4. The time now is 13:29.