PyAcad 0.4.1

Various Queries and Commands

The functions and constants in this section are defined directly in the ads module.

Functions

command(arg...)

Execute the arguments as if they had been entered at the Autocad/Intellicad command line. Valid arguments are the following:

If called without arguments, then this function is equivalent to typing <ctrl-C> on the keyboard, resp. <Escape> in R14 and Autocad/Intellicad 2000.

If the user presses <ctrl-C>/<Escape> during execution (usually when a '\' waits for user input), a KeyboardInterrupt exception is raised. A ValueError exception is raised if the arguments don't form a valid command sequence.

getappname() -> file_path
Return the full path name of the current application. This is the file name of the py_acad ARX extension.
getcname() -> string
Return the local language name of an standard Autocad/Intellicad command, or the other way. Standard names are given with a leading underscore.
setvar(varname, value)
Set the Autocad/Intellicad system variable of the name varname to the given value. If the type of the value doesn't match the type of the variable, or the variable is read only, a ValueError exception is raised. In general, the types accepted by command() can be used for values here as well.
getvar(varname) -> value
Get the value of the Autocad/Intellicad system variable with the name varname.
putsym(symname, value)
Set the global Autolisp symbol of the name symname to the given value. If the type of the value is not convertable to an Autolisp value, a ValueError exception is raised. In general, the types accepted by command() can be used for values here as well, plus arbitrarily nested lists and tuples of such values.
getsym(symname) -> value
Get the value of the global Autolisp symbol with the name symname.
findfile(filename) -> file_path

Searches for the file specified by filename and returns the full path if found, or None. If fname is qualified by including a drive or directory prefix (for example, "d:test.exp") or by the "/" character on unix systems, then it searches only that disk or directory. Otherwise, it searches for fname according to the current AutoCAD library path, which consists of the following directories, in order:

  1. The current directory
  2. The directory that contains the current drawing file
  3. The directories named by the ACAD environment variable (if this variable has been specified), resp. as specified as support paths in the options dialog.
  4. The directory that contains the AutoCAD program files
snvalid(string [,allowpipe]) -> boolean
Tests a symbol table name for validity, including symbol table names with out-of-code-page escape sequences. Returns 1 if the string is a valid symbol name, else 0. The allowed length of the string and the characters it may contain depend on the Autocad/Intellicad release we're running with. If the optional integer argument allowpipe is present and not zero, then the function will also accept the pipe character "|" in the string.
getfiled(arg, arg, arg) -> value
Not implemented yet.
setview(view)
Not implemented yet.
help(arg, arg, arg) -> value
Not implemented yet.
tablet() -> value
Not implemented yet.