Hi,
I want to list all of loaded lisp programs in AutoCAD (both .lsp and .fas)
It's easy for .ARX files:
(vlax-safearray->list (vlax-variant-value (vlax-invoke-method (vlax-get-acad-object) 'listarx)))
But I don't have any idea for lisp programs, does anybody knows how can I do that?
Thanks,
Abbas
Solved! Go to Solution.
Solved by aqdam1978. Go to Solution.
@aqdam1978 wrote:
I want to list all of loaded lisp programs in AutoCAD (both .lsp and .fas)
Beyond what Alan has already offered, I'm not sure that the LISP API has the ability to do this... Without some sort of custom .NET LispFunction Method (I'm looking into that now).
Also, as an alternative to this:
@aqdam1978 wrote:
It's easy for .ARX files:
(vlax-safearray->list (vlax-variant-value (vlax-invoke-method (vlax-get-acad-object) 'listarx)))
... You could simply use:
(arx)
** Note that (arx) returns all .ARX, and .DBX assemblies... For .NET assemblies, you can also try my DLL .NET LispFunction.
"How we think determines what we do, and what we do determines what we get."
@aqdam1978 wrote:Hi alanjt_
Thanks for your code, But I loaded a lisp program and your code could not detect it.
😞
At first glance, it works for me.
What're you trying to accomplish?
@alanjt_ wrote:
@aqdam1978 wrote:Hi alanjt_
Thanks for your code, But I loaded a lisp program and your code could not detect it.
😞
At first glance, it works for me.
What're you trying to accomplish?
1+... Works for me (for my loaded C: prefixed functions).
"How we think determines what we do, and what we do determines what we get."
Has always worked for me. That's how I protect my subroutines. I filter the atoms-family list by "AT:*" and protect the leftovers.
Hooray - Pragma!
Boo - Autodesk Online [not-so-much-] Help!
* Wonders if this post will now show up as part of the 'Autodesk Web Results' *
#WishfulThinking
"How we think determines what we do, and what we do determines what we get."
Hi Henrique,
Please try my lisp code in attachement.
I cant find my lisp code using Alan's code!
Thanks,
Abbas
Abbas,
case sensitive...
_$ (vl-remove-if-not (function (lambda (x) (wcmatch x "GETLOC*"))) (atoms-family 1)) ("GETLOCALEID") _$
Cheers
Henrique
This is why it's also important to let us know what you are wanting this data for. We might have a beter solution.
Hi Alan,
Thanks for your good ideas,
All I am looking for is to find a solution to make a list for all .lsp/.fas loaded in AutoCAD.
I am beginner in Lisp and I don't know is it possible via lisp or not!
Thanks
Abbas
@aqdam1978 wrote:Hi Alan,
Thanks for your good ideas,
All I am looking for is to find a solution to make a list for all .lsp/.fas loaded in AutoCAD.
I am beginner in Lisp and I don't know is it possible via lisp or not!
Thanks
Abbas
No worries. (atoms-family-1) is going to be your best option. Out of curiousity, why do you need a list of loaded LSP/FAS files?
Hi Alan,
As I told you, I am beginner and would like to learn about lisp programming.
So, I just exploring AutoLISP and AutoCAD!
Thanks for your good information.
Abbas
(defun C:listLSP ( / lst L i S fl fn) ;--------------------------- ;(setq lst CORE-SYMBOL-LIST) ;(setq lst COM-SYMBOL-LIST) (setq lst (vl-remove-if-not (function (lambda (x) (wcmatch x "C:*"))) (atoms-family 1))) ;--------------------------- (setq fl (open (setq fn "List.txt") "w" )) (setq lst (vl-sort lst '<) L (length lst) i 0 S "") (repeat L (write-line (nth i lst) fl) (setq i (1+ i)) );repeat (close fl) (startapp "notepad" fn) );
@aqdam1978 wrote:Hi Alan,
As I told you, I am beginner and would like to learn about lisp programming.
So, I just exploring AutoLISP and AutoCAD!
Thanks for your good information.
Abbas
(defun C:listLSP ( / lst L i S fl fn) ;--------------------------- ;(setq lst CORE-SYMBOL-LIST) ;(setq lst COM-SYMBOL-LIST) (setq lst (vl-remove-if-not (function (lambda (x) (wcmatch x "C:*"))) (atoms-family 1))) ;--------------------------- (setq fl (open (setq fn "List.txt") "w" )) (setq lst (vl-sort lst '<) L (length lst) i 0 S "") (repeat L (write-line (nth i lst) fl) (setq i (1+ i)) );repeat (close fl) (startapp "notepad" fn) );
Looking good so far. Keep in mind, when stepping through a list, use mapcar + lambda or foreach (depending on your desired return). For this, I'd use foreach, since you don't care about a return list.
eg.
(defun c:Test (/ lst file fOpen) (if (and (setq lst (vl-remove-if-not (function (lambda (x) (wcmatch x "C:*"))) (atoms-family 1))) (setq fOpen (open (setq file "c:\\List.txt") "W")) ) (progn (foreach item (vl-sort lst '<) (write-line item fOpen) ) (close fOpen) (startapp "NOTEPAD" file) ) ) (princ) )
Can't find what you're looking for? Ask the community or share your knowledge.