adding python scripting to my application

J

Julian

Hi, first of all, I have to say I am new to Python. I have been working
with a finite element analysis program written in c++. now, I am trying
to 'rebuild' this code (possibly a full re-write) with scripting
capability. I did some reading on the web, and found that there are two
ways to do this : extending and embedding. and I still haven't figured
out what I should be using. I guess the first thing is to figure out
what I am to do with the scripting capability - at the very least, I
would like to run parametric analyses - run multiple analysis models by
changing certain parameters using for loops.
i found that the commercial fea package - abaqus uses python as well -
I don't know whether they embedded or extended ? is there any way to
find out?
another fea application called OOF2
(http://www.ctcms.nist.gov/oof/oof2/#features) says "OOF2 is completely
scriptable in Python". and I don't really understand what that means...
maybe I haven't grasped the full potential of what python scripting
could do for an fea program.

can you tell me how to decide what path I should take - embed or extend
? or maybe some one could point me to some document/webpage that talks
about this.

thanks a lot,
Julian.

PS, my fea program uses its own script to read the analysis model
information using the c++ iostream and our own parsing functions - but
I don't have to stick to those function when I am writing the new code.
 
J

Jerry

I am not a Python guru by any means, but I believe that when an
application says that you can "script" their application with Python,
it means that you can actually write Python code to interact with the
application. Embedding may be the same thing. Extending (as I read
it) involves writing portions of your program in Python and have do the
logic portions.

If you would like to allow users to write small scripts that interact
with your program and control it (a la VBScript or AppleScript), then I
believe embedding Python in your program is what you want.

If you would like Python to run various parts of your program in order
to make some portions easier to write/manage/whatever, then you want to
"extend" your program using Python.

The key difference being that you aren't providing a way for someone
else to interact with your program using Python if you are extending.

Again, I am not a guru and a read through the docs on python.org would
probably be the best place to get sound technical advice on these
subjects.
 
M

martdi

Jerry said:
I am not a Python guru by any means, but I believe that when an
application says that you can "script" their application with Python,
it means that you can actually write Python code to interact with the
application. Embedding may be the same thing. Extending (as I read
it) involves writing portions of your program in Python and have do the
logic portions.

If you would like to allow users to write small scripts that interact
with your program and control it (a la VBScript or AppleScript), then I
believe embedding Python in your program is what you want.

If you would like Python to run various parts of your program in order
to make some portions easier to write/manage/whatever, then you want to
"extend" your program using Python.

The key difference being that you aren't providing a way for someone
else to interact with your program using Python if you are extending.

Again, I am not a guru and a read through the docs on python.org would
probably be the best place to get sound technical advice on these
subjects.


I'm not sure either, but I though Extending was making the C/C++ Code
available from Python, while Embedding was making Python Code Available
in your app.
 
J

Julian

martdi said:
I'm not sure either, but I though Extending was making the C/C++ Code
available from Python, while Embedding was making Python Code Available
in your app.

Like I mentioned in my first post, one of the purposes of linking to python
would be to run multiple cases in a for loop.
that would mean passing information from the python script to my c++
application. mean python would have to be the top-level program.
so, I think I should be looking at extending my program. I am going to look
at using swig for this..

thanks,
Julian.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top