Start Optistruct from Script, extract values from analysis back.

Merula_20758
Merula_20758 Altair Community Member
edited October 2020 in Community Q&A

Hi,

 

I am fairly new to scripting and began to do a simple test on how to do an automated optimization.

 

So I created a cube, meshed it, put some loads and bcs on it and tried to run it. Now the problem is: I only can fe export my data and not get optistruct to run automatically. What I later want to do is for example: Do several optimization with different volume frac upper values like 0.3 0.4 0.5 and extract the movement of a node back into my script.

 

So, as I see it, two questions emerge:

 

1) How can I call an Optistruct run from within the script

2) How can I extract a value (like displacement of node 1) back into my script.

 

I know there is Hyperstudy, but that is not my intention. I want the process to be fully automated at the end.

 

Thanks for your help,

 

Merula

Answers

  • tinh
    tinh Altair Community Member
    edited October 2015

    Hi

    to invoke an application from tcl:

    exec $AppPath [app options] &

    if you want to run it and wait for completed, remove '&' (but not much recommend once tcl core cannot allocate enough memory)

    to extract displacement, load result into hypermesh or hyperview, looking for relevant commands to query result in help ( i am sorry i do not ever use them so i am not sure)  image/emoticons/default_rolleyes.gif' alt=':rolleyes:'>

  • Merula_20758
    Merula_20758 Altair Community Member
    edited October 2015

    Hi,

     

    thanks for your help. I did not get it to work until now. Still hanging on the job starting code

     

    So, I try to open an optistruct run with the optistruct.exe which is located at: 'C:\Program Files\Altair\13.0\hwsolvers\common\tcl\tcl8.5.9\win64\bin\wish85t.exe' 'C:\Program Files\Altair\13.0\hwsolvers\scripts\hwsolver.tcl' -solver OS -icon

     

    If I try to implement this:

    exec 'C:/Program Files/Altair/13.0/hwsolvers/common/tcl/tcl8.5.9/win64/bin/wish85t.exe' 'C:/Program Files/Altair/13.0/hwsolvers/scripts/hwsolver.tcl' &

     

    It tells me no input file. So I add my input file, which gives me this:

     

    exec 'C:/Program Files/Altair/13.0/hwsolvers/common/tcl/tcl8.5.9/win64/bin/wish85t.exe' 'C:/Program Files/Altair/13.0/hwsolvers/scripts/hwsolver.tcl' 'C:/Temp/Run/Optimization.fem'  &

     

    This returns the image in the attachments... whats wrong?

    <?xml version="1.0" encoding="UTF-8"?>post-9178-0-01084500-1444665097_thumb.jp

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited October 2015

    To run Optistruct, try:


    C:\Program Files\Altair\13.0\hwsolvers\scripts\optistruct.bat mymodel.fem
  • Merula_20758
    Merula_20758 Altair Community Member
    edited October 2015

    Lilke this?


    exec 'C:/Program Files/Altair/13.0/hwsolvers/scripts/optistruct.bat' 'C:/Temp/Run/Optimization.fem' &

    Cause nothing happens when I put it like this.

  • tinh
    tinh Altair Community Member
    edited October 2015

    Lilke this?

    exec 'C:/Program Files/Altair/13.0/hwsolvers/scripts/optistruct.bat' 'C:/Temp/Run/Optimization.fem' &

    Cause nothing happens when I put it like this.

     

     

    it is running in batch mode

    if you want to show the console, try

     

    exec cmd /K start 'C:/program.../optistruct.bat' 'C:/temp... .fem' &

  • Merula_20758
    Merula_20758 Altair Community Member
    edited October 2015

    Ah sorry,

    the thing was, I checked with the task manager, that there is no optistruct job starting.... but as it turned out, I just was not fast enough. My simple model does not take a hudge amount of time to run image/emoticons/default_biggrin.png' alt=':D' srcset='/emoticons/biggrin@2x.png 2x' width='20' height='20'>

    So thanks, that problem is solved.

    Is there a command.cmf file for hyperview or somethin similar for me to extract the code necessary for my script?

     

    Best regards,

    Merula

  • tinh
    tinh Altair Community Member
    edited October 2015

    Hi

    There is no command file for hyperview

    But you can find sample code in HW Reference Guide

  • Merula_20758
    Merula_20758 Altair Community Member
    edited October 2015

    Thanks, I will check that.