CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 22, 2019, 05:51
Default ANSA_Scripting Batch mesh session and scenario
  #1
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 *
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()
Rakesh@I is offline   Reply With Quote

Old   June 14, 2019, 09:56
Default
  #2
Member
 
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:

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

Reply

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.