Drawl routine to tidy up drawings

Drawl routine to tidy up drawings

m_axburns090
Participant Participant
295 Views
2 Replies
Message 1 of 3

Drawl routine to tidy up drawings

m_axburns090
Participant
Participant

I have been attempting to make a stutter order to tidy up specialist drawings. I have cobbled the code beneath utilizing a combination looking through the web and irregular programming information from when I was in school. The code is inconvenient with a couple of blunder messages and prompts coming up, yet it is to some degree working.

I'm attempting to do the accompanying:

Turn on every one of the layers

Defrost every one of the layers

Select and burst all Blocks (10x)

Select and erase all Solids

Select and erase every single 3D Strong

Select and erase all Crashes

Select and erase all Aspects

Select and erase all Trapdoors

Change all article tones to "by layer"

Cleanse everything 

(defun c:ARCHCLEAN ()
;drawing cleanup
    (order "_.LAYON")
    ;turn all layers on
    (order "LAYTHW")
    ;defrost all layers
    (setq cnt 0) (rehash 10
    (setq ss (ssget "_X" '((0 . "INSERT"))))
        (on the off chance that ss
            (progn
                (order "_.burst" ss "")
                (setq cnt (1+ cnt))
            )
        )
    )
    (princ)
    ;chooses all blocks and blasts them multiple times
    (setq ss (ssget "_X" '((0 . "SOLID"))))
        (if ss
            (progn
                (order "_.erase" ss "")
    (princ)
    ;chooses all solids and erases them
    (setq ss (ssget "_X" '((0 . "3DSOLID"))))
        (if ss
            (progn
                (order "_.erase" ss "")
    (princ)
    ;chooses every 3D strong and erases them
    (setq ss (ssget "_X" '((0 . "WIPEOUT"))))
        (if ss
            (progn
                (order "_.erase" ss "")
    (princ)
    ;chooses all crashes and erases them
    (setq ss (ssget "_X" '((0 . "DIMENSION"))))
        (on the off chance that ss
            (progn
                (order "_.erase" ss "")
    (princ)
    ;chooses all aspects and erases them
    (setq ss (ssget "_X" '((0 . "HATCH"))))
        (if ss
            (progn
                (order "_.erase" ss "")
    (princ)
    ;chooses all trapdoors and erases them
    (order "_.- layer" "_all" "_color" "bylayer" "")
    (princ)
    ;change all articles and changes to variety by layer
    (order "_.- cleanse" "all" "*" "N" "")
    (princ)
    ;cleanses every single unused component
)

  

0 Likes
296 Views
2 Replies
Replies (2)
Message 2 of 3

Moshe-A
Mentor
Mentor

@m_axburns090  hi,

 

The autolisp you post is missing (order) function which by the way looks very advance one, cause it gets a variable number of parameters.

 

anyway i suggest you post a sample dwg. 

 

Moshe

0 Likes
Message 3 of 3

Kent1Cooper
Consultant
Consultant

@Moshe-A wrote:

The autolisp you post is missing (order) function....


I think we have a translation/synonym problem -- "order" is probably "command," in the Topic heading "drawl" is probably "lisp," and some are clarified in the code ["strong" is "solid," "trapdoor" is "hatch," "tone" is "color," etc.].

 

@m_axburns090 , does it work if you simply replace the word "order" with "command" [the actual AutoLisp function name] and probably replace "cleanse" with "purge" [and eliminate the space before it]?

 

EDIT:  No, it wouldn't.  You don't complete most of the (if) functions, nor the (progn) functions inside them [which are not needed anyway].  BUT you can get all those things you want to Erase together instead of one kind at a time:

 

(if (setq ss (ssget "_X" '((0 . "*SOLID,WIPEOUT,DIMENSION,HATCH"))))
  (command "_.erase" ss ""); then
); end if

 

That won't get them in other spaces than the current space, if that's an issue, but neither would your original, even with the (if) functions structured properly.

Kent Cooper, AIA
0 Likes