CFD Online Logo CFD Online URL
Home > Forums > Mesh Generation & Pre-Processing Software > ANSA

ANSA_Scripting Batch mesh session and scenario

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Search this Thread Display Modes
Old   May 22, 2019, 05:51
Default ANSA_Scripting Batch mesh session and scenario
New Member
Rakesh kumar
Join Date: May 2019
Location: India
Posts: 1
Rep Power: 0
Rakesh@I is on a distinguished road
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 *

def main():

mesh_scen=batchmesh.GetNewMeshingScenario('New','P ARTS')
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)

if __name__ == '__main__':
Rakesh@I is offline   Reply With Quote

Old   June 14, 2019, 09:56
mahmoud aboukhedr
Join Date: Feb 2014
Location: London
Posts: 30
Rep Power: 7
Mahmoud_aboukhedr is on a distinguished road
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:

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)
Mahmoud_aboukhedr is offline   Reply With Quote


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

All times are GMT -4. The time now is 08:51.