- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello!
Right now I'm trying to combine some LISP programs in order to create one that would be really useful to me right now. I want the LISP routine to first of all read alle the xrefs in a dwg, store them in a list and then open the list with the xrefs in a suitable way - a temporarily txt file in notepad for copy-paste would be great. Well, after reading on earlier forum threads and writing some myself, I've got this code:
;;------------------------------------------------------ START OF CODE
(defun c:listxref ()
(vl-load-com)
(setq activedocument (vla-get-activedocument (vlax-get-Acad-Object)));_setq finit
(setq lesblocks (vla-get-blocks activedocument));_setq finit
(setq xrefliste '());_setq finit
(vlax-for item lesblocks
(setq ouixref (vlax-get-property item 'isXref));_setq finit
(if (= ouixref :vlax-true);_si c'est vrai...
(progn
(setq ablock (vlax-get-property item 'Name));... Lisez le nom du block ...
(setq xrefliste (append (list ablock) xrefliste));... ajoutez le nom de la liste ...
);_progn finit
);_if finit
);_vlax for finit
(defun ouvreznotepad (listexref skille / f of)
(setq f (strcat (getvar 'TEMPPREFIX) "§XrefsTemp§.txt")
of (open f "w"))
(mapcar
(function
(lambda (lp)
(mapcar (function (lambda (n) (princ n of)(princ skille of))) lp)
(princ "\n" of)
)
)
listexref
)
(close of)
(startAPP (strcat "notepad.exe " f))
(princ)
)
(print xrefliste)
(ouvreznotepad xrefliste "\t")
(princ)
);_defun finit
(princ)
;;------------------------------------------------------- END OF CODE
So, right now it manages to list all xrefs in the command window, but I can't see that it manages to open notepad with the temporarily text file that I would like it to do... Anyone who can seek out the error(s) in the code?
Regards ts
Solved! Go to Solution.