Hello
Question is how to delete all OLE objects from drawing by most efficient way.
There are abt 150 drawings, each has from 2 to 20 or so OLE objects which need to be deleted. OLE objects are on many paper spaces.
I tried to use qselect but it selects only what is in current space.
Would need some lisp or some other methode than all can be deleted (excluding those which resides in blocks).
Tried also yto use ssx and then erase but still it deletes only what is on current space.
Does anyone have idea?
Just as additional info, those OLE are all pictures, not xls files for example.
regards
miroko
Solved! Go to Solution.
Solved by bobdobbs. Go to Solution.
Not that sure , but try this at the moment .
(defun c:Del-OLE (/ ss i) (if (setq ss (ssget "_x" '((0 . "OLE2FRAME,IMAGE")))) (repeat (setq i (sslength ss)) (entdel (ssname ss (setq i (1- i)))) ) (princ "\n Couldn't find any OLE object or Images ") ) (princ) )
hello
thank you for writing.
The code which you provided is deleting OLE objects but only one of them - i have to use it few times to delete all.
And actually there is something strange because the last OLE object i cannot delete unless i switch to this paper space where it is located.
do not know how to solve it.
regards
miroko
hei
i will give example
we have a drawing with 3 paper spaces.
There are 3 OLE objects (one on each paper space)
whern i start the lisp it removes only one at a time so i have to start it 3 times
but the thing is that 3-rd one (last) is not removed by lisp unless the paper space on which it resides is active
regards
miroko
So try this now ..
(defun c:Test (/ _D) (defun _D (spc / ss i) (if (setq ss (ssget "_x" (list '(0 . "OLE2FRAME,IMAGE") (cons 410 spc)))) (repeat (setq i (sslength ss)) (entdel (ssname ss (setq i (1- i))))) (princ "\n Couldn't find any OLE object or Images ") ) ) (_D "Model") (foreach l (layoutlist) (setvar 'ctab l) (_D l)) (setvar 'ctab "Model") (princ "\nWritten by Tharwat Al Shoufi") (princ) )
now it is working
i understand that that there is no way to avoid switching between paper spaces?
some drawings are large so takes time
miroko
user pbesje wrote some code that would delete blocks from all layouts. I changed it a bit to delete all OLE2FRAME objects. It seems to work for me on 2008.
A link to the original: http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Delete-Block-from-multiple-Layouts/td...
(defun c:delole () (vl-load-com) (if (ssget "_x" (list '(0 . "OLE2FRAME"))) (vlax-for n (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object))) (vla-delete n) ) ) )
@bobdobbs wrote:user pbesje wrote some code that would delete blocks from all layouts. I changed it a bit to delete all OLE2FRAME objects. It seems to work for me on 2008.
A link to the original: http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Delete-Block-from-multiple-Layouts/td...
(defun c:delole () (vl-load-com) (if (ssget "_x" (list '(0 . "OLE2FRAME"))) (vlax-for n (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object))) (vla-delete n) ) ) )
hei
this worked perfectly!
very quick.
thank you for help (to both @bobdobbs and @_Tharwat )
ragards
miroko