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
Solved! Go to Solution.
Solved by kameron1967. Go to Solution.
Solved by Lee_Mac. Go to Solution.
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)
Alternatively, for primary hatches only (in all layouts):
(defun c:delsolhat ( / i s ) (if (setq s (ssget "_X" '((0 . "HATCH") (2 . "SOLID")))) (repeat (setq i (sslength s)) (entdel (ssname s (setq i (1- i))))) ) (princ) )
Awesome, Lee. I'll give them a try and will let you know. ๐
Update: I tried it and it did not appear to have removed the solid hatches. I listed it and it shows solid. My guess is that it's truly a solid, not a solid hatch. Is it possible to update your routine to also include a solid? Thanks again Lee!
Lee, the solid does not have z dimensions. I think it was converted from other 3D software. Anyways, I was able to do a quick selection, but then I'd have to specify its exact layer in order to delete them and there are at least 20 layers that have these 3D solid acting as hatches.
Thank you sir.
Update: I tried it and it did not appear to have removed the solid hatches. I listed it and it shows solid. My guess is that it's truly a solid, not a solid hatch. Is it possible to update your routine to also include a solid? Thanks again Lee!
To clarify: there should be nothing wrong with the posted code based on the original request. The two supplied programs will successfully remove all solid hatches from all layouts of a drawing, as described in the two posts.
From what you have described, it would seem that the issue is the objects you need to delete are not hatches, but rather solids.
I would suggest using either the SSX or FILTER commands to make the appropriate selection, and then erase the active selection.
@kameron1967 wrote:
... I was able to do a quick selection, but then I'd have to specify its exact layer in order to delete them ....
I don't think that's the case. You should be able to get into QSELECT, and in the Object type: section, pull down the list and select the appropriate kind of Solid, and in the Operator: section, pull it down and pick Select All. It should find all of them regardless of Layer [or color, or....] -- hit the Delete button or type E for Erase.
Hello everyone,
I tried using the lisp mentioned ,
only that removes only the hatches and solids remain , you have a solution ?
Mirco
@Anonymous wrote:
Hello everyone,
I tried using the lisp mentioned ,
only that removes only the hatches and solids remain , you have a solution ?
Mirco
From
(= "SOLID" (strcase (vla-get-patternname o)))
to (= "_SOLID" (strcase (vla-get-patternname o)))
But the code from this thread will Delete ALL solid hatch. I could've sworn i replied to your psot on another Forum [ CTT ] where you're asking for solid hatch inside blocks only.
@Anonymous wrote:
....that removes only the hatches and solids remain , you have a solution ?
....
Yes, an old post....
If you're still out there, welcome to these Forums! By "solids" that remain, do you mean 3D Solids, or the 2D ones made with the SOLID command? It would be a simple matter to add an appropriate entity type to the selection part.
Please also add set all colors 'bylayer'?
Thanks a lot!
Kudos to the experts, the routine above alone helps me a lot. Even better if all dimensions be deleted & set all layer color bylayer! cheers!
@owitzki wrote:
Can you also include in this apps deleting all dimensions?
Welcome to these Forums!
Do you mean to delete all Dimensions along with all Solid Hatch patterns? Or are you looking for something to delete all Dimensions only?
It gets a little more complicated, because the ObjectName VLA Property [the "AcDbHatch" part in @Lee_Mac's code] varies among different types of Dimensions, but I believe at least they all end with "Dimension." If you want Dimensions along with Solid Hatches, try this modification [untested]:
.... (if (and (or (and ; Solid Hatches: (= "AcDbHatch" (vla-get-objectname o)) (= "SOLID" (strcase (vla-get-patternname o))) ); and (wcmatch (vla-get-objectname o) "*Dimension") ); or (vlax-write-enabled-p o) ); and (vla-delete o); then ); if ....
Yes please, along with solid hatch and solid entity if not too much... tnx
Is it possible to modify this code, so that for example only solid hatches in White is deleted ?
@Anonymous wrote:
Is it possible to modify this code, so that for example only solid hatches in White is deleted ?
Welcome to these Forums!
Do you mean such objects that are white because that is the color of the Layer they are drawn on [and their color is BYLAYER]. or those that are white for being given a color override [their color is 7]? Either can be done pretty easily, but it makes a difference.
Can't find what you're looking for? Ask the community or share your knowledge.