Tutorial Toolkit Function Descriptions > Files > General
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
General
The following utilities are used for basic file management such as setting and determining file and directory attributes.
 
file_is_directory
(dirname)
Description:
To validate the given string as a valid directory.
Input:
STRING
dirname[ ]
Possible file directory.
Output:
INTEGER
<Return Value>
This function will return a value of 1 if the input value dirname represents a valid directory and a value of 0 if the input value dirname represents an invalid directory.
Example:
Please see file_is_directory (p. 40) in the MSC Acumen Toolkit - Code Examples.
 
get_current_dir
(dirname)
Description:
Return the current directory.
Input:
none
Output:
STRING
dirname[]
Current directory.
INTEGER
<Return Value>
0 if Function was successful.
Example:
Please see get_current_dir (p. 41) in the MSC Acumen Toolkit - Code Examples.
  
p3_ps_get_xmt
(<filename>)
Description:
This function returns the filename of the UG part being imported. Typically, a UG model is in a file with ‘filename.prt’ extension. This function converts it to ‘filename-ps0001.xmt_txt’ file which is actually imported into MSC Patran. The filename is taken from the function p3_ps_open_ug_v2() which is run previous to p3_ps_get_xmt() function. This is an internal function called during the execution of the function p3_ps_open_ug_v2(). See example file for this function.
Input:
None
Output:
STRING ARRAY
filename[ ]( )
The filename for the file. This has an extension of xmt_txt format.
INTEGER
<Return Value>
Returns the output status of the function.
Error Conditions:
None.
 
Note:  
The output of the function is an integer, but the status cannot be ascertained from this integer.
Example:
Please see p3_ps_get_xmt (p. 47) in the MSC Acumen Toolkit - Code Examples.
 
set_current_dir
(dirname)
Description:
Set the current directory.
Input:
STRING
dirname[]
Current directory to set to.
Output:
INTEGER
<Return Value>
0 = successful.
-1= failure.
Example:
See example for get_current_dir, 22. See also set_current_dir (p. 48) in the MSC Acumen Toolkit - Code Examples.
 
utl_is_locked_file
(filename)
Description:
This function will determine if the indicated file is currently locked.
Input:
STRING
filename[]
This value specifies the name of the file which will have its lock status checked.
Output:
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Remarks:
The commands for locking and unlocking files are designed to control access to files shared between two or more processes.
The file lock control functions assume that only one file at a time will be locked.
This function will always return FALSE for a file that is owned by the process in which this function is executed.
Example:
Please see utl_is_locked_file (p. 59) in the MSC Acumen Toolkit - Code Examples.
 
utl_lock_file
(filename)
 
Description:
This function will set an advisory lock on a file.
Input:
STRING
filename[]
This value specifies the name of the file to lock.
Output:
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Error Conditions:
8111006
Error attempting to access %A%.
8111002
File %A% is in use by another user. Opening this database may cause undesirable results.
8111001
Cannot lock %A%. Another file is locked.
8111003
Error while attempting to lock %A%.
Remarks:
The commands for locking and unlocking files are designed to control access to files shared between two or more processes.
The file lock control functions assume that only one file at a time will be locked.
Example:
Please see utl_lock_file (p. 61) in the MSC Acumen Toolkit - Code Examples.
 
utl_unlock_file
( )
Description:
This function will clear an advisory lock.
Input:
none
Output:
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Error Conditions:
8111004
Cannot perform file unlock. No files known to be locked.
8111005
Error while attempting to perform an unlock.
Remarks:
The commands for locking and unlocking files are designed to control access to files shared between two or more processes.
The file lock control functions assume that only one file at a time will be locked.
Example:
Please see utl_unlock_file (p. 62) in the MSC Acumen Toolkit - Code Examples.
 
uil_file_open.open_db
( name, newdb )
 
Description:
Open a database and set some initial parameters.
Input:
STRING
name[]
File name of database to be opened.
LOGICAL
newdb
This flag will execute viewport tiling on a new database so that it will fill all space from Main Menu to Command Window.
Output:
INTEGER
<Return Value>
0 if Description was successful.
Example:
Please see uil_file_open.open_db (p. 58) in the MSC Acumen Toolkit - Code Examples.