Lisp to clean up drawing

Lisp to clean up drawing

barry2104
Collaborator Collaborator
4,432 Views
8 Replies
Message 1 of 9

Lisp to clean up drawing

barry2104
Collaborator
Collaborator

I'm aware there are similar requests on this forum but as far as I know/can find, nothing that fits my exact requiremenst.

I often get .dwg/.dxf files from architects which have been created in non-AutoCAD software (revit, microstation, etc.) and have a lot of useless information which bloats the file. I would like to use a single-command (lisp) to carry out the following on the (opened) .dwg file:

1) explode all blocks repeatedly, until there are no more blocks in the drawing

2) turn all layers to Layer=0 and colour=ByLayer and line weight = ByLayer

3) purge to remove any now unused layer, unused blocks, unused scales, etc.

4) overkill to remove any duplicate elements (to an accuracy of 0.0001)

5) check drawing units and change to METER if not already set to METER

6) zoom extents

 

Does anyone have something like this handy or can write a lisp up for me?

Ultimately I want to convert that lisp into a clickable icon/command to put inside a ribbon, but that's a different topic / for another day

Running AutoCAD Architecture 2020, in German
0 Likes
4,433 Views
8 Replies
Replies (8)
Message 2 of 9

hak_vz
Advisor
Advisor

I have put in a single file solutions for particular task and joined all to command "Cleanex".

It needs a bit of polishing but I don't have time to do it.

I have omitted "zoom - extends" since one dislocated point  can extend zoom to maximum.

It's not tested just on a sample drawing, so use it carefully.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 3 of 9

pbejse
Mentor
Mentor

or you use this..

 

kleanex.png

 

Also not  not tested just on a sample drawing, so use it carefully.

 

Message 4 of 9

Sea-Haven
Mentor
Mentor

This has been commented before rather than explode blocks reset them to layer 0, bylayer and bylayer. exploding blocks makes the dwg bloated and more difficult to work on.

Message 5 of 9

barry2104
Collaborator
Collaborator

Thanks, yes that is probably a good point. Not sure if "reset them to layer 0, bylayer and bylayer" would also be possible if the block had blocks within itself though? And if those inner blocks also had further blocks within themselves? Could all of these blocks even get reset easily or only the blocks in the highest level?

 

Running AutoCAD Architecture 2020, in German
0 Likes
Message 6 of 9

barry2104
Collaborator
Collaborator

That lisp doesn't seem to work, not sure why though as I'm not a lisper

Running AutoCAD Architecture 2020, in German
0 Likes
Message 8 of 9

barry2104
Collaborator
Collaborator

I found (and read through) that thread before posting here. It's not quite what I'm after unfortunately

Running AutoCAD Architecture 2020, in German
0 Likes
Message 9 of 9

devitg
Advisor
Advisor

Would you, please, upload such dwg??

0 Likes