Jump to content

Delete all hatches within a drawing?


Recommended Posts

Hi,

 

Quite often I recieve drawings with loads of hatches/solid fills in. For example a housing layout with all of the houses, trees, roads, grass etc hatched.

 

I generally want to delete these/turn them off and work with a line drawing.

 

Sometimes the hatches have been drawn on their own layer, so turning them off is simple. But sometimes they've been drawn on layers with other things I want to keep. Genereally there are loads of hatches, so deleting them one by one is frustratingly slow.

 

I used to use Microstation, and in that there was a tool to delete hatches or fills, and if you selected all items you could delete the lot in one go. Is there such a tool in AutoCAD? If not, what would you advise?

 

Many thanks,

 

Alex

Link to post
Share on other sites
  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • alanjt

    6

  • BlackBox

    5

  • nicolas

    3

  • Mr.Alex

    2

Top Posters In This Topic

Posted Images

FYI - Run QSELECT first as skipso has suggested. Under Apply to select Entire drawing. Under Object Type select Hatch. Set Properties, Value and Operator to further define your selection set if need be. Click on the OK button. Every hatch pattern has now been selected. Execute the ERASE command and they should all be eliminated from the drawing.

Link to post
Share on other sites

FILTER has the same basic function as QSELECT, but is more powerful and has more options, like AND and OR functions if I remeber correctly. It's worth checking out if you have never used it.

Link to post
Share on other sites

Just a couple of hours ago i thought: it would be sooo useful if you could QS using multiple parameters!

And there comes shibuboss with the FILTER command which i have never heard of in my 9 months as a cad-designer! :?

 

So cool, thanks shibu!

Link to post
Share on other sites
skipsophrenic
Just a couple of hours ago i thought: it would be sooo useful if you could QS using multiple parameters!

And there comes Tiger with the FILTER command which i have never heard of in my 9 months as a cad-designer! :?

 

 

Dont worry mate - i been using AutoCAD for 2 and a bit years now, an i didnt know about that!

 

:)

Link to post
Share on other sites
  • 1 year later...

Thank guys for this, I was facing selecting a lot of wall fill hatches that I needed to move to a 253 color. Quick search in CADTutor.. and 2 minutes later the whole task is done!!!!:thumbsup:

Link to post
Share on other sites

You could also use the very old, but quite useful SSX tool.

 

eg.

Command: SSX

Initializing...
Type "ssx" at a Command: prompt or
(ssx) at any object selection prompt.
Select object <None>:

Enter filter option [block 
name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector]: E

>>Enter entity type to add <RETURN to remove>: HATCH

Current filter: ((0 . "HATCH"))
Enter filter option [block 
name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector]:

Link to post
Share on other sites

Through I have seen the Filter Dialog Box, I have never never heard of SSX. What does it do? and How do we use the SSX|Filter Command?

Link to post
Share on other sites
Through I have seen the Filter Dialog Box, I have never never heard of SSX. What does it do? and How do we use the SSX|Filter Command?

 

Try looking in the Express Tools help files. All the information is there :D

Link to post
Share on other sites

Hi,

 

The SSX Command is indeed part of the Express tool through I have not seen it in the Express Menu. I believe one of its advantage is that it can be used in Autolisp compare to Quick Select. I will look into it and Filter and how they can be used to boost drawing speed.

 

Many thanks.

Link to post
Share on other sites

The SSX command is only available from the Command Line, and does not appear in the Express Tools Menu. That is why I suggested looking at the Express Tools Help files, where you can find out all about it. :D

Link to post
Share on other sites

Click on one of your hatchs (select it), then right click and find "Select Similar". I use that one a lot, as well as qselect and filter. They all have their uses.

Link to post
Share on other sites
BlackBox

I usually use one of the methods listed already (Select Similar / QSelect + Delete), but as this thread two pages long, why not add one more alternative!? :lol:

 

... Just for fun:

 

(defun c:BBH () (C:BYEBYEHATCH))

(defun c:BYEBYEHATCH (/ ss layerTable layerItem lockedLayers)
 (princ "BYE BYE HATCH")
 (vl-load-com)
  (if (setq ss (ssget "_x" '((0 . "HATCH"))))
   (progn
     (vla-startundomark
       (cond (*activeDoc*)
             ((setq *activeDoc* (vla-get-activedocument (vlax-get-acad-object))))))
     (setq layerTable (vla-get-layers *activeDoc*))
     (vlax-for x (setq ss (vla-get-activeselectionset *activeDoc*))
       (if (and (setq layerItem (vla-item layerTable (vla-get-layer x)))
                (= :vlax-true (vla-get-lock layerItem))
                (setq lockedLayers (cons layerItem lockedLayers)))
         (progn
           (vla-put-lock layerItem :vlax-false)
           (vla-delete x))
       (vla-delete x)))
     (foreach l lockedLayers
       (vla-put-lock l :vlax-true))
     (vla-delete ss)
     (vla-endundomark *activeDoc*))
   (prompt "\n** No hatch objects exist ** "))
 (princ))

 

** Code above accounts for locked layers, but will not modify blocks (i.e., nested hatch) **

Link to post
Share on other sites

Mat, if you are going to check the object layer's locked/unlocked state while stepping through the selection, why not just reset it after deleting the hatch object, instead of creating a list of layer objects and stepping through the list at the end?

IMO, objects on locked layers are there for a reason. Not that I haven't ever done it, but I'm just not a big fan of unlocking layers to mod stuff in a select all scenario - notice the statement is prefixed with 'IMO', so take it for what little it's actually worth. :)

Link to post
Share on other sites
BlackBox
Mat, if you are going to check the object layer's locked/unlocked state while stepping through the selection, why not just reset it after deleting the hatch object, instead of creating a list of layer objects and stepping through the list at the end?

IMO, objects on locked layers are there for a reason. Not that I haven't ever done it, but I'm just not a big fan of unlocking layers to mod stuff in a select all scenario - notice the statement is prefixed with 'IMO', so take it for what little it's actually worth. :)

 

No worries, Alan. :)

 

The reason I chose not to restore the lock (after each deletion) is because the code steps through the selection set...

 

Hypothetically, if there were say two or more hatches on the same layer, and they're only being deleted one at a time (as the vlax-for steps through the ActiveSelectionSet) then the unlock / lock would be done for each item on the respective layer. Not sure how you, or others may work, but I usually have all 'like' hatches on a single layer (i.e., Sidewalk, Milling & Resurfacing, Sod, Wetlands, etc.).

 

Point taken for leaving locked layers alone...

 

:: Disclaimer ::

 

anyone who uses the above posted example (

Link to post
Share on other sites

Yeah, I see now that you check if the object's layer is locked, which would not be locked on the second go around for a layer that already had a object 'processed'. It just seemed a little flimsy, but in truth, either way would be.

Mostly, I just don't like the idea of unlocking layers and altering object(s) on said locked layers - the layers are obviously locked for a reason.

Link to post
Share on other sites
BlackBox
Yeah, I see now that you check if the object's layer is locked, which would not be locked on the second go around for a layer that already had a object 'processed'. It just seemed a little flimsy, but in truth, either way would be.

Mostly, I just don't like the idea of unlocking layers and altering object(s) on said locked layers - the layers are obviously locked for a reason.

 

We're in agreement for Best Practices... I simply included this functionality in response to the OP's explicit request of how to 'Delete all hatches in a drawing?'

 

I do use routines which *add* entities to a given drawing regardless of locked layers; but I cannot think of a practical, non-one-time-use as I *believe* this thread's purpose to be.

Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...