[Integration Kit Contents] [Integration Kit What's New] [Integration Kit Function Index] [More Documentation] [PTC]

Filing and Operation System

Filing:
sd-inq-file-status
sd-inq-file-size
sd-change-file-permission
sd-inq-temp-dir
sd-inq-install-dir
sd-gen-unique-filename
sd-set-current-working-directory
sd-get-current-working-directory
sd-with-current-working-directory
sd-search-file
sd-move-file
sd-copy-file
sd-make-directory
sd-directory-p
sd-browse-for-folder

Customization Support functions

Operating System:
sd-sys-exec
sd-sys-background-job
sd-sys-getenv
sd-inq-platform
sd-osdm64-p
sd-inq-username
sd-inq-user-profiledir-pathname
sd-inq-common-profiledir-pathname
sd-convert-filename-to-platform
sd-convert-filename-from-platform

Function Index Top of Page

SD-INQ-FILE-STATUS  [function]

(sd-inq-file-status filename status)
Description:
Checks whether the file given in filename exists, is readable or writable.
Parameters:
filename {STRING} - File to check.
status {KEYWORD}
Specifies which status of the file should be checked. One of the following keywords is allowed:
  • :existence
  • :read-access
  • :write-access
Return value:
t - if status was set to
:existence and the file exists,
:read-access and the file is readable,
:write-access and the file is writable.
nil - Otherwise, or if the file is not regular. Use sd-inq-error-obj to get more information.

Example:
(if (sd-inq-file-status "c:/temp/foo" :existence)
    (unless (sd-inq-file-status "/c:/temp/foo" :read-access)
      (sd-display-error "File \"c:/temp/foo\" is not readable."))
  (sd-display-error (sd-inq-error-obj)))

Function Index Top of Page

SD-INQ-FILE-SIZE  [function]

(sd-inq-file-size filename)
Description:
Returns the size of the file given in filename.
Parameters:
filename {STRING} - File to inquire.
Return value:
number - size of file
-1 - file does not exist

Function Index Top of Page

SD-CHANGE-FILE-PERMISSION  [function]

(sd-change-file-permission file mode)
Description:
Changes the access permissions of the given file.
Parameters:
file {STRING} - the file whoms permissions should be changed
mode {OCTAL NUMBER}
New mode of file. The mode has to be passed in the form #oNNN where NNN indicates the numeric mask as described for the UNIX command chmod (see 'man chmod' for more information). For instance a mode of #o644 assigns rw rights for the user, r rights for the group and r rights for other to the file.
Return value:
t - success
nil - failure
Example:
(sd-change-file-permission "C:/users/mike/part.pkg" #o440)

Function Index Top of Page

SD-INQ-TEMP-DIR  [function]

(sd-inq-temp-dir)
Description:
Looks up the path of a temporary directory. The following order is used to retrieve a suitable directory:
  1. shell variable METMPDIR (if set and directory exists)
  2. shell variable TMP (if set, no check whether directory exists!)
  3. shell variable TEMP (if set, no check whether directory exists!)
  4. Windows temp directory
  5. "." = current directory (fallback, should never be returned)
Return value:
directory {STRING} - full path to a directory which can be used as a temporary directory.
nil - failure
Example:
  (sd-inq-temp-dir)
     => "C:/Documents and Settings/joeengineer/Local Settings/Temp/"

Function Index Top of Page

SD-INQ-INSTALL-DIR  [function]

(sd-inq-install-dir)
Description:
Returns the installation directory of Creo Elements/Direct Modeling.
Return value:
directory {STRING} - full path to the Creo Elements/Direct Modeling installation directory
Example:
  (sd-inq-install-dir)
     => "C:/Program Files/PTC/Creo Elements/Direct Modeling 20.7.1.0

Function Index Top of Page

SD-GEN-UNIQUE-FILENAME  [function]

(sd-gen-unique-filename file-or-directory :extension extension-string-including-delimiter)
Description:
Returns a unique filename in the same directory as the passed file-or-directory.
Parameters:
file-or-directory {STRING}
Directory or filename which is used to locate a unique filename. A directory name should end with "/".
:extension {STRING, default NIL}
An extension string which will be appended to the filename during generation.
Return value:
filename {STRING} - name of a unique filename
nil - failure
Example:
  (sd-gen-unique-filename "c:/temp/")
     => "c:/temp/2rs4sqt1or61f892952"

Function Index Top of Page

SD-SET-CURRENT-WORKING-DIRECTORY  [function]

(sd-set-current-working-directory directory)
Description:
Changes the current working directory to directory.
Note: Changes are not reflected in a recorder file.
Parameters:
directory {STRING} - new current directory name
Return value:
t - success
nil - failure (error object contains more information)

Function Index Top of Page

SD-GET-CURRENT-WORKING-DIRECTORY  [function]

(sd-get-current-working-directory)
Description:
Returns the name of the current working directory.
Parameters:
Return value:
directory {STRING} - name of the current working directory
Example:
  (sd-get-current-working-directory)
     => "c:/temp"

Function Index Top of Page

SD-WITH-CURRENT-WORKING-DIRECTORY  [macro]

(sd-with-current-working-directory directory form(s) ...)
Description:
Macro performs the following steps:
  1. Remember current working directory
  2. Set current working directory to directory
  3. Evaluate form(s)
  4. Restore current working directory
Parameters:
directory {STRING} - temporary current directory name
form {LISP form}
a form which will be evaluated with the current working directory set to directory
Return value:
t - success
nil - failure
Example:
(sd-with-current-working-directory "c:/temp"
                                   (delete-file "a.lsp")
                                   (delete-file "b.lsp")
                                   (delete-file "cde.lsp"))

Function Index Top of Page

SD-SEARCH-FILE  [function]

(sd-search-file filename)
Description:
Tries to locate file with name filename according to Creo Elements/Direct Modeling's search directories.
Parameters:
filename {STRING} - name of the file to be searched
Return value:
filename-with-path {STRING}
Full filename including path of filename if file could be located according to Creo Elements/Direct Modeling's search directories.
nil - file could not be found

Function Index Top of Page

SD-MOVE-FILE  [function]

(sd-move-file source destination)
Description:
Moving file source to file destination is used to rename a file within a directory or to relocate a file within a file system or across different file systems.
Parameters:
source {STRING} - file to be moved with or without full or relative path
destination {STRING} - name of the moved file at destination with or without full or relative path
Return value:
t - file successfully moved
nil - failure

Function Index Top of Page

SD-COPY-FILE  [function]

(sd-copy-file source destination)
Description:
Copies file source to file destination.
Parameters:
source {STRING} - file to be copied with or without full or relative path
destination {STRING} - name of the copied file at destination with or without full or relative path
Return value:
t - file successfully copied
nil - failure

Function Index Top of Page

SD-MAKE-DIRECTORY  [function]

(sd-make-directory dir &optional mode)
Description:
Creates the directory with name dir and optional mode. If mode is not given, the directory will be created with the users default umask (see UNIX man pages for more information on umask, i.e. 'man umask').
Parameters:
dir {STRING}
Name of the directory to be created with or without full or relative path. Please note that intermediate missing directories will not be created automatically. This function will fail if you try to do so.
mode {OCTAL NUMBER (optional)}
Mode of the directory to be created. The mode has to be passed in the form #oNNN where NNN indicates the numeric mask as described for the UNIX command umask. For instance a mode of #o755 assigns rwx rights for the user, rx rights for the group and rx rights for other to the new directory.
Return value:
t - success
nil - failure
Example:
(sd-make-directory "c:/temp/transfer" #o770)

Function Index Top of Page

SD-DIRECTORY-P  [function]

(sd-directory-p directory)
Description:
Checks whether directory is an existing directory or not.
Parameters:
directory {STRING} - name of the directory to be checked
Return value:
t - directory exists
nil - directory does not exist

Function Index Top of Page

SD-SYS-EXEC  [function]

(sd-sys-exec command)
Description:
Forks an operating system shell and executes command in that shell. Returns the operating system return value of the command.
Note: If you want to pass a filename (pathname) as argument to this function you have to convert the filename to the platform specific notation using the function sd-convert-filename-to-platform.
Parameters:
command {STRING} - the operating system command to execute
Return value:
return-code {FIXNUM}
the value returned by the command to the OS shell

Function Index Top of Page

SD-SYS-BACKGROUND-JOB  [function]

(sd-sys-background-job command)
Description:
Forks an operating system shell and executes command in that shell as background job.
Note: If you want to pass a filename (pathname) as argument to this function you have to convert the filename to the platform specific notation using the function sd-convert-filename-to-platform.
Parameters:
command {STRING} - the operating system command to execute
Return value:
t - always

Function Index Top of Page

SD-SYS-GETENV  [function]

(sd-sys-getenv shell-var-name)
Description:
Gets the value of the specified shell environment variable from the operating system shell that Creo Elements/Direct Modeling was started from.
Parameters:
shell-var-name {STRING} - the name of the shell variable
Return value:
value {STRING} - the value of the shell variable
Example:
;; Get the name of the user's home directory

(setq home-directory (sd-sys-getenv "HOME"))

Function Index Top of Page

SD-INQ-PLATFORM  [function]

(sd-inq-platform)
Description:
Returns information about the platform Creo Elements/Direct Modeling is currently running on.
Parameters:
Return value:
multiple values: <OS> <OS revision>
The first returned value is :nt indicating the type of operating system.
The second value is a string indicating the revision of the operating system.
nil - otherwise
Example:
(multiple-value-bind (os rev) (sd-inq-platform)
  (format t "~%OS: ~S  rev: ~S" os rev))

   => OS: :NT  rev: "6.1"   = Windows 7

Function Index Top of Page

SD-OSDM64-P  [function]

(sd-osdm64-p)
Description:
This function returns T if the executable is the 64 bit version of Creo Elements/Direct Modeling.
Parameters:
Return value:
t - 64 bit version of Creo Elements/Direct Modeling
nil - 32 bit version of Creo Elements/Direct Modeling

Function Index Top of Page

SD-INQ-USERNAME  [function]

(sd-inq-username)
Description:
Returns the current user name.
Parameters:
Return value:
username {STRING} - the name of the user
Example:
(sd-inq-username)  => "Joe Engineer"

Function Index Top of Page

SD-INQ-USER-PROFILEDIR-PATHNAME  [function]

(sd-inq-user-profiledir-pathname)
Description:
Returns the profile directory of the current user.
Parameters:
Return value:
pathname {STRING} - the user's profile directory
Example:
(namestring (sd-inq-user-profiledir-pathname))  =>

  "C:/Documents and Settings/joeengineer/Application Data/PTC/Creo Elements Direct Modeling 20.7.1.0/"

Function Index Top of Page

SD-INQ-COMMON-PROFILEDIR-PATHNAME  [function]

(sd-inq-common-profiledir-pathname)
Description:
Returns the common profile directory for all users.
Parameters:
Return value:
pathname {STRING} - the profile directory for all users
Example:
(namestring (sd-inq-common-profiledir-pathname))  =>

  "C:/ProgramData/PTC/Creo Elements Direct Modeling 20.7.1.0/"

Function Index Top of Page

SD-CONVERT-FILENAME-TO-PLATFORM  [function]

(sd-convert-filename-to-platform filename)
Description:
Converts a UNIX specific notation of a filename to a filename which can be used on the current platform. On Windows the filename is converted to a PC specific filename.
This function is necessary if you want to pass a file to an external application e.g. via sd-sys-exec.
Note: The PC specific "\" will be escaped with an additional "\" in the result string.
Parameters:
filename {STRING} - the filename to convert
Return value:
filename - the converted filename
Examples:
  (sd-convert-filename-to-platform "c:/temp/example.lsp")
     => "c:\\temp\\example.lsp"

Function Index Top of Page

SD-CONVERT-FILENAME-FROM-PLATFORM  [function]

(sd-convert-filename-from-platform filename)
Description:
Converts a platform specific notation of a filename to a UNIX conform filename which can be used within Creo Elements/Direct Modeling. All occurences of "\" within a filename are converted to "/".
This function is necessary e.g. if you inquire the value of an environment variable via sd-sys-getenv which represents a filename.
Parameters:
filename {STRING} - the filename to convert
Return value:
filename - the converted filename
Examples:
  (sd-convert-filename-from-platform "c:\\temp\\example.lsp")
     => "c:/temp/example.lsp"
[Integration Kit Contents] [Integration Kit What's New] [Integration Kit Function Index] [More Documentation] [PTC]
© 2024 Parametric Technology GmbH
(a subsidiary of PTC Inc.), All Rights Reserved