Qselect macro

Qselect macro

thebeesnees
Enthusiast Enthusiast
638 Views
5 Replies
Message 1 of 6

Qselect macro

thebeesnees
Enthusiast
Enthusiast

I have created a "clean-up" macro to format external drawings before inserting into our own drawings but need help adding QSELECT functions. 

 

I use QSELECT command to delete all "Point", "Hatch" & "Raster Image" objects from drawings however this proves time consuming when formatting large number of drawings.

 

Is there a way of automating this with macro/lisp routine?

 

Thanks

0 Likes
Accepted solutions (1)
639 Views
5 Replies
Replies (5)
Message 2 of 6

cadffm
Consultant
Consultant
Accepted solution

Hi,

use Lisp, also inside menumacro or script.scr files as well.

The only lisp statement you have to learn is the impressive powerful object selection function: SSGET

You can read all about it in your help and one millions web pages.

 

If you argue with it, there is a less powerful cui way in Expresstools, command: SSX

 

Sebastian

0 Likes
Message 3 of 6

cadffm
Consultant
Consultant

add. You need to know the real object name to use ssget/ssx

 

 

Use this Tool

(defun c:ONAME nil (alert(princ(cdr(assoc 0 (entget(car(entsel)))))))(princ))

 

 

 

Sebastian

0 Likes
Message 4 of 6

thebeesnees
Enthusiast
Enthusiast

SSGET seems to work. I used the following code:

 

(setq ss (ssget "_X" '((0 . "HATCH")(410 . "Model"))))
(command "_.erase" ss "")

 

Thanks

0 Likes
Message 5 of 6

cadffm
Consultant
Consultant

hi,

 

SSX works too, but ssget is more powerful.

 

Edit your code, I like to show you why.

 

1. Open a file with NO toplevel hatchs

   Draw a circle

   Run your code

   What happens?

 

(command will fire an <ENTER> hit, what will restart the last command (Circle)

 

2. Draw a hatch

    Jump to another Layout

   Run your code

   What happens?

 

ERASE can erase objects in the current tab only.

 

 

3. Draw a hatch (you are in Layout currently)

   Run your code

   What happens?

 

(410 . "Model") will select hatchs in MODEL tab only.

 

 

 

 

change your lines to this:

(if (setq ss (ssget "_X" (list '(0 . "HATCH")(cons 410  (getvar 'CTAB))))) (command "_.erase" ss ""))

 

It will select all unnested hatchs in the current space and if one or more objects selected, it runs erase.

 

 

HTH

 

Sebastian

Message 6 of 6

Sea-Haven
Mentor
Mentor

Another suggestion.

 

(0 . "HATCH,POINT,IMAGE")
0 Likes