How to change working directory

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

Hi,

 

 

My objective was to take images of components and save it in a folder.

I used the following command to take the image

 

*jpegfilenamed $compname

 

But the problem is it is saving all those files in 'MY DOCUMENTS' which is working directory.

 

hm_info -appinfo CURRENTWORKINGDIR

 

By using the command i can able to retrieve the working directory.

 

I used the following command to change the working directory but it is not working

 

set CURRENTWORKINGDIR 'C:\folder'

 

Help me on this.

 

 

Tagged:

Answers

  • tinh
    tinh Altair Community Member
    edited November 2013

    hi Karthi

    use 'cd' command

    cd 'C:/folder'

     

    but you already use *jpegfilenamed so it's better to direct path in filename:

    *jpegfilenamed 'C:/folder/$compname'

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2013

    Thanks for the Reply!!!

    I have to check if component is not there it has to come out of the program.. For that i used the following command.

     

    if {$comp == ''} {
    break
    }

    But it is showing a  HM error message as    ' invoked 'break' outside of a loop '

     

    it should not tell any error message it should come out without it..

  • tinh
    tinh Altair Community Member
    edited November 2013

    hi,

    the error is invalid using of 'break'

    you ough to use 'return'

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2013

    Thanks for the Reply!!!

     

    I need to use the translate option like moving the elements in mark 1 from N1 to N2

     

    Ex:

     

    *createmark elements 1 displayed

    *createvector  1 0.7085 -1.6000 0.0001
    *translatemark elements 1 1 0.2

     

    Like this it is coming in CMF file. how do i get the vector for 2 nodes.

     

     

    I also want to get the coordinates of a node. when i try the following option it is saying it can be used only for points.

     

    hm_getcoordinates points 1

     

    How do i create the points for the nodes in mark.

     

    Thanks in Advance!!!

  • tinh
    tinh Altair Community Member
    edited December 2013

    hi,

    to get coordinates of a node you can use hm_nodevalue:

    foreach {xcoord ycoord zcoord} [expr [hm_nodevalue $NodeId]] {}

    and from coordinates of 2 nodes you can get a vector by (x2-x1) (y2-y1) (z2-z1) (or using utilitiy function in hwat - please look at help about hwat)

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2013

    Thanks.. i got the coordinates.. but the problem is i need the X,Y,Z values in different variables ..

     

    set cor [hm_nodevalue $nodeId]
    set x [lindex $cor 0]
    set y [lindex $cor 1]
    set z [lindex $cor 2]

     

     

    When i use this i m getting the whole X,Y,Z in Variable x itself. Help me on this!!!

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2013

    Sorry i did't use the full line before... i got it thanks...