Introduction - dalefugier/DOSLib GitHub Wiki

DOSLib is a library of LISP-callable functions that provide functionality not available in several CAD-based LISP programming languages, including AutoCAD.

DOSLib extends the LISP languages, supplied by these applications, by providing the following functionality:

  • Drive functions to check for drives, change between drives, and check available disk space.
  • Path functions to manipulate path specifications.
  • Directory functions to create, rename, remove, select, and change directories. Functions to return special operating system directories are also provided.
  • File functions to copy, delete, move, rename, and select files. Functions for getting directory listings, searching and finding multiple instances of files, and changing file attributes are also provided.
  • Printer functions to get and set default printers, and spool print files.
  • Configuration functions to manipulate Windows-style initialization (.INI) files, and access the Windows Registry.
  • Process functions to run internal OS commands or other programs.
  • User interface functions to get strings, integers, reals, and lists from the user. Functions for displaying Windows message boxes, progress meters, and splash screens are also provided.
  • String functions to tokenize strings, extract characters, find characters, insert, remove, and replace characters, and trim characters.
  • Math functions to help with trigonometric calculations, vector manipulation, statistical analysis, and more.
  • CAD functions to save all and close all open files. Functions for previewing drawing and listing xrefs are also provided.
  • System and other functions, like getting system information, sorting lists, changing the system date and time, manipulating the keyboard, and playing sounds.

Installing

Though DOSLib files can be installed in and run from any directory, the following locations are recommended for most environments:

  • A directory specified by the application's Support File Search Path.
  • A directory common to multiple users.
  • The directory where the application executable file is located.

DOSLib Files

AutoCAD Files

File Description
DOSLib19.arx DOSLib for AutoCAD 2013 and 2014 (x86)
DOSLib19x64.arx DOSLib for AutoCAD 2013 and 2014 (x64)
DOSLib20.arx DOSLib for AutoCAD 2015 and 2016 (x86)
DOSLib20x64.arx DOSLib for AutoCAD 2015 and 2016 (x64)
DOSLib21.arx DOSLib for AutoCAD 2017 (x86)
DOSLib21x64.arx DOSLib for AutoCAD 2017 (x64)
DOSLib22.arx DOSLib for AutoCAD 2018 (x86)
DOSLib22x64.arx DOSLib for AutoCAD 2018 (x64)
DOSLib23.arx DOSLib for AutoCAD 2019 and 2020 (x86)
DOSLib23x64.arx DOSLib for AutoCAD 2019 and 2020 (x64)
DOSLib24x64.arx DOSLib for AutoCAD 2021 through 2024
DOSLib25x64.arx DOSLib for AutoCAD 2025

BricsCAD Files

File Description
DOSLib13.brx DOSLib for BricsCAD Pro V13 (x86)
DOSLib13x64.brx DOSLib for BricsCAD Pro V13 (x64)
DOSLib14.brx DOSLib for BricsCAD Pro V14 (x86)
DOSLib14x64.brx DOSLib for BricsCAD Pro V14 (x64)
DOSLib15.brx DOSLib for BricsCAD Pro V15 (x86)
DOSLib15x64.brx DOSLib for BricsCAD Pro V15 (x64)
DOSLib16.brx DOSLib for BricsCAD Pro V16 (x86)
DOSLib16x64.brx DOSLib for BricsCAD Pro V16 (x64)
DOSLib17.brx DOSLib for BricsCAD Pro V17 (x86)
DOSLib17x64.brx DOSLib for BricsCAD Pro V17 (x64)
DOSLib18.brx DOSLib for BricsCAD Pro V18 (x86)
DOSLib18x64.brx DOSLib for BricsCAD Pro V18 (x64)
DOSLib19.brx DOSLib for BricsCAD Pro V19 (x86)
DOSLib19x64.brx DOSLib for BricsCAD Pro V19 (x64)
DOSLib20.brx DOSLib for BricsCAD Pro V20 (x86)
DOSLib20x64.brx DOSLib for BricsCAD Pro V20 (x64)
DOSLib21x64.brx DOSLib for BricsCAD Pro V21
DOSLib22x64.brx DOSLib for BricsCAD Pro V22
DOSLib23x64.brx DOSLib for BricsCAD Pro V23
DOSLib24x64.brx DOSLib for BricsCAD Pro V24
DOSLib25x64.brx DOSLib for BricsCAD Pro V25

Loading

Loading Manually

You can manually load DOSLib several ways. Check the help documentation included with your CAD for details on loading applications.

To load DOSLib manually from AutoCAD using the ARX command:

  • From the AutoCAD command prompt, enter ARX.
  • When presented with a list of options, enter L for load.
  • In the Select ARX dialog box, select the appropriate DOSLib ARX file from the installation directory, and click Open.

To load DOSLib manually from AutoCAD using the APPLOAD command:

  • From the AutoCAD command prompt, enter APPLOAD.
  • In the Load Applications dialog box, select the appropriate DOSLib ARX file from the installation directory, and click Load, and then click Close.

Loading DOSLib Automatically

You can also automatically load DOSLib in several ways. Check the help documentation included with your CAD for details on loading applications.

To load DOSLib automatically from AutoCAD:

  • Add the appropriate DOSLib ARX filename to the ACAD.RX file, or
  • Add an ARXLOAD function to either the ACAD.LSP or menu.MNL file, or
  • Add appropriate DOSLib ARX to the AutoCAD Startup Suite.

Note, if you choose the ARXLOAD method, the ARXLOAD function must be part of the S::STARTUP function. This is because AutoCAD does not initialize ARX until S::STARTUP. Also, AutoCAD processes the ACAD.LSP file before any menu.MNL file. If both files have a S::STARTUP function, only the function in menu.MNL is interpreted.

The DOSLibLoader function is an example of how you can automatically load the correct version of DOSLib in your supporting CAD application:

(defun DOSLibLoader (/ prog acadv ext proc fname)
  ; Retrieve CAD platform details
  (setq prog (getvar "Program"))
  ; Determine the version of the CAD Application
  ; and the arx file type to use
  (cond
    ; BricsCAD
    ((= prog "BRICSCAD") 
      (setq acadv (substr (getvar "_VERNUM") 1 2))
      (setq ext ".brx")
    )
    ; AutoCAD
    ((= prog "acad")
      (setq acadv (substr (getvar "ACADVER") 1 2))
      (setq ext ".arx")
    )
  )
  ; Determine the system's processor architecture
  (setq proc (= "AMD64" (getenv "PROCESSOR_ARCHITECTURE")))
  ; Build a file name string
  (if proc
    (setq fname (strcat "DOSLib" acadv "x64" ext))
    (setq fname (strcat "DOSLib" acadv ext))
  )
  ; If found on the search path, load it
  (if (findfile fname)
    (arxload fname nil)
    (prompt (strcat "\n" fname " not found.")) ; Otherwise prompt that it's missing
  )
  (princ)
)

Loading On Demand

DOSLib has the ability to be demand-loaded by CAD applications. Note, applications that implement demand loading on AutoCAD startup will be loaded before those listed in ACAD.RX.

When DOSLib is loaded the first time, using any of the above methods, it automatically registers itself with AutoCAD as an application that can be demand-loaded. The initial configuration is to be demand-loaded at command invocation.

Upon subsequent AutoCAD sessions, it is only necessary to enter DOSLIB from the AutoCAD command prompt to load DOSLib. DOSLib can also be configured to demand-load every time AutoCAD starts. See the dos_demandload function documentation for details.

If you ever change the location of DOSLib, you will need to manually load DOSLib once for it to automatically re-register itself with your application.