BorisJ Posted May 15, 2020 Posted May 15, 2020 Hi, I would appreciate if someone could help me with a lisp to explode all dimensions in multiple drawings in AutoCAD. I know exploding dimensions is not the best, however I have to do it for this specific project and I have a lot of drawings. Quote
ronjonp Posted May 18, 2020 Posted May 18, 2020 (edited) Give this a try .. welcome to CadTutor (defun c:foo (/ a d el s) ;; RJP » 2020-05-18 (vlax-for l (vla-get-layers (setq d (vla-get-activedocument (vlax-get-acad-object)))) (cond ((= -1 (vlax-get l 'lock)) (vlax-put l 'lock 0) (setq a (cons l a)))) ) (if (setq s (ssget "_X" '((0 . "DIMENSION")))) (foreach e (mapcar 'cadr (ssnamex s)) (vlax-for a (vla-item (vla-get-blocks d) (cdr (assoc 2 (setq el (entget e))))) (entmakex (append (entget (vlax-vla-object->ename a)) (list '(8 . "Busted_Dims") '(62 . 8) (assoc 410 el)) ) ) ) ;; Entdel does not work on layouts (vl-catch-all-apply 'vla-delete (list (vlax-ename->vla-object e))) ) ) (foreach l a (vlax-put l 'lock -1)) (princ) ) (vl-load-com) Edited May 18, 2020 by ronjonp 4 Quote
BIGAL Posted May 19, 2020 Posted May 19, 2020 (edited) Posted at forums/Autodesk. It would be useful if people stated posting else where. Question asked on other forum was are dims in "model" or layouts or both ? This impacts ssget "x" https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-explode-dimensions-in-multiple-autocad-drawings/td-p/9520250 Edited May 19, 2020 by BIGAL Quote
hanhphuc Posted May 19, 2020 Posted May 19, 2020 (edited) 10 hours ago, BIGAL said: Posted at forums/Autodesk. It would be useful if people stated posting else where. OP mentioned multiple drawings in AutoCAD i tested your script it's not working. not sure putting ronjonp's routine in script. eg: "exdim.scr"? p/s: i just realized vla-explode method does not support dimensions!! hat's off ronjonp's Edited May 19, 2020 by hanhphuc Quote
ronjonp Posted May 19, 2020 Posted May 19, 2020 15 hours ago, hanhphuc said: OP mentioned multiple drawings in AutoCAD i tested your script it's not working. not sure putting ronjonp's routine in script. eg: "exdim.scr"? p/s: i just realized vla-explode method does not support dimensions!! hat's off ronjonp's Thanks! Quote
BIGAL Posted May 20, 2020 Posted May 20, 2020 hanhphuc I did not test script like every one here time has a cost so just tested on a single open dwg just suggested something like that sequence could work. Using the lisp to do the work is more reliable. Quote
hanhphuc Posted May 20, 2020 Posted May 20, 2020 10 hours ago, BIGAL said: hanhphuc I did not test script like every one here time has a cost so just tested on a single open dwg just suggested something like that sequence could work. Using the lisp to do the work is more reliable. no worries Al, just play around a bit neither my attempt working. AFAIK script looks like entering command line, every space counts. it seems easy writing script but clueless my attempt was putting a standard command like your example as well as Ronjonp's code in xpdim.lsp (defun xpdim ( / ss ) (setvar 'qaflags 1) (if (setq ss (ssget "_X" '((0 . "DIMENSION")))) (vl-cmdf "_explode" ss "") ) (setvar 'qaflags 0) (princ) ) then i wrote this script, test.scr all put in path folder D:/TEMP/ open "D:/TEMP/TEST1.dwg" (load "D:/TEMP/xpdim.lsp") (c:foo) qsave close open "D:/TEMP/TEST2.dwg" (load "D:/TEMP/xpdim.lsp") (xpdim) qsave close open "D:/TEMP/TEST3.dwg" (load "D:/TEMP/xpdim.lsp") (c:foo) qsave close command: SCR Only the 1st TEST1.dwg (c:foo) worked , but it failed in the next drawing error shows: Unable to find requested file: "qsave.dwg" p/s: using BCAD Quote
BIGAL Posted May 20, 2020 Posted May 20, 2020 Put the qsave close in the lisp. Can not remember if need space after (load …) I use dir *.dwg /b >dirlist The use word using replace ^p to add all the correct commands before or after the end of line. Copy and paste to notepad the final as word has a nastyadding hidden characters even if saving as text. Replace ^p open ^p Replace ^p (load "D:/TEMP/xpdim.lsp")^p 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.