Permission denied when opening tcl script using hmbatch

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hi,

       I am trying to create a tcl script to import .inp files from a specified folder. I am running this script from MATLAB to automate the process for several input files. I am able to run the script when I go to hypermesh>file>run>Tcl/Tk script. I can even run it from Run>Command Window with a .cmf file I created. I am not sure whether it is because I have graphics (which doesn't work with hmbatch), but I am unable to run the same thing from MATLAB. 

 

 

Here is my syntax: 

 

For importing the Abaqus input files: 

*feinputpreserveincludefiles

*createstringarray 2 'Abaqus ' 'Standard3D '

 

*feinputwithdata2 '#abaqus/abaqus' 'filename_with_path.inp' 0 0 0 0 0 1 2 1 0

 

.cmf file to run in the command window: 

*evaltclscript('filename_with_path.tcl', 0)

 

MATLAB code to run the tcl script in the command window


    hypermesh_bin='C:\Program Files\Altair\11.0\hm\bin\win64\';

    

    %enter the directory for the hypermesh executible

    cd(hypermesh_bin);

    

    % run .cmf file

    dos_command = ['hmbatch -c','filename_with_path.cmf'];

    dos (dos_command)

 


 

Error: 

Error:  Permission denied  

Error:  Permission denied  

Error:  Encountered error (check read/write permissions and file existence).  

Tcl/Tk script error:  

0  

    while executing  

'*feinputwithdata2 '#abaqus/abaqus' 'C:/Users/Aruna/Documents/CART_HANDLES/MORPHED/FemCart_DU02.inp' 0 0 0 0 0 1 2 1 0 '  

    (file 'C:/Users/Aruna/Documents/CART_HANDLES/Refine_Mesh.tcl' line 7)  

End of command file - terminating.  

Error:  Permission denied  

HM exiting with code 0  

ans =

     0

 

What I did so far:

I looked into the instructions for dealing with 'Permission denied'. I changed the working directory and also tried deleting the hmsettings.tcl, hmmenu.set and command.cmf files from the directory. 

I tried to follow the instructions posted in the following link to run tcl scripts from the command window. But I am not sure where I have to incorporate the -tcl<filename> command- in the .cmf file, or when I am running the cmf file through MATLAB?? 


 

 

Any help/comments are highly appreciated. 

 

Thanks in advance! 

 

Tagged:

Answers

  • tinh
    tinh Altair Community Member
    edited May 2015

     

    Hi,

           I am trying to create a tcl script to import .inp files from a specified folder. I am running this script from MATLAB to automate the process for several input files. I am able to run the script when I go to hypermesh>file>run>Tcl/Tk script. I can even run it from Run>Command Window with a .cmf file I created. I am not sure whether it is because I have graphics (which doesn't work with hmbatch), but I am unable to run the same thing from MATLAB. 

     

     

    Here is my syntax: 

     

    For importing the Abaqus input files: 

    *feinputpreserveincludefiles

    *createstringarray 2 'Abaqus ' 'Standard3D '

     

    *feinputwithdata2 '#abaqus/abaqus' 'filename_with_path.inp' 0 0 0 0 0 1 2 1 0

     

    .cmf file to run in the command window: 

    *evaltclscript('filename_with_path.tcl', 0)

     

    MATLAB code to run the tcl script in the command window

        hypermesh_bin='C:\Program Files\Altair\11.0\hm\bin\win64\';

        

        %enter the directory for the hypermesh executible

        cd(hypermesh_bin);

        

        % run .cmf file

        dos_command = ['hmbatch -c','filename_with_path.cmf'];

        dos (dos_command)

     

     

    Error: 

    Error:  Permission denied  

    Error:  Permission denied  

    Error:  Encountered error (check read/write permissions and file existence).  

    Tcl/Tk script error:  

    0  

        while executing  

    '*feinputwithdata2 '#abaqus/abaqus' 'C:/Users/Aruna/Documents/CART_HANDLES/MORPHED/FemCart_DU02.inp' 0 0 0 0 0 1 2 1 0 '  

        (file 'C:/Users/Aruna/Documents/CART_HANDLES/Refine_Mesh.tcl' line 7)  

    End of command file - terminating.  

    Error:  Permission denied  

    HM exiting with code 0  

    ans =

         0

     

    What I did so far:

    I looked into the instructions for dealing with 'Permission denied'. I changed the working directory and also tried deleting the hmsettings.tcl, hmmenu.set and command.cmf files from the directory. 

    I tried to follow the instructions posted in the following link to run tcl scripts from the command window. But I am not sure where I have to incorporate the -tcl<filename> command- in the .cmf file, or when I am running the cmf file through MATLAB?? 

     

     

    Any help/comments are highly appreciated. 

     

    Thanks in advance! 

     

     

    Hello there,

    I think you should not use 'cd(hypermesh_bin)' because hmbatch may write something in hypermesh_bin (while normally 'C:/Program Files' is protected)

    try invoking hmbatch without changing directory, or right click on hypermesh_bin > properties > uncheck 'read-only'

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited May 2015

    Hi tinh,

                 Thanks for responding!

     

    I don't get any error when I use this code to import a hypermesh file from a folder. The program errors out at the exact command where I try to import an Abaqus input file. It is probably related to the write problem you mentioned about (hypermesh newbie here).

    I tried to invoke hmbatch from the same directory, but MATLAB is not able to recognize hmbatch.

    I tried unchecking read-only for the hypermesh bin folder and it didn't work. But when I right-clicked on the folder>properties>security and added write permissions to the folder, it worked. I am not sure how safe this is for the program, but I am able to import Abaqus files into Hypermesh now. 

     

    Thanks again,

    Aruna

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited May 2017

    Please, help me: I want to optimize a model. I am using Matlab for the optimization, Hypermesh as a pre-processor for my model and Abaqus as my FEA solver. I want to control all the operations in Matlab. I don't want to open Hypermesh and Abaqus. I have found a way around Abaqus. But I am having a challenge with Hypermesh. Directly from Matlab command, I want to call Hypermesh to execute my TCL script and output Abaqus input file. I want to run this process for many iterations by changing my mesh size in TCL script, thereby generating Abaqus input files of different mesh sizes. 

     

    This is my Matlab script for Hypermesh:

     

    clear all;
    clc;
    hypermesh_bin='C:\Program Files\Altair\2017\hm\bin\win64\';

        %enter the directory for the hypermesh executible

        cd(hypermesh_bin);

      run Hypermesh  
     dos ('C:\Program Files\Altair\2017\hm\bin\win64\hmopengl.exe&')

    % run .tcl file (the name of my tcl file is comm)
        dos_command = ['hmbatch-tcl' , 'C:\Program Files\Altair\2017\hm\bin\win64\comm.tcl'];

     dos (dos_command)

     

    I am getting this error:

     

    ans =

         0

    The filename, directory name, or volume label syntax is incorrect. 

    ans =

         1

     

    Please, help me: kindly tell me what I am doing wrong.

     

    Also, in order for us to have more discussion, I will appreciate it if you can send me an email, if you have worked with hypermesh directly from Matlab or you know how to do it. My email address is: sasamuelayinde@gmail.com

     

    Thank you.

  • tinh
    tinh Altair Community Member
    edited May 2017

    Hi,

    Could you try running hm by below matlab command:

    system(''C:\Program Files\Altair\2017\hm\bin\win64\hmopengl.exe' -batchmesher -noconsole -tcl 'C:\Program Files\Altair\2017\hm\bin\win64\comm.tcl' &')

     

    I don't know how to quote in matlab, but if you cannot run above command, just make a batch file and invoke that batch file, example

    file C:\sample.bat :

    'C:\Program Files\Altair\2017\hm\bin\win64\hmopengl.exe' -batchmesher -noconsole -tcl 'C:\Program Files\Altair\2017\hm\bin\win64\comm.tcl'

     

    and in matlab, call it by:

    system('C:\sample.bat &')

     

     

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited May 2017

    When I tried this:

     

    system(''C:\Program Files\Altair\2017\hm\bin\win64\hmopengl.exe' -batchmesher -noconsole -tcl 'C:\Program Files\Altair\2017\hm\bin\win64\comm.tcl' &')

     

    The answer: -1

     

    Please, I want to find out how to create batch file. What will be the content of the batch file? You can send me a sample of a batch file.

  • tinh
    tinh Altair Community Member
    edited May 2017

    Hi

    - open notepad

    - copy paste this code:

    'C:\Program Files\Altair\2017\hm\bin\win64\hmopengl.exe' -batchmesher -noconsole -tcl 'C:\Program Files\Altair\2017\hm\bin\win64\comm.tcl'

     

    - save file as 'sample.bat'

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2020

    I have done that. The command window (cmd) propped up. But I don't know the next step to take. Please, find my attached tcl script and Abaqus input file. Directly from Matlab command, I want to call Hypermesh to execute my TCL script and output Abaqus input file of increasing finer meshes. I want my mesh size to decrease by 0.5 after each iteration. That is, automatically, I want to run this process for many iterations by changing my mesh size in TCL script by 0.5 increment, thereby generating Abaqus input files of different mesh sizes. What is the next step I need to take? Please, help me. Thank you

    Unable to find an attachment - read this blog

  • tinh
    tinh Altair Community Member
    edited May 2017

    You have to make a loop (example for, while, foreach,...), each cycle changes mesh size, and remesh, and export. If you do not know much about tcl, you can loop in matlab, each cycle change mesh size and exported inp filename in comm.tcl

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited May 2017

    Tinh,

    Thank you so much. How can I get the attached scripts and file to run? The command window propped up but I didn't see any result. Please, check the attached files and let me know what I am doing wrong and what I need to do.

  • tinh
    tinh Altair Community Member
    edited May 2017

    Hi Samuel,

    try this script:

     set Dir [file dirname [info script]] *feinputpreserveincludefiles  *createstringarray 5 'Abaqus ' 'Standard3D ' 'LOADCOLS_DISPLAY_SKIP ' 'SYSTCOLS_DISPLAY_SKIP ' \   'CONTACTSURF_DISPLAY_SKIP ' *feinputwithdata2 '#abaqus/abaqus' '[file join $Dir inputfileremesh1.inp]' 0 0 0 0 0 1 5 1 0 #starting elem size is 5.0 for {set Size 4.5} {$Size>=0.5} {set Size [expr $Size-0.5]} {     *setedgedensitylinkwithaspectratio 0     *elementorder 1     *setusefeatures 3     *createmark elements 1 all     *defaultremeshelems 1 $Size 2 2 1 1 1 1 0 0 0 0 2 30     *setusefeatures 0     #export data     *createstringarray 2 'HMBOMCOMMENTS_XML' 'EXPORTIDS_SKIP'     *feoutputwithdata '[file join [hm_info -appinfo SPECIFIEDPATH TEMPLATES_DIR] feoutput abaqus standard.3d]' '[file join $Dir inputfileremesh1_$Size.inp]' 0 0 2 1 2 } destroy .

     

     

    Sample files: (copy this 3 file into a same folder, edit file path in remesh.bat then save and run it)

          

    Unable to find an attachment - read this blog

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited May 2017

    Hi Tinh,

     

    I followed your instruction. The file ran successfully and the Abaqus input files are generated. I need to know how to do it directly from Matlab. I am very grateful. God bless you.

  • tinh
    tinh Altair Community Member
    edited May 2017
  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2020

    Hi Tinh, 

     

    I need help.

     

    1. I created abaqus input file from hypermesh. Please, find the attached files. The file did not run successfully (cantileveroriginal.inp). The error message:

     

    Concentrated load is specified on 1 nodes that are not active. Check loading definitions in the model. The nodes may have been deleted because they were not connected to any elements.

     

    I specify the concentrated load on node 3. By inspection, I realize that node 3 and 34, 1 and 65; 2 and 26; 4 and 54; 5 and 6 have the same coordinates. How can I deal with that?

     

    2. I guessed repetition of coordinates may be a reason. This is because when I change the node for the concentrated load to 34 (newcantilever3.inp), the input file runs (newcantilever3.dat) but there was no displacement output for node 1-6. How can I resolve this issue?

     

    3. Currently, I could obtain stresses at the integration points, but I need nodal stresses. How can I specify nodal stresses output while creating Abaqus input file from hypermesh?

     

    Thank you.

     

     

     

    Unable to find an attachment - read this blog

  • tinh
    tinh Altair Community Member
    edited May 2017

    Hello Samuel

    I found that node1~6 are preserved nodes (panel analysis > preserved nodes)

    so clear these free nodes

     

    I don't know abaqus. You have to search its manual for options to output stress at corners. and in hyperview, remember to tick on 'use corner data'

    Unable to find an attachment - read this blog

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited May 2017

    Hello Tihn,

     

    Thank you so much. I resolved that issue by starting the creation of my component from surface instead of from the node.

    There are some issues now: Please, find the attached files. The original file created from the hypermesh GUI is squarecantil.inp. The picture is attached (cantilever model). I defined the fixed boundary condition. I fix all the nodes on one side. I remeshed using tcl script (attached). I inspected the input files from the remesh and found certain issues.

     

    Issues:

    • Many of the nodes from the previous mesh were deleted after a finer remesh
    • The number of nodes for the fixed boundary condition reduced to constant two nodes, regardless of the remesh - (Normally, number of nodes of fixed boundary condition should increase with finer remesh and decrease with coarser remesh, since I fixed a side of the model completely.

    My guess is that I need to input more instructions into my tcl scripts, though I am not sure and I do not know which instruction I should include. 

     

    Please, help me check through my scripts, discover what I am doing wrong and make necessary corrections. Also, how can I get rid of excess decimal places? I want '' to be saved as '' . Thank you so much for helping me constantly. God bless you.

    <?xml version="1.0" encoding="UTF-8"?>cantilever model.JPG

    Unable to find an attachment - read this blog

  • tinh
    tinh Altair Community Member
    edited May 2017

    Hi,

    Suddenly remember I did a such your work when preparing voronoi mesh model for crystal analysis


     

    You can use *nodemarkbypath to retrieve nodes on constrained edge

    like this (in root file squarecantil.inp you keep only 2 constraints at 2 corners):

    Capture.PNG.cae9b2ce5a476095085b11dac9d97cba.PNG

     

     

     

    Unable to find an attachment - read this blog