Select all OLE Objects (images/Metafiles)

Select all OLE Objects (images/Metafiles)

TVirks
Participant Participant
1,869 Views
3 Replies
Message 1 of 4

Select all OLE Objects (images/Metafiles)

TVirks
Participant
Participant

Hello,

I need a LISP that is able to select all OLE objects, specifically Metafile Images if that helps. I have a LISP which sends all images to back or front, but some images are input as OLE objects. Does anyone know of a LISP which will do this? 

Below is a post on another forum I found about deleting them, but I can't work out what I need to remove in order to just select them. I tried to use vla-movetobottom, but I don't fully understand how to use it. Apparently replacing vla-delete with vla-movetobottom isn't good enough!

 

(defun C:getole ()
(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)
                  )
	  )
)

 

 

0 Likes
Accepted solutions (1)
1,870 Views
3 Replies
Replies (3)
Message 2 of 4

dbhunia
Advisor
Advisor

Fro this.....

 


@TVirks wrote:

Hello,

I need a LISP that is able to select all OLE objects, specifically Metafile Images if that helps. I have a LISP which sends all images to back or front, but some images are input as OLE objects. Does anyone know of a LISP which will do this? 

Below is a post on another forum I found about deleting them, but I can't work out what I need to remove in order to just select them. I tried to use vla-movetobottom, but I don't fully understand how to use it. Apparently replacing vla-delete with vla-movetobottom isn't good enough!

.....................


 

Try like this.......

 

(defun C:getole ( / ss)
(if (setq ss (ssget "_A" (list '(0 . "OLE2FRAME"))))
    (command "_.draworder" ss "" "_f")
)
)

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 3 of 4

dlanorh
Advisor
Advisor
Accepted solution

You could just add it to the image routines from your previous post.

 

(if (setq ss (ssget "_X" '((0 . "IMAGE,OLE2FRAME"))))(command "_DRAWORDER" ss "" "_BACK"))
..
..
(if (setq ss (ssget "_X" '((0 . "IMAGE,OLE2FRAME"))))(command "_DRAWORDER" ss "" "_FRONT"))

 

I am not one of the robots you're looking for

0 Likes
Message 4 of 4

dbhunia
Advisor
Advisor

@TVirks  Sorry I did not noticed that you want to change the Draw Order "to back or front"..... then do like this.

 

For Draw Order Bring to Front.

.......
(if (setq ss (ssget "_A" (list '(0 . "OLE2FRAME")))) (command "_.draworder" ss "" "_f") )
.......

 

For Draw Order Send to Back.

.......
(if (setq ss (ssget "_A" (list '(0 . "OLE2FRAME")))) (command "_.draworder" ss "" "_b") )
.......

 

This all for only "OLE Objects", Hopefully you can manipulate the rest.......

 

And use ssget "_X" to "select all OLE Objects in the database, including entities on layers that are off, frozen, and out of the visible screen"


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes