VEA-Utils v17.11.13 …Lisp Tools

VEA-Utils v17.11.13 – – Details:  

VEA-Utils is a free Add-On to AutoCAD & BricsCAD which contains useful Lisp sub-functions to help you in your application development. Functions include file utilities, block & attribute tools, string functions, sorting mechanisms, and more. These Utils are updated regularly and are required for VEA Applications…

Over the years, I began to use the same functions over and over again… I started copying the same header into many of my routines. But, then I started making new and improved versions, which eventually lead to me not remembering which version was newer, etc..

My solution has been to put these standard functions into a separate file and so VEA-Utils is the result. Some of these functions are very, very old (older than the VL functions), so you might notice that some of these can be replaced. Or, you might find they work in a similar fashion, but the result is slightly different.

Please feel free to use and provide feedback! I do update regularly and plan to add more features. Finally, while these tools are free to use, they are “use at your own risk”, as there is no guarantee or warranty implied. Downloads available on

VEA-Utils must be placed in a current Support folder, as it uses the findfile function to validate that is can find itself.

—– Variable List ——————————————————————

veadir                               Location of program

veacadvr                          = “_Bcad” or “_Acad”

veacadsn                         Serial Number of Current <?_cad> program

—– Functions ———————————————————————–


Current date/time – variables: date = xx-xx-xxxx , dates = xx/xx/xxxx , time = xx:xx:xx

(rtrim <string>)                   

Right Trim -remove all spaces at beginning and end of string ”  123  ” -> “123”

(rtocs <num> <prec>)       

Real to Comma’d String – similar to rtos, without type format 1234 -> “1,234”

(ncntr <string> <char>)     

Qty of char found in string – Returns integer  (ncntr “Test12312” “1”)  ->  2

(nextchr <string>)              

Increment String Characters (nextchr “123”) -> 124

Other types: a -> b; z -> A; A -> B; Z -> AA; AZ -> BA, etc… Current MAX = ZZ; Numbers = no Max

(scnt <string> <#>)            

Add spaces to string to specified length   (scnt “1234” 10) -> “1234      “

(slsh <path>)                       

Replace back “\” with forward “/”

(bkslsh <path>)                  

Replace forward “/” with “\”

(cprune <string> <char>)           

Character Prune -> Returns up to char [car for strings…]  (cprune “1234^56^78” “^”) -> “1234”

(lprune <string> <char>)           

Last Char Prune -> Returns after LAST char  (lprune “1234^56^78” “^”) -> “78”

(sprune <string> <char>)           

Suffix Prune -> Returns all after 1st instance of Char [cdr for strings…] (sprune “1234^56^78” “^”) -> “56^78”

(sprunen <nth> <strng> <chr>) 

Loop Suffix Prune -> Returns all after nth sprune  (sprunen 2 “1234^56^78^90” “^”) -> “78^90”

(wfind  <string> <word>)           

Word find, returns entire string if pattern match exists – Case Sensitive  (wfind  “Find the Word” “the”) -> “Find the Word”

(wprune <string> <word>)         

Word Prune -> Returns string after 1st instance, including word      (wprune “Find the Word” “the”) -> “the Word”

(vprompt <string>)             

Returns 2 blank command lines before printing prompt on new line

(vea_yyn <string>)             

Yes/No Dialog with Y as default, returns “Yes” or “No”

(vea_ynn <string>)             

Yes/No Dialog with N as default, returns “No”  or “Yes”

(pmember <pnt> <list>)             

Returns t if point is member of point list

(pposition <pnt> <list> <prec>)  

Returns nth position of point inside of point list with rounding

(pequal <pnt1> <pnt2> <prec>)  

Returns t if points are equal… btw: Acad has trouble with Scientific point compare! pequal was created to get around this

—— File and Path Functions ———————————————————

(veagetfolder <prompt> <path>)   

Return Folder path (options using “veafolderoptions” variable, Note: these options are quirky in Windows 10)

(getfname <path-file>)                   

Returns file name w/o ext – same as VL-filename-base

(getfpath <path-file>)                     

Returns file path w/o fnam – similar VL-filename-Directory , but includes last delimiter “/”

(findfiles <path> <ext>)                   

Returns List of files in path with specific ext – use “*” for all

(findallfiles <path><ext>)               

Returns Recursive (all folders) List of files with ext

——- Attributes, Sorting, Xdata, etc… ———————————————

(bubblesort <list>)             

Returns String list sorted … This can be slow, contact me if you have really large lists…

(strnumsort <list>)             

Returns String list of numbers sorted by numeric VALUE

(aecstrsort <list>)               

Returns sorted list of strings w/proper number vals (“A1b” “A10” “A1” “A2”) -> (“A1” “A1b” A2″ “A10”)

(getattval <entity> <#>)      

Returns # (nth) Attribute Value from Block

(getblkents <entity>)           

Returns list of Entities contained in the Block def

(vsetxdata <entity> <XDName> <Val>)          

Registers XDName, Adds Xdata <val> to entity

(vgetxdata <entity> <XDName>)                     

Returns Xdata attached to entity

——- Help —————————————————————————————

Once VEA-Utils has loaded, type “VEAHELP” to retrieve current list of commands and updates

Please provide feedback and let us know if you are looking for similar functions!

Leave a Reply