Write INCLUDE card with environment variable format

18 views
Skip to first unread message

pablob...@hotmail.fr

unread,
Nov 14, 2018, 6:56:44 AM11/14/18
to pyNastran Discuss
Hello,

In the latest versions of pyNastran, there is the argument "relative_dirname" in the "write_bdfs" function.

Is it possible to add an option that allows pyNastran to rewrite the INCLUDE in the environment variable format.

INCLUDE 'Satellite_V02_bddm: Satellite_V02_Materials.blk'

See the example Satellie_V02 I gave you.
Thank you

Steven Doyle

unread,
Nov 14, 2018, 1:10:15 PM11/14/18
to pynastra...@googlegroups.com
Not with the relative_dirname, but I can add something with another flag.

relative_dirname should be set to os.environ['MYVAR']

How about a new environment_path='MYVAR', which has a default of None, which means it doesn't get used?

--
You received this message because you are subscribed to the Google Groups "pyNastran Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynastran-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steven Doyle

unread,
Nov 14, 2018, 1:11:36 PM11/14/18
to pynastra...@googlegroups.com
Note that only one environment variable path will be supported at a time.

pablob...@hotmail.fr

unread,
Nov 14, 2018, 5:15:14 PM11/14/18
to pyNastran Discuss
In general I have several environment variables. See example Satellite_V02.
Only one environment variable is no suffisant

When reading the NASTRAN file, it would be necessary to store in a dictionary the absolute path of the INCLUDE in key and the environment variable in value.
Then, when writing the file, we use the dictionary to recompose the path of the INCLUDE with the environment variable
Example Satellite_V02:
   The satellite_V02_Variable_Env_SimX.bat file defines the variables
       SET Satellite_V02_base=M:\ACA\Satellite_V02
       SET Satellite_V02_INCLUDE=%Satellite_V02_base%/INCLUDE

   The NASTRAN File satellite_V02_ACA_QS_SOL101_VarEnv.dat
      INCLUDE 'Satellite_V02_INCLUDE:Satellite_V02_Panneau_Etoile.dat'
      INCLUDE 'Satellite_V02_INCLUDE:Satellite_V02_Tube_Cone.dat'

dico_Path_VarEnv = {"M:\ACA\Satellite_V02\INCLUDE\Satellite_V02_Panneau_Etoile.dat" : Satellite_V02_INCLUDE , 
                               "M:\ACA\Satellite_V02\INCLUDE\Satellite_V02_Tube_Cone.dat" : Satellite_V02_INCLUDE ,
                               }


what do you think about that ?

steve

unread,
Nov 14, 2018, 6:05:55 PM11/14/18
to pyNastran Discuss
>  Input deck markup also works.

That sounds incredibly more complicated.  You'll end up having to define the path to every include file.

There are say 4 files:
 - main.bdf  # file 0
     - folder_a/a.inc  # file 1
     - b.inc  # file 2
 - c.inc   # file 3


And maybe you want to the output like:
 - main.bdf  # file 0
     - $ENVA/a.inc  # file 1
     - b.inc  # file 2
 - $ENVC/c.inc   # file 3


So you're left with the additional input being (maybe with paths you don't care about being simpler?):
input_path_to_output_path = {
   'main.bdf' : 'main.bdf',
   'folder_a/a.inc' : '$ENVA/a.inc',  # expanded of course
   'b.inc' : 'b.inc',
   'c.inc' : '$ENVC/c.inc',
}

as well as:
environment_path = {
   'folder_a/a.inc' : 'ENVA',
   'c.inc' :'ENVC',
}
That doesn't seem particularly clean and at that point, I don't know if it's worth it to support.
Reply all
Reply to author
Forward
0 new messages