Add support file search path through AcadDoc.lsp

Add support file search path through AcadDoc.lsp

Prashanthr
Enthusiast Enthusiast
619 Views
4 Replies
Message 1 of 5

Add support file search path through AcadDoc.lsp

Prashanthr
Enthusiast
Enthusiast

Hello Everyone,

 

I am looking to add the support file search path through acaddoc.lsp. I am thinking of using the Leemac's function to do this. Apologies, as I am new to lisp programming.

;; Add Support File Search Paths  -  Lee Mac
;; Adds a list of Support File Search Paths, excluding duplicates and invalid paths.
;; lst - [lst] list of paths to add, e.g. '("C:\\Folder1" "C:\\Folder2" ... )
;; Returns: [str] "ACAD" Environment String following modification

(defun LM:sfsp+ ( lst )
    (   (lambda ( str lst )
            (if (setq lst
                    (vl-remove-if
                       '(lambda ( x )
                            (or (vl-string-search (strcase x) (strcase str))
                                (not (findfile x))
                            )
                        )
                        lst
                    )
                )
                (setenv "ACAD" (strcat str ";" (apply 'strcat (mapcar '(lambda ( x ) (strcat x ";")) lst))))
            )
        )
        (vl-string-right-trim ";" (getenv "ACAD"))
        (mapcar '(lambda ( x ) (vl-string-right-trim "\\" (vl-string-translate "/" "\\" x))) lst)
    )
)

 

How can I add the userprofile and combine it with the file location? The below code is not working.

(LM:sfsp+ '("(strcat (getenv "userprofile") "\\xxx\\xxxx\\xxxx")))

 

Also, when I add the below code in the acaddoc.lsp it shows the command in the command history when a new drawing is opened. How can I avoid this?

(Command "FILETAB")

 

You help is highly appreciated and thanks in advance.

0 Likes
Accepted solutions (1)
620 Views
4 Replies
Replies (4)
Message 2 of 5

ВeekeeCZ
Consultant
Consultant
Accepted solution

It needs to be evaluated

 

 

(LM:sfsp+ (list (strcat (getenv "userprofile") "\\xxx\\xxxx\\xxxx")))

 

 

(setvar 'cmdecho 0) 

(command "_.filetab")

(setvar 'cmdecho 1)

Message 3 of 5

Prashanthr
Enthusiast
Enthusiast

Hello @ВeekeeCZ 

 

Sweet! Thank you so much. That works. Anyway to make the added path to move to the top of the list in the search path?

0 Likes
Message 4 of 5

ВeekeeCZ
Consultant
Consultant

Probably just swap str with that (apply ...) expression.

 

(strcat str ";" (apply 'strcat (mapcar '(lambda ( x ) (strcat x ";")) lst)))

 

and remove ";"

0 Likes
Message 5 of 5

Prashanthr
Enthusiast
Enthusiast

Sorry, can you please tell me how to do that?

Do I need to replace the ";" with the link?

(LM:sfsp+ (list (strcat str "(getenv "userprofile")" (apply 'strcat (mapcar '(lambda ( x ) (strcat x "\\xxx\\xxx")) lst)))))

 

0 Likes