Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Delete all solid hatches

kameron1967
Collaborator

Delete all solid hatches

kameron1967
Collaborator
Collaborator

Hi guys,

 

I would like to be able to go into a drawing and delete all solid hatches from all layers.  Is this possible?  Thank you kindly. 🙂

 

Kameron

0 Likes
Reply
Accepted solutions (2)
32,743 Views
33 Replies
Replies (33)

Anonymous
Not applicable
Hi again, all objects is in same layer, but with different colours- in this case I want to delete all hatches within multiple blocks that are colour overrided White.

Thanks for your effort
0 Likes

Kent1Cooper
Consultant
Consultant

Do you also have other Insertions of the same Block(s), without  the white color override [whether with no color override or with a different color] that contain the same Hatch objects?  If that's the case, you can't remove the Hatch from the Block definitions.  You may need to Explode  all those Blocks and then delete the Hatches.

Kent Cooper, AIA
0 Likes

Anonymous
Not applicable

What do you enter in the Command Prompt to execute this .LISP? I loaded it, but don't know how to execute it?

 

Corey Barge

0 Likes

rkmcswain
Mentor
Mentor
@Anonymous - if you are talking about the lisp code in post #2, then it's "delsolhat"
R.K. McSwain     | CADpanacea | on twitter
0 Likes

Anonymous
Not applicable
Hi

No, all solid white hatches, in different shape and size, within different blocks shall be cleaned out. Boundaries should stay.
0 Likes

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:
.... all solid white hatches, in different shape and size, within different blocks shall be cleaned out. Boundaries should stay.

Try this addition to the code in Post 2:

....
(if (and (= "AcDbHatch" (vla-get-objectname o)) (= "SOLID" (strcase (vla-get-patternname o))) (= 7 (vla-get-Color o))
(vlax-write-enabled-p o) ) (vla-delete o) )
....

 

Kent Cooper, AIA
0 Likes

Anonymous
Not applicable
Hi Again,



I tried the code like this:



(defun c:delsolwhat ( / d )

(vlax-for b (vla-get-blocks (setq d (vla-get-activedocument (vlax-get-acad-object))))

(if (= :vlax-false (vla-get-isxref b))

(vlax-for o b

(if (and (= "AcDbHatch" (vla-get-objectname o)) (= "SOLID" (strcase (vla-get-patternname o))) (= 7 (vla-get-Color o))

(vlax-write-enabled-p o) ) (vla-delete o) )



)

)

)

)

(vla-regen d acallviewports)

(princ)

)

(vl-load-com) (princ)



And it is partly working, when executing It seems that the command is performed, but no changes appear. If I manually type and run BURST afterwards, all the solid white hatches disappear, and it seems that the blocks is intact. I'm not sure if burst explodes only one level that doesn't have any effects.


0 Likes

DarrenLowe5325
Participant
Participant

The lisp routine does not work in AutoCAD 2018.


@Lee_Mac wrote:

The following will delete all solid hatches from all layouts and from within blocks & nested blocks (nested to any level):

 

(defun c:delsolhat ( / d )
    (vlax-for b (vla-get-blocks (setq d (vla-get-activedocument (vlax-get-acad-object))))
        (if (= :vlax-false (vla-get-isxref b))
            (vlax-for o b
                (if (and (= "AcDbHatch" (vla-get-objectname o))
                         (= "SOLID" (strcase (vla-get-patternname o)))
                         (vlax-write-enabled-p o)
                    )
                    (vla-delete o)
                )
            )
        )
    )
    (vla-regen d acallviewports)
    (princ)
)
(vl-load-com) (princ)

 


 

0 Likes

rkmcswain
Mentor
Mentor
@DarrenLowe5325  wrote:

The lisp routine does not work in AutoCAD 2018.

It works fine in 2018 and 2019 for me.

@Lee_Mac 

R.K. McSwain     | CADpanacea | on twitter
0 Likes

DarrenLowe5325
Participant
Participant

I reinstalled AutoCAD 2018 and now it works.

 

That was much easier than going into the registry.


Thank you. Awesome LISP routine. Architects use Revit and they always export CAD files with solid hatching. I love deleting all of the solid.

0 Likes

kameron1967
Collaborator
Collaborator
Yes, LeeMac is a wiz. He's got so many useful routines. This is definitely one of them! 🙂
0 Likes

ajmalnattika
Explorer
Explorer

dear lee mac,

how can i do this one using selection

0 Likes

rosst5ZL4H
Explorer
Explorer

Anything from 2024. Can't get rid of all "Fill" on a supplied drawing. Can't turn fill off as my own blocks use a fill. Turn off Fill ad then Xref the fill is back showing again.

0 Likes

rosst5ZL4H
Explorer
Explorer

No it does not work at least not in Version 2023

0 Likes