Jump to content

Cleaning Drawings Lisp?


Guest Brian_MMC

Recommended Posts

Guest Brian_MMC

Hello LISP experts. I could use some help setting something up for cleaning our drawings. Below is written out sequence of commands we use for cleanup of drawings we receive. This is somewhat of a timely process but needed so file size does not get to large. We still need some of the user input on step 8, 12 and 18. Step 14 is a LISP that simply changes all layers in the drawing to By Layer so there are no forced colors. It would probably not hurt to add a Audit at the end for good measure. If there are any other commands you could think of adding to this list or could write a LISP for me I would be very grateful. Thanks for the input and good luck.

Cleaning Drawings Procedures:

1. Remove all xrefs.

a. Type the command XREF press Enter.

b. Highlight all of the xrefs under the main drawing file.

c. Right click on any of the highlighted xrefs.

d. Detach the selected xrefs by clicking on the DETACH option from the right-click menu.

2. Make layer 0 (zero) the current layer.

a. Type the command LAYER press Enter.

b. Double left click on the layer 0 (zero).

c. A green check mark will appear to the left of the layer 0 (zero).

3. Remove all layer filters.

a. Type the command LAYER press Enter.

b. Highlight all of the layer filters listed on the left except the filter "All" and "All Used Layers". These can not be deleted.

c. Right click on any highlighted layer filter.

d. Delete the selected layer filters by clicking on the DELETE option from the right-click menu.

4. Change layer lineweights.

a. Type the command LAYER press Enter.

b. Highlight all the layers.

c. Click on any one of the highlighted layers' lineweights.

d. Click on the 0.25 mm lineweight in the Lineweight window.

e. Click on the OK button to confirm.

5. Make all layers visible.

a. Type the command LAYER press Enter.

b. Highlight all the layers.

c. Find a layers that is turned off and turn them on by clicking on the darkened light bulb.

d. Find a layers that is frozen and thaw them by clicking on the darkened snow flake.

e. Find a layers that is locked and unlock them by clicking on the darkened padlock.

f. Click on the X in the upper left corner to exit the layer properties manager window.

6. Remove all layer states.

a. Type the command LAYERSTATE press Enter.

b. Highlight all of the layer states listed.

c. Delete the selected layer states by clicking on the DELETE button on the right.

d. Click the "YES TO ALL" to confirm.

e. Click on the CLOSE button to exit the window.

7. Erase all layout tabs.

a. Click on the first layout tab.

b. While holding down the SHIFT key on the keyboard, click on the last layout tab.

c. Right click on any of the highlighted layout tabs.

d. Delete the selected layout tabs by clicking on the DELETE option from the right-click menu.

e. Click on the OK button to confirm you want the tabs deleted.

8. Remove unnecessary information from model space drawing.

a. Erase all text that is not important for our needs. (ex. door types, wall types, room square footages, dimensions, notes, detail symbols, section symbols, etc.)

b. Erase all miscellaneous lines and objects that are not important for our needs. (ex. constuction lines, dimension lines, detail lines, section lines, symblos, etc.)

c. Skip the rest of this step if the drawing is a 3D model.

d. Type the command OVERKILL press Enter.

e. Type ALL to select all of the items in the drawing press Enter.

f. Press Enter again and make sure all of the options under the "Object comparison settings" are unchecked.

g. Make sure all of the options under the "Lines, Arcs and Plines" are checked.

h. Click on the OK button to execute the command.

9. Remove all named views.

a. Type the commmand VIEW press Enter.

b. Highlight all of the named views under the "Model Views" heading (on the left).

c. Delete the selected named views by clicking on the DELETE button on the right.

d. Click on the OK button to exit the window.

10. Remove all scale lists.

a. Type the command SCALELISTEDIT press Enter

b. Click on the RESET button.

c. Click on the "RESTORE THE DEFAULT LIST OF SCALES" option.

d. Click OK to exit the window.

11. Remove all regapps.

a. Type the command -PU press Enter.

b. Type R for regapps press Enter.

c. It will ask for the names to be purged. Just press the ENTER key on the keyboard.

d. It will then ask if you want to verify each name to be purged. Type N for no press Enter.

12. Remove all "x" data.

a. Type the command E for erase press Enter.

b. Type this exactly: (SSGET"X") press Enter.

c. Type ALL to select all press Enter.

d. Type R for remove press Enter.

e. Then select all of the items in the drawing that you do NOT want to erase with a blue crossing window.

f. Press the ENTER key on the keyboard.

13. Purge the drawing.

a. Type the command PU for purge press Enter.

b. Click on the PURGE ALL button on the bottom. Click on this button until you can no longer select it.

c. Click on the CLOSE button to exit the window.

14. Set all color layers to bylayer.

a. Type the command COLORX press Enter.

b. Click on the BYLAYER button.

c. Click on the OK button to exit the window.

15. Define the insertion point.

a. Type the command INSBASE press Enter.

b. Type 0,0,0 and then press the ENTER key.

16. Define linetype scales.

a. Type the command LTS press Enter.

b. Type 1 to set the linetype scale to 1 press Enter.

c. Type the command MSLTSCALE press Enter.

d. Type 1 to set the model space linetype scale to 1 press Enter.

e. Type the command PSLTSCALE press Enter.

f. Type 1 to set the paper space linetype scale to 1 press Enter.

17. Change the annotation scale to 1/4"=1'-0".

a. In the lower right side of the CAD Screen click on the Annotation Scale button

b. Click on the 1/4"=1'-0" option.

18. Name and save drawing file.

a. Type the command SAVEAS press Enter.

b. Browse to the appropriate location to save the file.

c. Type a new name next to the "File Name" heading. (Do not name the file the same as the original file.)

d. Click on the SAVE button to save the file and exit the window.

Link to comment
Share on other sites

This will do most of that:

 

(defun c:Brian (/ *error* uFlag)
 (vl-load-com)

 (defun *error* (msg)
   (and uFlag (vla-EndUndoMark *doc))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ))

 (setq *doc (cond (*doc) ((vla-get-ActiveDocument
                            (vlax-get-acad-object)))))

 (setq uFlag (not (vla-StartUndoMark *doc)))

 (vlax-for blk (vla-get-Blocks *doc)
   
   (if (eq :vlax-true (vla-get-isXref blk))
     (if (vl-catch-all-error-p
           (vl-catch-all-apply
             (function vla-Detach) (list blk)))
       (princ (strcat "\n** Error Detaching Xref: "
                      (vla-get-name blk) " **")))))

 (vlax-for lay (vla-get-Layers *doc)    
   (vla-put-Lineweight lay acLnWt025)
   (vla-put-LayerOn lay :vlax-true))

 (vlax-for lay (vla-get-layouts *doc)
   (if (not (eq "MODEL" (strcase (vla-get-Name lay))))
     (vla-delete lay)))

 (vlax-for v (vla-get-views *doc)
   (vla-delete v))

 (command "_.-scalelistedit" "_R" "_Y" "_E")

 (vl-Catch-All-Apply
   (function
     (lambda nil
       (vla-Remove
         (vla-GetExtensionDictionary (vla-Get-Layers *doc)) "ACAD_LAYERFILTERS"))))

 (if (setq states (layerstate-getnames t t))
   (mapcar (function layerstate-delete) states))

 (repeat 3 (vla-PurgeAll *doc))

 (mapcar (function setvar)
         
         '("CLAYER" "INSBASE"    "CANNOSCALE"    "LTSCALE" "MSLTSCALE" "PSLTSCALE")
         '(  "0"     (0 0 0)    "1/4\" = 1'-0\""     1           1           1    ))

 (setq uFlag (vla-EndUndoMark *doc))
 (princ))

 
 

Link to comment
Share on other sites

You could most of want you want to do via a script or autolisp

 

The basic need is to know the command line syntax of the command. GUIs might be fine for some things but not automation.

 

A simple script for the layers could look like this:

 

_.LAYER

_.ON

*

_Thaw

*

_Unlock

*

_Set

0

 

 

Make sure you use a real ACSII text editor and save the file with the .scr extension

 

 

I would think that there are tutorials on scripts in CadTutor or Afralisp. -David

Link to comment
Share on other sites

Guest Brian_MMC

Lee Mac. your dealing with a real LISP beginner here. Would you please toss me a quick how to on getting that added into cad?

Thanks,

David thanks for the button idea.

I will give everything a try when I get in to the office tomorrow.

Thanks again

Brian.

Link to comment
Share on other sites

Lee Mac. your dealing with a real LISP beginner here. Would you please toss me a quick how to on getting that added into cad?

 

Thanks,

 

David thanks for the button idea.

 

I will give everything a try when I get in to the office tomorrow.

 

Thanks again

Brian.

 

Hi Brian,

 

I think it may need a bit of tweaking as far as the CANNOSCALE goes, but to load it in CAD:

 

http://www.cadtutor.net/forum/showthread.php?t=1390

Link to comment
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...