|
[Sponsors] |
November 28, 2013, 05:38 |
|
#21 | |
New Member
Mihai Cris
Join Date: Nov 2013
Posts: 5
Rep Power: 12 |
Quote:
Thank you for answering me. What exactly should I write in this ANSA_TRANSL? Please do not forget I want to load python scripts. For old bs scripts it should be somethig like: #include "/path_to_script/myscript.bs" How should it be for python, just writing #include "/path_to_script/myscript.py" does not work... Cheers |
||
November 28, 2013, 06:16 |
|
#22 |
Senior Member
Vangelis Skaperdas
Join Date: Mar 2009
Location: Thessaloniki, Greece
Posts: 287
Rep Power: 21 |
Hello Mihai,
You are right, some clarifications for python scripts 1) The file must be called ANSA_TRANSL.py 2) In this file you must have entries like: import ansa ansa.ImportCode('/home/user/my_functions.py') ansa.ImportCode('/home/user/my_functions2.py') ansa.ImportCode('/home/user/my_functions3.py') Vangelis |
|
November 28, 2013, 06:40 |
|
#23 |
New Member
Mihai Cris
Join Date: Nov 2013
Posts: 5
Rep Power: 12 |
Hello Vanghelis
Thank you again. I have the sensation that we are slowly converging to a solution. Just a few increments more... So... if I include my scripts in the ANSA_TRANSL.py with the code you suggested: - ANSA_TRANSL.py is loaded at ANSA start, shows up in Available modules section at Script>Run function - none of the functions from "my_functions.py are" available, they do not appear in function list in the same dialog. Just to eliminate a possible question, I can manually load my script without ANSA_TRANSL and run it, so it is a valid script. |
|
November 28, 2013, 06:45 |
|
#24 |
Senior Member
Vangelis Skaperdas
Join Date: Mar 2009
Location: Thessaloniki, Greece
Posts: 287
Rep Power: 21 |
Hello Mihai,
When you place your scripts in ANSA_TRANSL.py and start ANSA, what are the messages reported in the ANSA Info Window when ANSA starts? Can you copy paste all messages? Vangelis |
|
November 28, 2013, 07:16 |
|
#25 |
New Member
Mihai Cris
Join Date: Nov 2013
Posts: 5
Rep Power: 12 |
Hello Vanghelis
Error messages are... a lot of messages, but unimportant now, It is finally solved now. With help from you and from the manual of course, it was there all along. Again! I do not know how I could miss it. Again! So... for anybody else, if you have a file named say.. myLibrary.py importing all the functions from that file at ANSA start, using ANSA_TRANSL is done this way: import ansa ansa.ImportCode("/path_to_file/myLibrary.py") from myLibrary import * The last line appears in the ansa_python document as import myLibrary, it does not offer acces to the functions inside the file (at least in my case). |
|
November 28, 2013, 08:39 |
|
#26 |
Senior Member
Vangelis Skaperdas
Join Date: Mar 2009
Location: Thessaloniki, Greece
Posts: 287
Rep Power: 21 |
glad you've worked it out!
|
|
April 8, 2014, 03:02 |
|
#27 |
New Member
sajun prasad
Join Date: Apr 2014
Posts: 4
Rep Power: 12 |
Good Morning all,
can anyone kindly guide me for my question below please. 1. how to read excel file in ansa scripting( i want to import it and read it while executing it). thank you very much for time taken to read it. |
|
April 8, 2014, 09:35 |
You can do that with python and pyxll library
|
#28 | |
Member
Maries
Join Date: Mar 2010
Location: Cologne, Germany
Posts: 75
Rep Power: 16 |
Quote:
You can write the script using python. There is an external library pyxll(and many more are there), you can use it to open the excel file. you can download the library here https://www.pyxll.com |
||
April 8, 2014, 23:54 |
|
#29 |
New Member
sajun prasad
Join Date: Apr 2014
Posts: 4
Rep Power: 12 |
hi maries,
thank you very much for your suggestion, but i would lik to know how to do it ANSA too. |
|
April 9, 2014, 00:37 |
|
#30 |
Member
Maries
Join Date: Mar 2010
Location: Cologne, Germany
Posts: 75
Rep Power: 16 |
||
April 9, 2014, 00:52 |
|
#31 |
New Member
sajun prasad
Join Date: Apr 2014
Posts: 4
Rep Power: 12 |
Good morning Maries ,
Currently i am working in Beta script and have to execute that in ANSA. I ll check that and i will come back to you.actually i m kinda new to scripting so may take time. Warm regards Sajun |
|
April 9, 2014, 00:56 |
|
#32 | |
Member
Maries
Join Date: Mar 2010
Location: Cologne, Germany
Posts: 75
Rep Power: 16 |
Quote:
Ansa version < 14 doesn't support python scripting. You can do scripting only in Beta script. Thanks & Regards Maries |
||
April 15, 2014, 07:56 |
|
#33 |
New Member
sajun prasad
Join Date: Apr 2014
Posts: 4
Rep Power: 12 |
hi maries,
there is a inbuilt function in ANSA itself ,to read and access the excel file. anyways thanks for your help. Regards sajun |
|
May 6, 2014, 04:37 |
ansa scripting
|
#34 |
New Member
Bharat
Join Date: Oct 2011
Posts: 1
Rep Power: 0 |
I am a new and just started scripting in ANSA_v15.
1. If I have to add Menu button just next to "File, Window, Containers, Tools, MyMenu, Utilities, Assembly, Help". How can I add? 2. How to attach a script in User Button Script window? 3. If I create "User Menu" from Settings>Buttons Manager > Create Menu, do we attach script to it? 4. Where to see available APIs to call functionality from ANSA? B. Last edited by sbharatk; May 6, 2014 at 06:30. |
|
May 25, 2014, 04:29 |
Storing XML connection data
|
#35 |
New Member
Ganesh
Join Date: Jan 2013
Posts: 6
Rep Power: 13 |
Hi All,
I used Read connections command for reading connection file. I like to store the information after reading the data. e.g : dia, x.y.z let me know if anyone has some method on the same. Thanks Ganesh |
|
June 1, 2015, 16:37 |
How to convert .py to .pyb
|
#36 |
New Member
Felipe
Join Date: Jun 2015
Posts: 3
Rep Power: 11 |
Hi Members...
I'm new in ANSA and I created a simple script with extension .py, I just want to know how can I convert it to encripted .pyb file? Thanks, Felipe |
|
June 2, 2015, 04:06 |
|
#37 |
Member
Maries
Join Date: Mar 2010
Location: Cologne, Germany
Posts: 75
Rep Power: 16 |
||
June 2, 2015, 08:19 |
|
#38 |
New Member
Felipe
Join Date: Jun 2015
Posts: 3
Rep Power: 11 |
Thanks rmaries !!!!
|
|
July 30, 2015, 12:09 |
ANSA script to create cylinder
|
#39 |
New Member
Sastry
Join Date: Jul 2015
Posts: 1
Rep Power: 0 |
Hi all,
Can anyone please tell how to create a cylindrical surface in ANSA using script? I am trying to sweep a curve but couldn't. Thanks in advance. Sastry Last edited by Sastry; July 30, 2015 at 12:10. Reason: Incomplete info |
|
July 31, 2015, 06:03 |
You can create
|
#40 |
Member
Maries
Join Date: Mar 2010
Location: Cologne, Germany
Posts: 75
Rep Power: 16 |
Hi Sastry,
You can create cylinder by script. use the script function ansa.base.CreateVolumeCylinder(point1, point2, length, radius, part, property) I find this function is ANSA v15. Regards Maries |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[ICEM] Script: problems with face names | Maweil | ANSYS Meshing & Geometry | 3 | April 16, 2019 10:10 |
CentFOAM Python Script Installation: Error | socon009 | OpenFOAM Installation | 2 | May 26, 2012 10:36 |
[Commercial meshers] ANSA hexblock mesh to OpenFOAM | yosuu | OpenFOAM Meshing & Mesh Conversion | 7 | October 22, 2011 07:18 |
[Commercial meshers] Output deck from ANSA for OpenFOAM use | Kattie | OpenFOAM Meshing & Mesh Conversion | 10 | February 2, 2011 08:46 |
Perl script for intialisation | pratik mehta | CFX | 2 | September 10, 2008 04:09 |