Drawing Version
Function Syntax | (LM:dwgversion <dwg>) |
Current Version | 1.1 |
Download | DrawingVersionV1-1.lsp |
View HTML Version | DrawingVersionV1-1.html |
Donate |
Arguments | ||
---|---|---|
Symbol | Type | Description |
dwg | String | Filename of dwg / dws / dwt / dxf file |
Returns | ||
Type | Description | |
String | A string describing the drawing version of the supplied drawing file, else nil. |
Function Description
This function will return a string describing the drawing version of a supplied drawing file, if possible.
The function is compatible with drawing files in dwg / dws / dwt / dxf format.
If supplied with a drawing filename without a filepath, this function will search the working directory and all AutoCAD Support File Search Paths for the supplied drawing filename, and will attempt to return the drawing version of the first matching file found.
If the supplied drawing file could not be found, or the drawing version could not be determined, this function will return nil.
Example Programs
The following example program will prompt the user to select a drawing file (dwg / dws / dwt / dxf) and, following a valid response, will print the drawing version of the selected file to the AutoCAD command-line, if possible.
;; Prints the version of a selected drawing file (defun c:getversion ( / fn vr ) (if (setq fn (getfiled "" "" "dwg;dws;dwt;dxf" 16)) (if (setq vr (LM:dwgversion fn)) (princ (strcat "\nThe selected file is an AutoCAD " vr " format file.")) (princ "\nThe format of the selected file could not be determined.") ) ) (princ) )
This second example program will print the drawing version of the active drawing file, if the file has been saved.
;; Prints the version of the active drawing file (defun c:getcversion ( / vr ) (if (zerop (getvar 'dwgtitled)) (princ "\nThe current drawing is unsaved.") (if (setq vr (LM:dwgversion (strcat (getvar 'dwgprefix) (getvar 'dwgname)))) (princ (strcat "\nThis is an AutoCAD " vr " format file.")) (princ "\nThe format of this file could not be determined.") ) ) (princ) )