Ohman92 Posted April 29, 2022 Posted April 29, 2022 Hi! I'm trying to run a lisp from accoreconsole. The function works great in regular Autocad. The lisp changes xref's path and name. The lisp loads fine with: (load "C:/Users/xxx/TEST.lsp") but gives an error after using the command. ; error: bad argument type: VLA-OBJECT nil Is it possible to make it work in accoreconsole? Thanks! The lsp: (made by Lee Mac) (defun c:fixpath ( / new nme old pth ) (if (and (/= "" (setq old (getstring t "\nSpecify string to find: "))) (/= "" (setq new (getstring t "\nSpecify string to replace: "))) ) (vlax-for blk (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (if (and (= :vlax-true (vla-get-isxref blk)) (vl-string-search old (vl-filename-base (setq pth (vla-get-path blk)))) ) (progn (setq nme (vl-string-subst new old (vl-filename-base pth))) (vla-put-path blk (strcat (vl-filename-directory pth) "\\" nme ".dwg")) (vla-put-name blk nme) (vla-reload blk) ) ) ) ) (princ) ) (vl-load-com) (princ) Quote
mhupp Posted April 29, 2022 Posted April 29, 2022 (edited) Quote https://autocadtips1.com/2013/01/30/up-and-running-with-the-2013-core-console/ As I mentioned above, the Core Console is limited in what it can do. And luckily Kean Walmsley has already done the hard part and found out what commands the Core Console will recognize found [here] and Kean has also put together a nifty .txt file that contains the available commands as well found [here]. Thanks for putting that together Kean!! Doesn't look like you can use visual lisp in accoreconsole. that is stuff with vl, vla, & vlax Edited April 29, 2022 by mhupp Quote
BIGAL Posted April 30, 2022 Posted April 30, 2022 You can not do getstring or for that matter any of the getpoint, getreal etc (defun c:fixpath ( new old / nme pth ) so pass the new old (c:fixpath "abc""def") (vla-get-blocks .......(setq blk (tblnext "BLOCK")) will step through the block table This seemed to answer Entget xref - Autodesk Community - AutoCAD Sorry no quick answer. need to look further into the entget. Copy paste to command line sample code (defun wow () (setq xreflist '()) (tblnext "block" T) (while (/= nil (setq temp (tblnext "block"))) (if (assoc 1 temp) (setq xreflist (cons (list (cdr (assoc 0 temp)) (cdr (assoc 1 temp)) (cdr (assoc 2 temp))) xreflist)) ) ) (princ xreflist) ) Quote
ronjonp Posted April 30, 2022 Posted April 30, 2022 It looks like you can load acapp.arx or other assemblies to have more commands available. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.