CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Mesh Generation & Pre-Processing Software > ANSA

Ansa Python Scripting

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 28, 2017, 10:29
Default Ansa Python Scripting
  #1
New Member
 
Renuka
Join Date: Aug 2017
Posts: 15
Rep Power: 9
Renu123 is on a distinguished road
Hi all,
1. I want to read .ansa files contain in some directory, How I do that using python script?
using following function I am able to read only current file which is open in ansa gui
base.GetEntity(ansa.constants.NASTRAN, "PSHELL", 1)
Looking for function that able to read all file at ones.


2. I am also looking for function that gives normal to surface.


Thank you
Renu123 is offline   Reply With Quote

Old   August 29, 2017, 04:06
Default Ansa python scripting
  #2
Member
 
Maries
Join Date: Mar 2010
Location: Coimbatore, India
Posts: 76
Rep Power: 16
rmaries is on a distinguished road
Hi Renuka,

You can open ansa file with the command

base.open(filename)

Open, BETA PYTHON development Manual
NAME:
Open - Opens an existing file in ANSA.

SYNOPSIS:
ansa.base.Open(filename)

DESCRIPTION:
This function instructs ANSA to open an existing file.
Arguments

filename


RETURN:
It returns 0 in case of success or 0:OPEN_ANSA_FILE_SUCCESS, 1:OPEN_ANSA_FILE_PERMISSION_DENIED,
2:OPEN_ANSA_FILE_NOT_ANSA_DB, 3:OPEN_ANSA_FILE_NOT_VALID_CAD, 4:OPEN_ANSA_FILE_NOT_COMPATIBLE_DB,
5:OPEN_ANSA_FILE_READ_ERROR, 6:OPEN_ANSA_FILE_CAD_ERROR, 7:OPEN_ANSA_FILE_NOT_ALLOWED_IN_THIS_MODULE

EXAMPLE:
import ansa
from ansa import base


def main():

base.Open("C:/tmp/users/folder/data.ansa")


I attached the screenshot of the script window. You can search for the ansa script command or function in the right side of your script window.

You can learn ansa scripting by seeing the already available ansa scripts in ansa installation folder. You can source code of the user scripts in below folder BetaCAE\ansa_v17.1.2\scripts. You should know python and ansa to do scripting. Without having experience in ansa, scripting is going to be very difficult for you.

Regards
Maries

Quote:
Originally Posted by Renu123 View Post
Hi all,
1. I want to read .ansa files contain in some directory, How I do that using python script?
using following function I am able to read only current file which is open in ansa gui
base.GetEntity(ansa.constants.NASTRAN, "PSHELL", 1)
Looking for function that able to read all file at ones.


2. I am also looking for function that gives normal to surface.


Thank you
Attached Images
File Type: jpg ansa_open.jpg (107.7 KB, 56 views)
rmaries is offline   Reply With Quote

Old   August 29, 2017, 04:46
Default
  #3
New Member
 
Renuka
Join Date: Aug 2017
Posts: 15
Rep Power: 9
Renu123 is on a distinguished road
Quote:
Originally Posted by rmaries View Post
Hi Renuka,

You can open ansa file with the command

base.open(filename)

Open, BETA PYTHON development Manual
NAME:
Open - Opens an existing file in ANSA.

SYNOPSIS:
ansa.base.Open(filename)

DESCRIPTION:
This function instructs ANSA to open an existing file.
Arguments

filename


RETURN:
It returns 0 in case of success or 0:OPEN_ANSA_FILE_SUCCESS, 1:OPEN_ANSA_FILE_PERMISSION_DENIED,
2:OPEN_ANSA_FILE_NOT_ANSA_DB, 3:OPEN_ANSA_FILE_NOT_VALID_CAD, 4:OPEN_ANSA_FILE_NOT_COMPATIBLE_DB,
5:OPEN_ANSA_FILE_READ_ERROR, 6:OPEN_ANSA_FILE_CAD_ERROR, 7:OPEN_ANSA_FILE_NOT_ALLOWED_IN_THIS_MODULE

EXAMPLE:
import ansa
from ansa import base


def main():

base.Open("C:/tmp/users/folder/data.ansa")


I attached the screenshot of the script window. You can search for the ansa script command or function in the right side of your script window.

You can learn ansa scripting by seeing the already available ansa scripts in ansa installation folder. You can source code of the user scripts in below folder BetaCAE\ansa_v17.1.2\scripts. You should know python and ansa to do scripting. Without having experience in ansa, scripting is going to be very difficult for you.

Regards
Maries
Thank you for reply I will check it.
Renu123 is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[General] Filters using Python Scripting Birro ParaView 0 January 11, 2017 11:26
[ICEM] ICEM python geometry scripting eromon84 ANSYS Meshing & Geometry 0 December 12, 2015 12:39
python scripting in WB Windows.Forms OpenFileDialog() crashing mvoss CFX 0 November 4, 2011 04:46
Python Scripting - basic help atareen64 OpenFOAM Post-Processing 4 July 18, 2011 10:39
python scripting in paraFoam chegdan OpenFOAM Post-Processing 0 March 31, 2010 20:06


All times are GMT -4. The time now is 15:36.