Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Delete all solid hatches

33 REPLIES 33
SOLVED
Reply
Message 1 of 34
kameron1967
30144 Views, 33 Replies

Delete all solid hatches

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

33 REPLIES 33
Message 21 of 34
Anonymous
in reply to: Kent1Cooper

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
Message 22 of 34
Kent1Cooper
in reply to: Anonymous

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
Message 23 of 34
Anonymous
in reply to: kameron1967

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

Message 24 of 34
rkmcswain
in reply to: Anonymous

@Anonymous - if you are talking about the lisp code in post #2, then it's "delsolhat"
R.K. McSwain     | CADpanacea | on twitter
Message 25 of 34
Anonymous
in reply to: Kent1Cooper

Hi

No, all solid white hatches, in different shape and size, within different blocks shall be cleaned out. Boundaries should stay.
Message 26 of 34
Kent1Cooper
in reply to: Anonymous


@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
Message 27 of 34
Anonymous
in reply to: Kent1Cooper

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.


Message 28 of 34
DarrenLowe5325
in reply to: Lee_Mac

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)

 


 

Message 29 of 34
rkmcswain
in reply to: DarrenLowe5325

@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
Message 30 of 34
DarrenLowe5325
in reply to: rkmcswain

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.

Message 31 of 34

Yes, LeeMac is a wiz. He's got so many useful routines. This is definitely one of them! 🙂
Message 32 of 34
ajmalnattika
in reply to: Lee_Mac

dear lee mac,

how can i do this one using selection

Message 33 of 34
rosst5ZL4H
in reply to: kameron1967

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.

Message 34 of 34
rosst5ZL4H
in reply to: Lee_Mac

No it does not work at least not in Version 2023

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta