Dynamic character substitution.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Bausano

    #1

    Dynamic character substitution.

    Hello all,



    I've been using Ansys which is a commercial FEA package which can be
    controlled through its own scripting language they call APDL. Now I'm
    trying to write some stand alone code in Python to supplement my current
    efforts.



    In Ansys I can do something like this.



    *do,n,1,3 #loop
    through n

    *dim,data%n%,10 00,2 #creates variables
    arrays data1(1000,2), data2(1000,2)..

    *vread,data%n%, filename%n% #fills arrays with data
    from filename1,.



    Thanks



    john


  • Tim Roberts

    #2
    Re: Dynamic character substitution.

    "John Bausano" <jbausano@vt.ed u> wrote:[color=blue]
    >
    >Hello all,
    >
    >I've been using Ansys which is a commercial FEA package which can be
    >controlled through its own scripting language they call APDL. Now I'm
    >trying to write some stand alone code in Python to supplement my current
    >efforts.
    >
    >In Ansys I can do something like this.
    >
    >*do,n,1,3 #loop through n
    >
    > *dim,data%n%,10 00,2 #creates variables
    >arrays data1(1000,2), data2(1000,2)..
    >
    > *vread,data%n%, filename%n% #fills arrays with data
    >from filename1,.[/color]

    Generally, you need to think about your problem in a slightly different
    way. Instead of thinking about creating variables called data1 and data2,
    think about creating a dictionary called "data" which contains three
    elements. For example:

    data = {}
    for n in range(3):
    data[n] = read_from( 'filename%d' % n )

    It IS possible to create variables on the fly, but except in very special
    situations, it is almost never the right way to do things.
    --
    - Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.

    Comment

    • Steve Jorgensen

      #3
      Re: Dynamic character substitution.

      On Mon, 26 Sep 2005 21:09:51 -0400, "John Bausano" <jbausano@vt.ed u> wrote:
      [color=blue]
      >Hello all,[/color]

      ....
      Funny enough, some people have wanted to substitute a more dynamic character
      for me on occasion <g>.

      Comment

      • William Park

        #4
        Re: Dynamic character substitution.

        John Bausano <jbausano@vt.ed u> wrote:[color=blue]
        > Hello all,
        >
        >
        >
        > I've been using Ansys which is a commercial FEA package which can be
        > controlled through its own scripting language they call APDL. Now I'm
        > trying to write some stand alone code in Python to supplement my current
        > efforts.
        >
        >
        >
        > In Ansys I can do something like this.
        >
        >
        >
        > *do,n,1,3 #loop
        > through n
        >
        > *dim,data%n%,10 00,2 #creates variables
        > arrays data1(1000,2), data2(1000,2)..
        >
        > *vread,data%n%, filename%n% #fills arrays with data
        > from filename1,.[/color]


        I await English translation of the above.

        --
        William Park <opengeometry@y ahoo.ca>, Toronto, Canada
        ThinFlash: Linux thin-client on USB key (flash) drive

        BashDiff: Super Bash shell
        Compare the best free open source Software Development Software at SourceForge. Free, secure and fast Software Development Software downloads from the largest Open Source applications and software directory

        Comment

        Working...